File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change 3939 "outputs" : [],
4040 "source" : [
4141 " import os\n " ,
42+ " \n " ,
4243 " import openai\n " ,
4344 " \n " ,
4445 " # OpenAI API key\n " ,
9293 " max_tokens=50\n " ,
9394 " )\n " ,
9495 " \n " ,
95- " print( \" Chat Completions: \" , response.choices[0].message.content) "
96+ " response.choices[0].message.content"
9697 ]
9798 },
9899 {
118119 " max_output_tokens=50\n " ,
119120 " )\n " ,
120121 " \n " ,
121- " # Extract response text\n " ,
122- " if response.output and len(response.output) > 0:\n " ,
123- " result = response.output[0].content[0].text\n " ,
124- " print(\" Responses API:\" , result)\n " ,
125- " print(f\" Response ID: {response.id}\" )\n else:\n " ,
126- " print(\" Responses API not available in this OpenAI version\" )"
122+ " # Response is automatically traced\n " ,
123+ " response\n " ,
124+ " else:\n " ,
125+ " \" Responses API not available in this OpenAI version\" "
127126 ]
128127 },
129128 {
148147 " stream=True\n " ,
149148 " )\n " ,
150149 " \n " ,
151- " print( \" Streaming response: \" , end= \"\" ) \n " ,
150+ " # Consume the stream - automatically traced \n " ,
152151 " for chunk in stream:\n " ,
153152 " if chunk.choices[0].delta.content:\n " ,
154- " print(chunk.choices[0].delta.content, end=\"\" )\n print(\"\\ n✓ All requests automatically traced to Openlayer!\" )"
153+ " pass # Process chunks as needed\n " ,
154+ " \n " ,
155+ " # ✓ All requests automatically traced to Openlayer!"
155156 ]
156157 },
157158 {
194195 },
195196 "nbformat" : 4 ,
196197 "nbformat_minor" : 5
197- }
198+ }
You can’t perform that action at this time.
0 commit comments