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

Support Thread and Message for Assistant v2 #735

Open
ZhihanWei opened this issue May 6, 2024 · 1 comment
Open

Support Thread and Message for Assistant v2 #735

ZhihanWei opened this issue May 6, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@ZhihanWei
Copy link

ZhihanWei commented May 6, 2024

Is your feature request related to a problem? Please describe.
OpenAI has released their new version of assistant(v2) and the old version of assistant(v1) will be deprecated by the end of 2024. There are some incompatibilities between the two version in terms of API request body.
For example, MessageRequest in v1

type MessageRequest struct {
	Role     string         `json:"role"`
	Content  string         `json:"content"`
	FileIds  []string       `json:"file_ids,omitempty"` //nolint:revive // backwards-compatibility
	Metadata map[string]any `json:"metadata,omitempty"`
}

MessageRequest in v2, which introduced attachments

type MessageRequest struct {
	Role        string         `json:"role"`
	Content     string         `json:"content"`
	Attachments []Attachment   `json:"attachments,omitempty"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

We let the user configure the assistant version in the client configuration but the new assistant version will cause trouble at runtime when making calls to Thread and Message.

Describe the solution you'd like
Support both assistant v1 and v2.

Additional context
There are different implementations I can think of that could make the enhancement, but most likely the compatibility will be checked at runtime. Would be good to see an implementation to support both assistant versions and check errors at compile time while maintaining the configured assistantVersion.

@ZhihanWei ZhihanWei added the enhancement New feature or request label May 6, 2024
@Trojan295
Copy link

There are more changes, because the Content can be now a string, but also an array of objects. https://platform.openai.com/docs/api-reference/messages/createMessage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants