mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-11 10:53:42 +08:00
feat: support openai websearch models
This commit is contained in:
@@ -45,7 +45,7 @@ type GeneralOpenAIRequest struct {
|
||||
PresencePenalty *float64 `json:"presence_penalty,omitempty"`
|
||||
ResponseFormat *ResponseFormat `json:"response_format,omitempty"`
|
||||
Seed float64 `json:"seed,omitempty"`
|
||||
ServiceTier *string `json:"service_tier,omitempty"`
|
||||
ServiceTier *string `json:"service_tier,omitempty" binding:"omitempty,oneof=default auto"`
|
||||
Stop any `json:"stop,omitempty"`
|
||||
Stream bool `json:"stream,omitempty"`
|
||||
StreamOptions *StreamOptions `json:"stream_options,omitempty"`
|
||||
@@ -63,10 +63,12 @@ type GeneralOpenAIRequest struct {
|
||||
EncodingFormat string `json:"encoding_format,omitempty"`
|
||||
Dimensions int `json:"dimensions,omitempty"`
|
||||
// https://platform.openai.com/docs/api-reference/images/create
|
||||
Prompt string `json:"prompt,omitempty"`
|
||||
Quality *string `json:"quality,omitempty"`
|
||||
Size string `json:"size,omitempty"`
|
||||
Style *string `json:"style,omitempty"`
|
||||
Prompt string `json:"prompt,omitempty"`
|
||||
Quality *string `json:"quality,omitempty"`
|
||||
Size string `json:"size,omitempty"`
|
||||
Style *string `json:"style,omitempty"`
|
||||
WebSearchOptions *WebSearchOptions `json:"web_search_options,omitempty"`
|
||||
|
||||
// Others
|
||||
Instruction string `json:"instruction,omitempty"`
|
||||
NumCtx int `json:"num_ctx,omitempty"`
|
||||
@@ -81,6 +83,34 @@ type GeneralOpenAIRequest struct {
|
||||
Thinking *Thinking `json:"thinking,omitempty"`
|
||||
}
|
||||
|
||||
// WebSearchOptions is the tool searches the web for relevant results to use in a response.
|
||||
type WebSearchOptions struct {
|
||||
// SearchContextSize is the high level guidance for the amount of context window space to use for the search,
|
||||
// default is "medium".
|
||||
SearchContextSize *string `json:"search_context_size,omitempty" binding:"omitempty,oneof=low medium high"`
|
||||
UserLocation *UserLocation `json:"user_location,omitempty"`
|
||||
}
|
||||
|
||||
// UserLocation is a struct that contains the location of the user.
|
||||
type UserLocation struct {
|
||||
// Approximate is the approximate location parameters for the search.
|
||||
Approximate UserLocationApproximate `json:"approximate" binding:"required"`
|
||||
// Type is the type of location approximation.
|
||||
Type string `json:"type" binding:"required,oneof=approximate"`
|
||||
}
|
||||
|
||||
// UserLocationApproximate is a struct that contains the approximate location of the user.
|
||||
type UserLocationApproximate struct {
|
||||
// City is the city of the user, e.g. San Francisco.
|
||||
City *string `json:"city,omitempty"`
|
||||
// Country is the country of the user, e.g. US.
|
||||
Country *string `json:"country,omitempty"`
|
||||
// Region is the region of the user, e.g. California.
|
||||
Region *string `json:"region,omitempty"`
|
||||
// Timezone is the IANA timezone of the user, e.g. America/Los_Angeles.
|
||||
Timezone *string `json:"timezone,omitempty"`
|
||||
}
|
||||
|
||||
// https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking#implementing-extended-thinking
|
||||
type Thinking struct {
|
||||
Type string `json:"type"`
|
||||
|
||||
Reference in New Issue
Block a user