Documentation
¶
Index ¶
- type ReplicateChatRequest
- type ReplicateError
- type ReplicateImageRequest
- type ReplicateImageUrl
- type ReplicateMetrics
- type ReplicateProvider
- func (p *ReplicateProvider) CreateChatCompletion(request *types.ChatCompletionRequest) (response *types.ChatCompletionResponse, ...)
- func (p *ReplicateProvider) CreateChatCompletionStream(request *types.ChatCompletionRequest) (requester.StreamReaderInterface[string], *types.OpenAIErrorWithStatusCode)
- func (p *ReplicateProvider) CreateImageGenerations(request *types.ImageRequest) (*types.ImageResponse, *types.OpenAIErrorWithStatusCode)
- func (p *ReplicateProvider) GetFullRequestURL(requestURL string, model string) string
- func (p *ReplicateProvider) GetRequestHeaders() (headers map[string]string)
- type ReplicateProviderFactory
- type ReplicateRequest
- type ReplicateResponse
- type ReplicateStreamHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReplicateChatRequest ¶
type ReplicateChatRequest struct {
TopK float64 `json:"top_k,omitempty"`
TopP *float64 `json:"top_p,omitempty"`
Prompt string `json:"prompt"`
MaxTokens int `json:"max_tokens,omitempty"`
MinTokens int `json:"min_tokens,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
SystemPrompt string `json:"system_prompt,omitempty"`
PresencePenalty *float64 `json:"presence_penalty,omitempty"`
FrequencyPenalty *float64 `json:"frequency_penalty,omitempty"`
}
type ReplicateError ¶
type ReplicateImageRequest ¶
type ReplicateImageRequest struct {
Prompt string `json:"prompt"`
AspectRatio *string `json:"aspect_ratio,omitempty"`
OutputFormat string `json:"output_format,omitempty"`
OutputQuality *int `json:"output_quality,omitempty"`
SafetyTolerance *string `json:"safety_tolerance,omitempty"`
PromptUpsampling *string `json:"prompt_upsampling,omitempty"`
Size string `json:"size,omitempty"`
}
type ReplicateImageUrl ¶
type ReplicateImageUrl struct {
Stream string `json:"stream"`
}
type ReplicateMetrics ¶
type ReplicateProvider ¶
type ReplicateProvider struct {
base.BaseProvider
FetchPredictionUrl string
}
func (*ReplicateProvider) CreateChatCompletion ¶
func (p *ReplicateProvider) CreateChatCompletion(request *types.ChatCompletionRequest) (response *types.ChatCompletionResponse, errWithCode *types.OpenAIErrorWithStatusCode)
func (*ReplicateProvider) CreateChatCompletionStream ¶
func (p *ReplicateProvider) CreateChatCompletionStream(request *types.ChatCompletionRequest) (requester.StreamReaderInterface[string], *types.OpenAIErrorWithStatusCode)
func (*ReplicateProvider) CreateImageGenerations ¶
func (p *ReplicateProvider) CreateImageGenerations(request *types.ImageRequest) (*types.ImageResponse, *types.OpenAIErrorWithStatusCode)
func (*ReplicateProvider) GetFullRequestURL ¶
func (p *ReplicateProvider) GetFullRequestURL(requestURL string, model string) string
获取完整请求 URL
func (*ReplicateProvider) GetRequestHeaders ¶
func (p *ReplicateProvider) GetRequestHeaders() (headers map[string]string)
获取请求头
type ReplicateProviderFactory ¶
type ReplicateProviderFactory struct{}
func (ReplicateProviderFactory) Create ¶
func (f ReplicateProviderFactory) Create(channel *model.Channel) base.ProviderInterface
创建 ReplicateProvider
type ReplicateRequest ¶
type ReplicateResponse ¶
type ReplicateResponse[T any] struct { ID string `json:"id"` Model string `json:"model"` Urls ReplicateImageUrl `json:"urls"` Status string `json:"status"` // starting / succeeded Error string `json:"error,omitempty"` Output T `json:"output,omitempty"` Metrics ReplicateMetrics `json:"metrics,omitempty"` }
type ReplicateStreamHandler ¶
type ReplicateStreamHandler struct {
Usage *types.Usage
ModelName string
ID string
Provider *ReplicateProvider
}
func (*ReplicateStreamHandler) HandlerChatStream ¶
func (h *ReplicateStreamHandler) HandlerChatStream(rawLine *[]byte, dataChan chan string, errChan chan error)
Click to show internal directories.
Click to hide internal directories.