From 5a845cebfd3161738105e7d402cd907b9856afa5 Mon Sep 17 00:00:00 2001 From: Aidan Do Date: Tue, 26 Nov 2024 10:05:00 +0000 Subject: [PATCH] . --- 2.py | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/2.py b/2.py index 989d93a65..f25ee397f 100644 --- a/2.py +++ b/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, + }, }, )