Skip to content

Commit 4826e57

Browse files
committed
llama-stack-client-completions-min.py
1 parent 98164c8 commit 4826e57

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/python3
2+
3+
# export INFERENCE_MODEL=llama3.2:1b-instruct-fp16
4+
## start ollama:
5+
# ollama run $INFERENCE_MODEL
6+
## start llama-stack:
7+
# uv run --with llama-stack llama stack build --template ollama --image-type venv --image-name ~/my-ollama-llama-stack --run
8+
9+
from llama_stack_client import LlamaStackClient
10+
11+
c = LlamaStackClient(base_url="http://localhost:8321")
12+
13+
r = c.chat.completions.create(
14+
model="gemini/models/gemini-2.5-pro",
15+
messages=[
16+
{"role": "system", "content": "You are a helpful assistant."},
17+
{"role": "user", "content": "Write a haiku about coding"},
18+
],
19+
)
20+
print(r.choices[0].message.content)

0 commit comments

Comments
 (0)