Skip to content

Commit

Permalink
feat(api): add gpt-4o-audio-preview model for chat completions (#88)
Browse files Browse the repository at this point in the history
This enables audio inputs and outputs. https://platform.openai.com/docs/guides/audio
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Oct 17, 2024
1 parent 6dad9b2 commit 03da9c9
Show file tree
Hide file tree
Showing 6 changed files with 254 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 68
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-52b934aee6468039ec7f4ce046a282b5fbce114afc708e70f17121df654f71da.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-8729aaa35436531ab453224af10e67f89677db8f350f0346bb3537489edea649.yml
4 changes: 4 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ Params Types:
Params Types:

- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionAssistantMessageParam">ChatCompletionAssistantMessageParam</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionAudioParam">ChatCompletionAudioParam</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionContentPartUnionParam">ChatCompletionContentPartUnionParam</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionContentPartImageParam">ChatCompletionContentPartImageParam</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionContentPartInputAudioParam">ChatCompletionContentPartInputAudioParam</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionContentPartRefusalParam">ChatCompletionContentPartRefusalParam</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionContentPartTextParam">ChatCompletionContentPartTextParam</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionFunctionCallOptionParam">ChatCompletionFunctionCallOptionParam</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionFunctionMessageParam">ChatCompletionFunctionMessageParam</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionMessageParamUnion">ChatCompletionMessageParamUnion</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionMessageToolCallParam">ChatCompletionMessageToolCallParam</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionModality">ChatCompletionModality</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionNamedToolChoiceParam">ChatCompletionNamedToolChoiceParam</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionStreamOptionsParam">ChatCompletionStreamOptionsParam</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionSystemMessageParam">ChatCompletionSystemMessageParam</a>
Expand All @@ -54,6 +57,7 @@ Params Types:
Response Types:

- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletion">ChatCompletion</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionAudio">ChatCompletionAudio</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionChunk">ChatCompletionChunk</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionMessage">ChatCompletionMessage</a>
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#ChatCompletionMessageToolCall">ChatCompletionMessageToolCall</a>
Expand Down
10 changes: 8 additions & 2 deletions betaassistant.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,9 @@ func (r AssistantDeletedObject) IsKnown() bool {
// [Assistants API quickstart](https://platform.openai.com/docs/assistants/overview)
// to learn how to integrate the Assistants API with streaming.
type AssistantStreamEvent struct {
Event AssistantStreamEventEvent `json:"event,required"`
// Whether to enable input audio transcription.
Enabled bool `json:"enabled"`
Event AssistantStreamEventEvent `json:"event,required"`
// This field can have the runtime type of [Thread], [Run], [RunStep],
// [RunStepDeltaEvent], [Message], [MessageDeltaEvent], [shared.ErrorObject].
Data interface{} `json:"data"`
Expand All @@ -346,6 +348,7 @@ type AssistantStreamEvent struct {
// assistantStreamEventJSON contains the JSON metadata for the struct
// [AssistantStreamEvent]
type assistantStreamEventJSON struct {
Enabled apijson.Field
Event apijson.Field
Data apijson.Field
raw string
Expand Down Expand Up @@ -577,14 +580,17 @@ type AssistantStreamEventThreadCreated struct {
// [messages](https://platform.openai.com/docs/api-reference/messages).
Data Thread `json:"data,required"`
Event AssistantStreamEventThreadCreatedEvent `json:"event,required"`
JSON assistantStreamEventThreadCreatedJSON `json:"-"`
// Whether to enable input audio transcription.
Enabled bool `json:"enabled"`
JSON assistantStreamEventThreadCreatedJSON `json:"-"`
}

// assistantStreamEventThreadCreatedJSON contains the JSON metadata for the struct
// [AssistantStreamEventThreadCreated]
type assistantStreamEventThreadCreatedJSON struct {
Data apijson.Field
Event apijson.Field
Enabled apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down
3 changes: 3 additions & 0 deletions chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ const (
ChatModelGPT4o ChatModel = "gpt-4o"
ChatModelGPT4o2024_08_06 ChatModel = "gpt-4o-2024-08-06"
ChatModelGPT4o2024_05_13 ChatModel = "gpt-4o-2024-05-13"
ChatModelGPT4oRealtimePreview ChatModel = "gpt-4o-realtime-preview"
ChatModelGPT4oRealtimePreview2024_10_01 ChatModel = "gpt-4o-realtime-preview-2024-10-01"
ChatModelGPT4oAudioPreview ChatModel = "gpt-4o-audio-preview"
ChatModelGPT4oAudioPreview2024_10_01 ChatModel = "gpt-4o-audio-preview-2024-10-01"
ChatModelChatgpt4oLatest ChatModel = "chatgpt-4o-latest"
ChatModelGPT4oMini ChatModel = "gpt-4o-mini"
ChatModelGPT4oMini2024_07_18 ChatModel = "gpt-4o-mini-2024-07-18"
Expand Down
Loading

0 comments on commit 03da9c9

Please sign in to comment.