go-openai icon indicating copy to clipboard operation
go-openai copied to clipboard

Unknown parameter for CreateThreadAndRun method

Open rasmusviben opened this issue 8 months ago • 6 comments

Describe the bug When calling the CreateThreadAndRun method, the response is 400 due to unknown parameter in the ThreadRequest: thread.messages[0].file_ids

To Reproduce Run follow code given assistant is created:

run, err := ss.openAiClient.CreateThreadAndRun(context.Background(), openai.CreateThreadAndRunRequest{
		RunRequest: openai.RunRequest{
			Model:        openai.GPT4o,
			AssistantID:  assistant.ID,
			Instructions: "Very cool instructions - test",
		},
		Thread: openai.ThreadRequest{
			Messages: []openai.ThreadMessage{
				{
					Role:    openai.ThreadMessageRoleUser,
					Content: "Do something nice with the file",
					FileIDs: []string{file.ID},
					Metadata: map[string]interface{}{
						"tools": []openai.AssistantTool{{Type: "file_search"}},
					},
				},
			},
		},
	})

Expected behavior Expected that the request was succesfull and not throwing 400 bad request for that parameter.

Screenshots/Logs

2024/06/19 20:19:55 CreateThreadAndRun error: error, status code: 400, message: Unknown parameter: 'thread.messages[0].file_ids'.

Environment (please complete the following information):

  • go-openai version: [e.g. v1.26.0]
  • Go version: [1.22.3 windows/amd64]
  • OS: Windows

rasmusviben avatar Jun 19 '24 18:06 rasmusviben