File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ jobs:
100100 examples :
101101 timeout-minutes : 10
102102 name : examples
103+ environment : ci
103104 runs-on : ${{ github.repository == 'stainless-sdks/openai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
104105 if : github.repository == 'openai/openai-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
105106
Original file line number Diff line number Diff line change 99
1010
1111async def main () -> None :
12- stream = await client .completions .create (
13- model = "gpt-3.5-turbo-instruct" ,
14- prompt = "Say this is a test" ,
12+ stream = await client .chat .completions .create (
13+ model = "gpt-5.5" ,
14+ messages = [
15+ {
16+ "role" : "user" ,
17+ "content" : "Say this is a test" ,
18+ },
19+ ],
1520 stream = True ,
1621 )
17- async for completion in stream :
18- print (completion .choices [0 ].text , end = "" )
22+ async for chunk in stream :
23+ if not chunk .choices :
24+ continue
25+
26+ print (chunk .choices [0 ].delta .content , end = "" )
1927 print ()
2028
2129
Original file line number Diff line number Diff line change 88# Non-streaming:
99print ("----- standard request -----" )
1010completion = client .chat .completions .create (
11- model = "gpt-4 " ,
11+ model = "gpt-5.5 " ,
1212 messages = [
1313 {
1414 "role" : "user" ,
2121# Streaming:
2222print ("----- streaming request -----" )
2323stream = client .chat .completions .create (
24- model = "gpt-4 " ,
24+ model = "gpt-5.5 " ,
2525 messages = [
2626 {
2727 "role" : "user" ,
4040# Response headers:
4141print ("----- custom response headers test -----" )
4242response = client .chat .completions .with_raw_response .create (
43- model = "gpt-4 " ,
43+ model = "gpt-5.5 " ,
4444 messages = [
4545 {
4646 "role" : "user" ,
You can’t perform that action at this time.
0 commit comments