-
Notifications
You must be signed in to change notification settings - Fork 201
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
Assistants v2 #352
Assistants v2 #352
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, thank you for your contribution. There is also this branch that I've started before 😅
*/ | ||
public data class RequestOptions( | ||
public val headers: Map<String, String> = emptyMap(), | ||
public val urlParameters: Map<String, String> = emptyMap(), | ||
public val timeout: Timeout? = null, | ||
public val betaVersion: Int? = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think It would be better if we update HttpRequestBuilder.requestOptions
instead, but having something like:
internal fun HttpRequestBuilder.requestOptions(requestOptions: RequestOptions? = null) {
if (requestOptions == null) return
requestOptions.headers.forEach { (key, value) ->
if (headers.contains(key)) {
headers.remove(key)
}
headers[key] = value
}
// ...
}
This more future proof, and would overriding any headers later on.
Edit: I've made a PR to fix this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After that, simply removing this betaVersion value and changing Assistants/Threads beta version for HttpRequestBuilder.beta() to 2 works well. Thanks!
openai-core/src/commonMain/kotlin/com.aallam.openai.api/thread/Thread.kt
Outdated
Show resolved
Hide resolved
openai-core/src/commonMain/kotlin/com.aallam.openai.api/assistant/AssistantTool.kt
Outdated
Show resolved
Hide resolved
*/ | ||
@BetaOpenAI | ||
@Serializable(with = AssistantResponseFormat.ResponseFormatSerializer::class) | ||
public data class AssistantResponseFormat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried something here, can't remember if it works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah actually I started from your branch, and this one failed while deserializing. Tried several fixes, but I had to come up with custom serializer/deserializer. Wonder if simpler way is valid.
…feat/assistants-v2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good! thanks a lot!
Thanks for the changes 👍 If you could implement it in a new release 3.7.3 that would be great. |
Describe your change
What problem is this fixing?
any suggestions/fixes are welcomed, thanks.