mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-17 17:52:41 +00:00
.
This commit is contained in:
parent
f946d23d8e
commit
5a845cebfd
1 changed files with 14 additions and 19 deletions
33
2.py
33
2.py
|
|
@ -11,28 +11,23 @@ client = OpenAI(base_url="http://localhost:8000/v1", api_key="fake")
|
|||
completion = client.chat.completions.create(
|
||||
model="meta-llama/Llama-3.2-3B-Instruct",
|
||||
messages=[
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Write me a haiku about coding",
|
||||
},
|
||||
{"role": "user", "content": "Write me a haiku about coding"},
|
||||
],
|
||||
extra_body={
|
||||
"response_format": {
|
||||
"type": "json_schema",
|
||||
"json_schema": {
|
||||
"name": "name_of_response_format",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"completion_message": {
|
||||
"type": "string",
|
||||
}
|
||||
},
|
||||
"required": ["completion_message"],
|
||||
response_format={
|
||||
"type": "json_schema",
|
||||
"json_schema": {
|
||||
"name": "name_of_response_format",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"completion_message": {
|
||||
"type": "string",
|
||||
}
|
||||
},
|
||||
"strict": True,
|
||||
"required": ["completion_message"],
|
||||
},
|
||||
}
|
||||
"strict": True,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue