examples.demo_openai_text¶
Demo: OpenAI API - Text Chat Shows how to use vllm-mlx with the OpenAI Python SDK for text-only chat.
View the complete module source at #L1-L123.
API details¶
Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.
examples.demo_openai_text
¶
Demo: OpenAI API - Text Chat
Shows how to use vllm-mlx with the OpenAI Python SDK for text-only chat.
Usage
-
Start the server with any model (served model name is defaulted to "mlx-community/Llama-3.2-3B-Instruct-4bit"): vllm-mlx serve mlx-community/Llama-3.2-3B-Instruct-4bit --port 8000
-
Run this script: python examples/demo_openai_text.py
examples.demo_openai_text.client
module-attribute
¶
examples.demo_openai_text.response
module-attribute
¶
response = client.chat.completions.create(model='mlx-community/Llama-3.2-3B-Instruct-4bit', messages=messages, max_tokens=50)
examples.demo_openai_text.stream
module-attribute
¶
stream = client.chat.completions.create(model='mlx-community/Llama-3.2-3B-Instruct-4bit', messages=[{'role': 'user', 'content': 'Tell me a short joke'}], max_tokens=150, stream=True)
examples.demo_openai_text.messages
module-attribute
¶
examples.demo_openai_text.prompt
module-attribute
¶
Complete contract reference¶
Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.
This module does not declare classes or functions.
Complete symbol map¶
This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.
This module does not declare classes or functions.