Files
c3be7b6be4 Add the SmolLM3 model! (#1501)
* Add model

* Update loader

* Fix llama config usage

* Docs

* Fix config no_rope_layers

* Fix tie_word_embeddings default

* Add chat template

* Embed the chat templates

* Fix embedding template

* enable_thinking default true

* Update examples

* XML tools for smollm3

* Add smollm3 docs

* Fix openai examples

* Clippy

---------

Co-authored-by: Eric Buehler <[email protected]>
2025-07-08 14:48:58 -04:00

38 lines
1.2 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from openai import OpenAI
# Point the client to the locally running server
client = OpenAI(api_key="foobar", base_url="http://localhost:1234/v1/")
# Remote assets – feel free to swap for anything else
IMAGE_URL = "https://www.allaboutbirds.org/guide/assets/og/528129121-1200px.jpg"
AUDIO_URL = "https://upload.wikimedia.org/wikipedia/commons/4/42/Bird_singing.ogg"
completion = client.chat.completions.create(
model="default",
messages=[
{
"role": "user",
"content": [
{ # Audio clip
"type": "audio_url",
"audio_url": {"url": AUDIO_URL},
},
{ # Image
"type": "image_url",
"image_url": {"url": IMAGE_URL},
},
{ # Text with explicit tokens referring to the audio/image above
"type": "text",
"text": "<|audio_1|><|image_1|> Describe in detail what is happening, referencing both what you hear and what you see.",
},
],
}
],
max_tokens=256,
temperature=0.2,
top_p=0.9,
)
print(completion.choices[0].message.content)