Skip to content

Commit

Permalink
docs: bump models in example snippets to gpt-4o (#1861)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stainless Bot committed Nov 12, 2024
1 parent 362cf74 commit adafe08
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ chat_completion = client.chat.completions.create(
"content": "Say this is a test",
}
],
model="gpt-3.5-turbo",
model="gpt-4o",
)
```

Expand Down Expand Up @@ -164,7 +164,7 @@ async def main() -> None:
"content": "Say this is a test",
}
],
model="gpt-3.5-turbo",
model="gpt-4o",
)


Expand All @@ -183,8 +183,13 @@ from openai import OpenAI
client = OpenAI()

stream = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Say this is a test"}],
messages=[
{
"role": "user",
"content": "Say this is a test",
}
],
model="gpt-4o",
stream=True,
)
for chunk in stream:
Expand Down Expand Up @@ -231,7 +236,7 @@ openai.base_url = "https://..."
openai.default_headers = {"x-foo": "true"}

completion = openai.chat.completions.create(
model="gpt-4",
model="gpt-4o",
messages=[
{
"role": "user",
Expand Down Expand Up @@ -349,7 +354,7 @@ completion = client.chat.completions.create(
"content": "Can you generate an example json object describing a fruit?",
}
],
model="gpt-3.5-turbo-1106",
model="gpt-4o",
response_format={"type": "json_object"},
)
```
Expand Down Expand Up @@ -389,7 +394,7 @@ client = OpenAI()

try:
client.fine_tuning.jobs.create(
model="gpt-3.5-turbo",
model="gpt-4o",
training_file="file-abc123",
)
except openai.APIConnectionError as e:
Expand Down Expand Up @@ -456,10 +461,10 @@ client.with_options(max_retries=5).chat.completions.create(
messages=[
{
"role": "user",
"content": "How can I get the name of the current day in Node.js?",
"content": "How can I get the name of the current day in JavaScript?",
}
],
model="gpt-3.5-turbo",
model="gpt-4o",
)
```

Expand Down Expand Up @@ -490,7 +495,7 @@ client.with_options(timeout=5.0).chat.completions.create(
"content": "How can I list all files in a directory using Python?",
}
],
model="gpt-3.5-turbo",
model="gpt-4o",
)
```

Expand Down Expand Up @@ -535,7 +540,7 @@ response = client.chat.completions.with_raw_response.create(
"role": "user",
"content": "Say this is a test",
}],
model="gpt-3.5-turbo",
model="gpt-4o",
)
print(response.headers.get('X-My-Header'))

Expand Down Expand Up @@ -568,7 +573,7 @@ with client.chat.completions.with_streaming_response.create(
"content": "Say this is a test",
}
],
model="gpt-3.5-turbo",
model="gpt-4o",
) as response:
print(response.headers.get("X-My-Header"))

Expand Down
8 changes: 4 additions & 4 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
"content": "Say this is a test",
}
],
model="gpt-3.5-turbo",
model="gpt-4o",
),
),
cast_to=httpx.Response,
Expand All @@ -753,7 +753,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non
"content": "Say this is a test",
}
],
model="gpt-3.5-turbo",
model="gpt-4o",
),
),
cast_to=httpx.Response,
Expand Down Expand Up @@ -1594,7 +1594,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
"content": "Say this is a test",
}
],
model="gpt-3.5-turbo",
model="gpt-4o",
),
),
cast_to=httpx.Response,
Expand All @@ -1620,7 +1620,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter)
"content": "Say this is a test",
}
],
model="gpt-3.5-turbo",
model="gpt-4o",
),
),
cast_to=httpx.Response,
Expand Down

0 comments on commit adafe08

Please sign in to comment.