You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Align docs with AIML examples and update release config
Refactored comments in _version.py to clarify versioning scheme and added release automation marker. Cleaned up release-please-config.json by removing prerelease and extra file settings for improved configuration clarity.
Copy file name to clipboardExpand all lines: helpers.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Structured Outputs Parsing Helpers
2
2
3
-
The OpenAI API supports extracting JSON from the model with the `response_format` request param, for more details on the API, see [this guide](https://platform.openai.com/docs/guides/structured-outputs).
3
+
The AI/ML API supports extracting JSON from the model with the `response_format` request param (see [the guide](https://docs.aimlapi.com/guides/structured-outputs)) and remains fully compatible with the upstream OpenAI client surface.
4
4
5
5
The SDK provides a `client.chat.completions.parse()` method which is a wrapper over the `client.chat.completions.create()` that
6
6
provides richer integrations with Python specific types & returns a `ParsedChatCompletion` object, which is a subclass of the standard `ChatCompletion` class.
@@ -13,7 +13,7 @@ into a JSON schema, send it to the API and parse the response content back into
13
13
```py
14
14
from typing import List
15
15
from pydantic import BaseModel
16
-
fromopenaiimportOpenAI
16
+
fromaimlapiimportAIMLAPI
17
17
18
18
classStep(BaseModel):
19
19
explanation: str
@@ -23,7 +23,7 @@ class MathResponse(BaseModel):
23
23
steps: List[Step]
24
24
final_answer: str
25
25
26
-
client =OpenAI()
26
+
client =AIMLAPI()
27
27
completion = client.chat.completions.parse(
28
28
model="gpt-4o-2024-08-06",
29
29
messages=[
@@ -45,7 +45,7 @@ else:
45
45
46
46
The `.parse()` method will also automatically parse `function` tool calls if:
47
47
48
-
- You use the `openai.pydantic_function_tool()` helper method
48
+
- You use the `aimlapi.pydantic_function_tool()` helper method
0 commit comments