Documentation
¶
Index ¶
- func DeviceLogin(ctx context.Context, clientID string) (string, error)
- type CompletionRequest
- type CompletionResponse
- type CompletionResponseChoice
- type ContentFilterResults
- type Copilot
- type Doer
- type EmbeddingRequest
- type EmbeddingResponse
- type Message
- type Option
- func WithBaseURL(baseURL string) Option
- func WithClientVersion(version string) Option
- func WithCompletionModel(model string) Option
- func WithCopilotIntegrationID(copilotintegrationID string) Option
- func WithEmbeddingModel(model string) Option
- func WithGithubOAuthToken(githubOAuthToken string) Option
- func WithHTTPCopilot(httpclient Doer) Option
- func WithOpenAIIntent(openaiIntent string) Option
- func WithOpenAIOrganization(openaiOrganization string) Option
- func WithTemperature(temperature float64) Option
- func WithUserAgent(userAgent string) Option
- type ResponseMessage
- type StreamedChatResponsePayload
- type Token
- type UserData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CompletionRequest ¶
type CompletionRequest struct { Model string `json:"model"` Messages []Message `json:"messages"` Temperature float64 `json:"temperature"` N int `json:"n,omitempty"` TopP float64 `json:"top_p,omitempty"` Stream bool `json:"stream"` // StreamingFunc is a function to be called for each chunk of a streaming response. // Return an error to stop streaming early. StreamingFunc func(ctx context.Context, chunk []byte) error `json:"-"` }
CompletionRequest is a request to complete a completion.
type CompletionResponse ¶
type CompletionResponse struct { Choices []CompletionResponseChoice `json:"choices,omitempty"` Created float64 `json:"created,omitempty"` ID string `json:"id,omitempty"` Model string `json:"model,omitempty"` PromptFilterResults []struct { ContentFilterResults struct { Hate struct { Filtered bool `json:"filtered,omitempty"` Severity string `json:"severity,omitempty"` } `json:"hate,omitempty"` SelfHarm struct { Filtered bool `json:"filtered,omitempty"` Severity string `json:"severity,omitempty"` } `json:"self_harm,omitempty"` Sexual struct { Filtered bool `json:"filtered,omitempty"` Severity string `json:"severity,omitempty"` } `json:"sexual,omitempty"` Violence struct { Filtered bool `json:"filtered,omitempty"` Severity string `json:"severity,omitempty"` } `json:"violence,omitempty"` } `json:"content_filter_results,omitempty"` PromptIndex float64 `json:"prompt_index,omitempty"` } `json:"prompt_filter_results,omitempty"` Usage struct { CompletionTokens float64 `json:"completion_tokens,omitempty"` PromptTokens float64 `json:"prompt_tokens,omitempty"` TotalTokens float64 `json:"total_tokens,omitempty"` } `json:"usage,omitempty"` }
type CompletionResponseChoice ¶
type CompletionResponseChoice struct { ContentFilterResults ContentFilterResults `json:"content_filter_results,omitempty"` FinishReason string `json:"finish_reason,omitempty"` Index float64 `json:"index,omitempty"` Message ResponseMessage `json:"message,omitempty"` }
type ContentFilterResults ¶
type ContentFilterResults struct { Error struct { Code string `json:"code,omitempty"` Message string `json:"message,omitempty"` } `json:"error,omitempty"` Hate struct { Filtered bool `json:"filtered,omitempty"` Severity string `json:"severity,omitempty"` } `json:"hate,omitempty"` SelfHarm struct { Filtered bool `json:"filtered,omitempty"` Severity string `json:"severity,omitempty"` } `json:"self_harm,omitempty"` Sexual struct { Filtered bool `json:"filtered,omitempty"` Severity string `json:"severity,omitempty"` } `json:"sexual,omitempty"` Violence struct { Filtered bool `json:"filtered,omitempty"` Severity string `json:"severity,omitempty"` } `json:"violence,omitempty"` }
type Copilot ¶
type Copilot struct {
// contains filtered or unexported fields
}
func NewCopilot ¶
func (*Copilot) CreateCompletion ¶
func (c *Copilot) CreateCompletion(ctx context.Context, payload *CompletionRequest) (*CompletionResponse, error)
func (*Copilot) CreateEmbedding ¶
func (c *Copilot) CreateEmbedding(ctx context.Context, payload *EmbeddingRequest) (*EmbeddingResponse, error)
type EmbeddingRequest ¶
type EmbeddingResponse ¶
type Option ¶
type Option func(*Copilot)
Option is an option for the Lingyi client.
func WithBaseURL ¶
func WithClientVersion ¶
func WithCompletionModel ¶
func WithEmbeddingModel ¶
func WithGithubOAuthToken ¶
func WithHTTPCopilot ¶
func WithOpenAIIntent ¶
func WithOpenAIOrganization ¶
func WithTemperature ¶
func WithUserAgent ¶
type ResponseMessage ¶
type StreamedChatResponsePayload ¶
type StreamedChatResponsePayload struct { Choices []struct { ContentFilterOffsets struct { CheckOffset float64 `json:"check_offset,omitempty"` EndOffset float64 `json:"end_offset,omitempty"` StartOffset float64 `json:"start_offset,omitempty"` } `json:"content_filter_offsets,omitempty"` ContentFilterResults ContentFilterResults `json:"content_filter_results,omitempty"` Delta ResponseMessage `json:"delta,omitempty"` Index float64 `json:"index,omitempty"` FinishReason string `json:"finish_reason,omitempty"` } `json:"choices,omitempty"` Created float64 `json:"created,omitempty"` ID string `json:"id,omitempty"` Error error `json:"-"` }
StreamedChatResponsePayload is a chunk from the stream.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.