Skip to content

Commit c352e19

Browse files
committed
using json_schema
1 parent b462480 commit c352e19

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

flat_ai/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__title__ = 'flat-ai'
22
__package_name__ = 'flat_ai'
3-
__version__ = '0.3.0'
3+
__version__ = '0.3.1'
44
__description__ = 'F.L.A.T. (Frameworkless LLM Agent Thing) for building AI Agents'
55
__email__ = 'hello@mindsdb.com'
66
__author__ = 'Yours truly Jorge Torres and an LLM'

flat_ai/flat_ai.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -202,25 +202,19 @@ def _execute():
202202
**kwargs,
203203
)
204204

205-
if isinstance(self.client, MyOpenAI):
206-
response = self.client.chat.completions.create(
207-
model=self.model,
208-
response_format={
209-
"type": "json_schema",
210-
"json_schema": {
211-
"name": schema_class.__name__,
212-
"schema": schema,
213-
},
205+
206+
response = self.client.chat.completions.create(
207+
model=self.model,
208+
response_format={
209+
"type": "json_schema",
210+
"json_schema": {
211+
"name": schema_class.__name__,
212+
"schema": schema,
214213
},
215-
messages=messages,
216-
)
217-
else:
218-
response = self.client.chat.completions.create(
219-
model=self.model,
220-
response_format={"type": "json_object", "schema": schema},
221-
messages=messages,
222-
)
223-
214+
},
215+
messages=messages,
216+
)
217+
224218
result = json.loads(response.choices[0].message.content)
225219

226220
# Handle list of Pydantic models

0 commit comments

Comments
 (0)