mirror of
https://github.com/zenlm/engine.git
synced 2026-10-30 15:00:05 +00:00
* 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]>
17 lines
351 B
Python
17 lines
351 B
Python
import sys
|
|
from openai import OpenAI
|
|
|
|
client = OpenAI(api_key="foobar", base_url="http://localhost:1234/v1/")
|
|
|
|
|
|
response = client.completions.create(
|
|
model="default",
|
|
prompt="My favorite theorem is",
|
|
max_tokens=32,
|
|
stream=True,
|
|
)
|
|
for chunk in response:
|
|
delta = chunk.choices[0].text
|
|
print(delta, end="")
|
|
sys.stdout.flush()
|