Text Generation
Transformers
Safetensors
English
speech
duplex
voice-assistant
streaming
tool-calling
qwen
text-to-speech
Instructions to use sadmN/aiden-duplex with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sadmN/aiden-duplex with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sadmN/aiden-duplex")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("sadmN/aiden-duplex", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sadmN/aiden-duplex with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sadmN/aiden-duplex" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sadmN/aiden-duplex", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/sadmN/aiden-duplex
- SGLang
How to use sadmN/aiden-duplex with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "sadmN/aiden-duplex" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sadmN/aiden-duplex", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "sadmN/aiden-duplex" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sadmN/aiden-duplex", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use sadmN/aiden-duplex with Docker Model Runner:
docker model run hf.co/sadmN/aiden-duplex
Download code/duplex/tavily_search.py from sadmN/aiden-duplex: direct link, hf CLI and curl.
- Browser
- Download file 2.78 kB
-
https://huggingface.co/sadmN/aiden-duplex/resolve/main/code/duplex/tavily_search.py
- Command line
-
hf download hf://sadmN/aiden-duplex/code/duplex/tavily_search.py
-
curl -L -o tavily_search.py https://huggingface.co/sadmN/aiden-duplex/resolve/main/code/duplex/tavily_search.py
2.78 kB
| """Bounded, cancellable Tavily requests for the live web-search tool.""" | |
| from __future__ import annotations | |
| import asyncio | |
| import re | |
| from urllib.parse import urlsplit | |
| import aiohttp | |
| WEB_SEARCH = {'type': 'function', 'function': { | |
| 'name': 'web_search', | |
| 'description': 'Search the public web for requested or time-sensitive information.', | |
| 'parameters': {'type': 'object', 'properties': {'query': {'type': 'string'}}, | |
| 'required': ['query']}, | |
| }} | |
| def plain(value, length): | |
| # Tool result strings are data, never Qwen protocol delimiters. | |
| return re.sub(r'\s+', ' ', str(value or '')).strip()[:length].replace('<', '‹').replace('>', '›') | |
| class TavilySearch: | |
| def __init__(self, key): | |
| self.key = key | |
| async def __call__(self, query): | |
| query = plain(query, 256) | |
| failure = {'source': 'tavily', 'query': query, 'status': 'error'} | |
| try: | |
| timeout = aiohttp.ClientTimeout(total=12, connect=4) | |
| payload = {'query': query, 'max_results': 3, 'search_depth': 'basic', | |
| 'include_answer': 'basic', 'include_raw_content': False} | |
| async with aiohttp.ClientSession(timeout=timeout) as session: | |
| async with session.post('https://api.tavily.com/search', json=payload, | |
| headers={'Authorization': f'Bearer {self.key}'}, | |
| allow_redirects=False) as response: | |
| if response.status != 200: | |
| return dict(failure, reason=f'HTTP {response.status}') | |
| data = await response.json() | |
| except (aiohttp.ClientError, asyncio.TimeoutError, ValueError): | |
| return dict(failure, reason='Search service unavailable') | |
| if not isinstance(data, dict) or not isinstance(data.get('results'), list): | |
| return dict(failure, reason='Unexpected search response') | |
| results = [] | |
| for row in (data.get('results') or [])[:3]: | |
| if not isinstance(row, dict): | |
| continue | |
| url = plain(row.get('url'), 450) | |
| try: | |
| parsed = urlsplit(url) | |
| except ValueError: | |
| continue | |
| if parsed.scheme not in ('https', 'http') or not parsed.netloc or parsed.username: | |
| continue | |
| results.append({'title': plain(row.get('title') or parsed.hostname, 140), | |
| 'url': url, 'excerpt': plain(row.get('content'), 420)}) | |
| if not results: | |
| return dict(failure, status='no_match', reason='No usable sources returned') | |
| return {'source': 'tavily', 'query': query, 'status': 'ok', | |
| 'answer': plain(data.get('answer'), 520), 'results': results} | |