Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown parameter for CreateThreadAndRun method #773

Open
rasmusviben opened this issue Jun 19, 2024 · 6 comments · May be fixed by #821
Open

Unknown parameter for CreateThreadAndRun method #773

rasmusviben opened this issue Jun 19, 2024 · 6 comments · May be fixed by #821
Labels
bug Something isn't working

Comments

@rasmusviben
Copy link

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 rasmusviben added the bug Something isn't working label Jun 19, 2024
@tforbus
Copy link

tforbus commented Jun 19, 2024

I think this PR is aiming to fix this issue.

@rasmusviben i'm seeing issues where the run states are never making it out of queued. Wondering if you'd seen this (maybe prior to v1.26.0)

@rasmusviben
Copy link
Author

I think this PR is aiming to fix this issue.

@rasmusviben i'm seeing issues where the run states are never making it out of queued. Wondering if you'd seen this (maybe prior to v1.26.0)

Alright - do you know the ETA for getting that PR into a new release? :)

I tried downgrading to 1.24 and 1.25, but then new exception is thrown:

Invalid type for 'thread.messages[0].metadata.tools': expected a string, but got an array instead.

@Marreck
Copy link

Marreck commented Jul 2, 2024

Having the same issue. Downgrading to 1.24 worked for me though.

@ecoralic
Copy link
Contributor

I assume that a problem here is outdated ThreadMessage struct. Even the mentioned PR above does not solve ThreadMessage struct, at least based on current OpenAI docs, where it states that ThreadMessage should have fields: Role, Content, Attachments and Metadata. Attachments is a list of files attached to the message, and the tools they should be added to.

@adamdecaf
Copy link

Need help getting a PR across the line? I'm seeing this error as well.

adamdecaf added a commit to adamdecaf/go-openai that referenced this issue Aug 8, 2024
FileIDs on ThreadMessage isn't supported anymore, but Content can be
an array.

Fixes: sashabaranov#773
adamdecaf added a commit to adamdecaf/go-openai that referenced this issue Aug 8, 2024
FileIDs on ThreadMessage isn't supported anymore, but Content can be
an array.

Fixes: sashabaranov#773
@adamdecaf
Copy link

#764 doesn't seem to fix the OP's issue (or mine) so I opened a PR which works, but has a breaking change. Do we have a policy for handling breaking changes better?

adamdecaf added a commit to adamdecaf/go-openai that referenced this issue Aug 26, 2024
FileIDs on ThreadMessage isn't supported anymore, but Content can be
an array.

Fixes: sashabaranov#773
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants