@@ -67,7 +67,7 @@ func Example_assistantsUsingFunctionTool() {
6767 }
6868
6969 // First, let's create an assistant.
70- createAssistantResp , err := client .CreateAssistant (context .Background (), azopenaiassistants.CreateAssistantBody {
70+ createAssistantResp , err := client .CreateAssistant (context .TODO (), azopenaiassistants.CreateAssistantBody {
7171 Name : & assistantName ,
7272 DeploymentName : to .Ptr ("gpt-4-1106-preview" ),
7373 Instructions : to .Ptr ("You are a personal math tutor. Write and run code to answer math questions." ),
@@ -90,7 +90,7 @@ func Example_assistantsUsingFunctionTool() {
9090 var lastMessageID , runID , threadID string
9191 {
9292 fmt .Fprintf (os .Stderr , "Creating our thread\n " )
93- createThreadResp , err := client .CreateThread (context .Background (), azopenaiassistants.CreateThreadBody {}, nil )
93+ createThreadResp , err := client .CreateThread (context .TODO (), azopenaiassistants.CreateThreadBody {}, nil )
9494
9595 if err != nil {
9696 // TODO: Update the following line with your application specific error handling logic
@@ -99,7 +99,7 @@ func Example_assistantsUsingFunctionTool() {
9999
100100 threadID = * createThreadResp .ID
101101
102- msgResponse , err := client .CreateMessage (context .Background (), threadID , azopenaiassistants.CreateMessageBody {
102+ msgResponse , err := client .CreateMessage (context .TODO (), threadID , azopenaiassistants.CreateMessageBody {
103103 Content : & question ,
104104 Role : to .Ptr (azopenaiassistants .MessageRoleUser ),
105105 }, nil )
@@ -114,7 +114,7 @@ func Example_assistantsUsingFunctionTool() {
114114 // run the thread
115115 fmt .Fprintf (os .Stderr , "Creating our run for thread %s\n " , * createThreadResp .ID )
116116
117- createRunResp , err := client .CreateRun (context .Background (), * createThreadResp .ID , azopenaiassistants.CreateRunBody {
117+ createRunResp , err := client .CreateRun (context .TODO (), * createThreadResp .ID , azopenaiassistants.CreateRunBody {
118118 AssistantID : createAssistantResp .ID ,
119119 Instructions : to .Ptr ("Use functions to answer questions, when possible." ),
120120 }, nil )
@@ -130,7 +130,7 @@ func Example_assistantsUsingFunctionTool() {
130130 fmt .Fprintf (os .Stderr , "Waiting for the Run status to indicate it needs tool outputs\n " )
131131 // NOTE: see https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants#example-package-AssistantsConversationLoop
132132 // for the pollUntilRunEnds function.
133- lastResp , err := pollUntilRunEnds (context .Background (), client , threadID , runID )
133+ lastResp , err := pollUntilRunEnds (context .TODO (), client , threadID , runID )
134134 if err != nil {
135135 // TODO: Update the following line with your application specific error handling logic
136136 log .Fatalf ("ERROR: %s" , err )
@@ -171,7 +171,7 @@ func Example_assistantsUsingFunctionTool() {
171171 fmt .Fprintf (os .Stderr , "Call our own function to get the weather for %s, in %s\n " , weatherFuncArgs .Location , weatherFuncArgs .Unit )
172172 {
173173 // submit our outputs from evaluating the tool
174- _ , err := client .SubmitToolOutputsToRun (context .Background (), threadID , runID , azopenaiassistants.SubmitToolOutputsToRunBody {
174+ _ , err := client .SubmitToolOutputsToRun (context .TODO (), threadID , runID , azopenaiassistants.SubmitToolOutputsToRunBody {
175175 ToolOutputs : []azopenaiassistants.ToolOutput {
176176 {
177177 Output : to .Ptr ("0C" ),
@@ -189,7 +189,7 @@ func Example_assistantsUsingFunctionTool() {
189189 // the run will restart now, we just need to wait until it finishes
190190 // NOTE: see https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants#example-package-AssistantsConversationLoop
191191 // for the pollUntilRunEnds function.
192- lastResp , err = pollUntilRunEnds (context .Background (), client , threadID , runID )
192+ lastResp , err = pollUntilRunEnds (context .TODO (), client , threadID , runID )
193193
194194 if err != nil || * lastResp .Status != azopenaiassistants .RunStatusCompleted {
195195 // TODO: Update the following line with your application specific error handling logic
@@ -200,7 +200,7 @@ func Example_assistantsUsingFunctionTool() {
200200
201201 // NOTE: see https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants#example-package-AssistantsConversationLoop
202202 // for the getLatestMessages function.
203- latestMessages , err := getLatestMessages (context .Background (), client , threadID , & lastMessageID )
203+ latestMessages , err := getLatestMessages (context .TODO (), client , threadID , & lastMessageID )
204204 if err != nil {
205205 // TODO: Update the following line with your application specific error handling logic
206206 log .Fatalf ("ERROR: %s" , err )
@@ -211,7 +211,7 @@ func Example_assistantsUsingFunctionTool() {
211211 // [ASSISTANT] <id>: Text response: The current weather in Boston, MA, measured in Celsius, is 0°C.
212212 // NOTE: see https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants#example-package-AssistantsConversationLoop
213213 // for the printAssistantMessages function.
214- err = printAssistantMessages (context .Background (), client , latestMessages )
214+ err = printAssistantMessages (context .TODO (), client , latestMessages )
215215
216216 if err != nil {
217217 // TODO: Update the following line with your application specific error handling logic
0 commit comments