Documentation
¶
Index ¶
- Variables
- func MakeEmbModelURI(catalogID string, model embeddingsModel) string
- func MakeModelURI(catalogID string, model yandexGPTModel) string
- type DetailsResponse
- type EmbeddingResponse
- type FunctionCall
- type MetadataResponse
- type OperationResponse
- type Response
- type StatusResponse
- type ToolCallList
- type YandexCompletionResponse
- type YandexFunctionResult
- type YandexGPTAlternative
- type YandexGPTClient
- func (c *YandexGPTClient) GetCompletion(ctx context.Context, request YandexGPTRequest) (response YandexGPTResponse, err error)
- func (c *YandexGPTClient) GetEmbedding(ctx context.Context, request YandexGPTEmbeddingsRequest) (response EmbeddingResponse, err error)
- func (c *YandexGPTClient) GetIAMToken(ctx context.Context) error
- func (c *YandexGPTClient) GetOperationStatus(ctx context.Context, operationID string) (response OperationResponse, err error)
- func (c *YandexGPTClient) RunCompletionAsync(ctx context.Context, request YandexGPTRequest) (response YandexCompletionResponse, err error)
- type YandexGPTClientConfig
- func NewYandexGPTClientConfig() *YandexGPTClientConfig
- func NewYandexGPTClientConfigWithAPIKey(apiKey string) *YandexGPTClientConfig
- func NewYandexGPTClientConfigWithIAMToken(iamToken string) *YandexGPTClientConfig
- func NewYandexGPTClientConfigWithOAuthToken(oauthToken string) *YandexGPTClientConfig
- type YandexGPTCompletionOptions
- type YandexGPTEmbeddingsRequest
- type YandexGPTError
- type YandexGPTMessage
- type YandexGPTRequest
- type YandexGPTResponse
- type YandexGPTResponseBad
- type YandexGPTResult
- type YandexGPTUsage
- type YandexIAMRequest
- type YandexIAMResponse
- type YandexResponse
- type YandexToolResultList
Constants ¶
This section is empty.
Variables ¶
var ( TextSearchDoc = embeddingsModel{/* contains filtered or unexported fields */} TextSearchQuery = embeddingsModel{/* contains filtered or unexported fields */} )
var ( // Yandex GPT Pro 3rd generation YandexGPTModel = yandexGPTModel{/* contains filtered or unexported fields */} // Yandex GPT Lite 3rd generation YandexGPTModelLite = yandexGPTModel{/* contains filtered or unexported fields */} // Yandex GPT Pro 4th generation YandexGPT4Model = yandexGPTModel{/* contains filtered or unexported fields */} // Yandex GPT Lite 4th generation YandexGPT4ModelLite = yandexGPTModel{/* contains filtered or unexported fields */} // Yandex GPT Pro 32k 4th generation YandexGPT4Model32k = yandexGPTModel{/* contains filtered or unexported fields */} // Llama Lite 3rd generation LLAMA3Lite = yandexGPTModel{/* contains filtered or unexported fields */} // Llama 3rd generation LLAMA3 = yandexGPTModel{/* contains filtered or unexported fields */} )
var ( YandexGPTMessageRoleSystem = yandexGPTRole{Role: "system"} YandexGPTMessageRoleUser = yandexGPTRole{Role: "user"} YandexGPTMessageRoleAssistant = yandexGPTRole{Role: "assistant"} )
Functions ¶
func MakeEmbModelURI ¶ added in v1.6.0
Use this for creating model uri for embeddings.
func MakeModelURI ¶
Use this for creating model uri.
Types ¶
type DetailsResponse ¶ added in v1.5.0
type EmbeddingResponse ¶ added in v1.6.0
type FunctionCall ¶ added in v1.5.0
type MetadataResponse ¶ added in v1.5.0
type OperationResponse ¶ added in v1.5.0
type OperationResponse struct { ID string `json:"id"` Description string `json:"description"` CreatedAt string `json:"createdAt"` CreatedBy string `json:"createdBy"` ModifiedAt string `json:"modifiedAt"` Done bool `json:"done"` Metadata *MetadataResponse `json:"metadata"` Error *StatusResponse `json:"error"` Response *YandexResponse `json:"response"` // contains filtered or unexported fields }
type StatusResponse ¶ added in v1.5.0
type StatusResponse struct { Code int `json:"code"` Message string `json:"message"` Details DetailsResponse `json:"details"` }
type ToolCallList ¶ added in v1.5.0
type ToolCallList struct {
ToolCalls []FunctionCall `json:"toolCalls"`
}
type YandexCompletionResponse ¶ added in v1.5.0
type YandexCompletionResponse struct { ID string `json:"id"` Description string `json:"description"` CreatedAt string `json:"createdAt"` ModifiedAt string `json:"modifiedAt"` Done bool `json:"done"` Metadata *MetadataResponse `json:"metadata"` Error *StatusResponse `json:"error"` Response string `json:"response"` // contains filtered or unexported fields }
type YandexFunctionResult ¶ added in v1.5.0
type YandexGPTAlternative ¶
type YandexGPTAlternative struct { Message YandexGPTMessage `json:"message"` ToolResultList YandexToolResultList `json:"toolResultList"` Status string `json:"status"` }
type YandexGPTClient ¶
type YandexGPTClient struct {
// contains filtered or unexported fields
}
YandexGPT Client
func NewYandexGPTClientWithAPIKey ¶
func NewYandexGPTClientWithAPIKey( apiKey string, ) *YandexGPTClient
Creates new YandexGPT Client.
You will need to specify your own API key.
func NewYandexGPTClientWithIAMToken ¶
func NewYandexGPTClientWithIAMToken( iamToken string, ) *YandexGPTClient
Creates new YandexGPT Client.
If you're using this option, keep in mind that you will need to generate IAM token yourself.
func NewYandexGPTClientWithOAuthToken ¶ added in v1.5.0
func NewYandexGPTClientWithOAuthToken( oauthToken string, ) *YandexGPTClient
Creates new YandexGPT Client.
You will need to specify your own OAuth key.
func (*YandexGPTClient) GetCompletion ¶ added in v1.5.0
func (c *YandexGPTClient) GetCompletion( ctx context.Context, request YandexGPTRequest, ) (response YandexGPTResponse, err error)
Get completion from YandexGPT.
If you're using IAM token, make sure to update client's IAM token by calling GetIAMToken(iamToken string) method first.
Keep in mind that if for some strange reason you provided API key and IAM token to the client, this method will use API key.
func (*YandexGPTClient) GetEmbedding ¶ added in v1.6.0
func (c *YandexGPTClient) GetEmbedding( ctx context.Context, request YandexGPTEmbeddingsRequest, ) (response EmbeddingResponse, err error)
Get embeddings from Yandex foundation models.
If you're using IAM token, make sure to update client's IAM token by calling GetIAMToken(iamToken string) method first.
Keep in mind that if for some strange reason you provided API key and IAM token to the client, this method will use API key.
func (*YandexGPTClient) GetIAMToken ¶ added in v1.5.0
func (c *YandexGPTClient) GetIAMToken(ctx context.Context) error
Updates IAM token.
Always call it before creating a request.
If you will use it when API key is specified, method GetCompletion(...) will always use API key.
func (*YandexGPTClient) GetOperationStatus ¶ added in v1.5.0
func (c *YandexGPTClient) GetOperationStatus( ctx context.Context, operationID string, ) (response OperationResponse, err error)
Get operation status from yandex cloud. Use it if you are working with yandex api via async methods.
If you're using IAM token, make sure to update client's IAM token by calling GetIAMToken(iamToken string) method first.
Keep in mind that if for some strange reason you provided API key and IAM token to the client, this method will use API key.
func (*YandexGPTClient) RunCompletionAsync ¶ added in v1.5.0
func (c *YandexGPTClient) RunCompletionAsync( ctx context.Context, request YandexGPTRequest, ) (response YandexCompletionResponse, err error)
Get completion from YandexGPT with async method.
If you're using IAM token, make sure to update client's IAM token by calling GetIAMToken(iamToken string) method first.
Keep in mind that if for some strange reason you provided API key and IAM token to the client, this method will use API key.
type YandexGPTClientConfig ¶
type YandexGPTClientConfig struct { OAuthToken string ApiKey string IAMToken string HTTPClient *http.Client }
func NewYandexGPTClientConfig ¶
func NewYandexGPTClientConfig() *YandexGPTClientConfig
func NewYandexGPTClientConfigWithAPIKey ¶
func NewYandexGPTClientConfigWithAPIKey( apiKey string, ) *YandexGPTClientConfig
func NewYandexGPTClientConfigWithIAMToken ¶
func NewYandexGPTClientConfigWithIAMToken( iamToken string, ) *YandexGPTClientConfig
func NewYandexGPTClientConfigWithOAuthToken ¶ added in v1.5.0
func NewYandexGPTClientConfigWithOAuthToken( oauthToken string, ) *YandexGPTClientConfig
func (*YandexGPTClientConfig) SetIAMToken ¶ added in v1.5.0
func (c *YandexGPTClientConfig) SetIAMToken(iamToken string)
Setter for IAM token in config.
Use it for manually updating token in config.
type YandexGPTEmbeddingsRequest ¶ added in v1.6.0
type YandexGPTError ¶
type YandexGPTError struct { HTTPCode int `json:"httpCode"` Message string `json:"message"` HTTPStatus string `json:"httpStatus"` Details DetailsResponse `json:"error.details"` }
type YandexGPTMessage ¶
type YandexGPTMessage struct { Role yandexGPTRole `json:"role"` Text string `json:"text"` ToolCallList *ToolCallList `json:"toolCallList"` }
type YandexGPTRequest ¶
type YandexGPTRequest struct { ModelURI string `json:"modelUri"` CompletionOptions YandexGPTCompletionOptions `json:"completionOptions"` Messages []YandexGPTMessage `json:"messages"` }
type YandexGPTResponse ¶
type YandexGPTResponse struct { Result YandexGPTResult `json:"result"` // contains filtered or unexported fields }
type YandexGPTResponseBad ¶
type YandexGPTResponseBad struct {
Error YandexGPTError `json:"error"`
}
type YandexGPTResult ¶
type YandexGPTResult struct { Alternatives []YandexGPTAlternative `json:"alternatives"` Usage YandexGPTUsage `json:"usage"` ModelVersion string `json:"modelVersion"` }
type YandexGPTUsage ¶
type YandexIAMRequest ¶ added in v1.5.0
type YandexIAMRequest struct {
OAuthToken string `json:"yandexPassportOauthToken"`
}
type YandexIAMResponse ¶ added in v1.5.0
type YandexResponse ¶ added in v1.5.0
type YandexResponse struct { Type string `json:"@type"` Alternatives []YandexGPTAlternative `json:"alternatives"` }
type YandexToolResultList ¶ added in v1.5.0
type YandexToolResultList struct {
ToolResults []YandexFunctionResult `json:"toolResults"`
}