Support OpenAI API json_schema response format (#1363)

This commit is contained in:
zifeitong
2024-09-09 19:08:25 -07:00
committed by GitHub
parent 69b3bb9ae1
commit 9144ed1067
4 changed files with 41 additions and 21 deletions

View File

@@ -79,7 +79,10 @@ class TestJSONConstrained(unittest.TestCase):
],
temperature=0,
max_tokens=128,
extra_body={"json_schema": self.json_schema},
response_format={
"type": "json_schema",
"json_schema": {"name": "foo", "schema": json.loads(self.json_schema)},
},
)
text = response.choices[0].message.content