Skip to content

Commit f7ef379

Browse files
committed
client-openai-completions.py
1 parent 23cc5c6 commit f7ef379

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

llm/client-openai-completions.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/python3
2+
3+
import os
4+
5+
from openai import OpenAI
6+
7+
c = OpenAI(base_url="http://localhost:8321/v1/", api_key="none")
8+
9+
completion = c.chat.completions.create(
10+
model=os.getenv("INFERENCE_MODEL", "ollama/llama3.2:3b"),
11+
messages=[ { "role": "user", "content": "Hi", }, ],
12+
)
13+
14+
print(completion.choices[0].message.content)

0 commit comments

Comments
 (0)