This commit is contained in:
Aidan Do 2024-11-26 10:05:00 +00:00
parent f946d23d8e
commit 5a845cebfd

9
2.py
View file

@ -11,13 +11,9 @@ client = OpenAI(base_url="http://localhost:8000/v1", api_key="fake")
completion = client.chat.completions.create( completion = client.chat.completions.create(
model="meta-llama/Llama-3.2-3B-Instruct", model="meta-llama/Llama-3.2-3B-Instruct",
messages=[ messages=[
{ {"role": "user", "content": "Write me a haiku about coding"},
"role": "user",
"content": "Write me a haiku about coding",
},
], ],
extra_body={ response_format={
"response_format": {
"type": "json_schema", "type": "json_schema",
"json_schema": { "json_schema": {
"name": "name_of_response_format", "name": "name_of_response_format",
@ -32,7 +28,6 @@ completion = client.chat.completions.create(
}, },
"strict": True, "strict": True,
}, },
}
}, },
) )