Documentation ¶
Index ¶
- Constants
- func Init(bc base.Component) *component
- type ChatMessage
- type ChatRequest
- type ChatResponse
- type EmbedRequest
- type EmbedResponse
- type FireWorksChoice
- type FireworksChatMessageRole
- type FireworksChatRequestMessage
- type FireworksChatResponseMessage
- type FireworksChatUsage
- type FireworksClient
- type FireworksClientInterface
- type FireworksContentType
- type FireworksEmbedData
- type FireworksEmbedUsage
- type FireworksFinishReason
- type FireworksMultiModalContent
- type FireworksObject
- type FireworksTool
- type FireworksToolCall
- type FireworksToolFunction
- type FireworksToolType
- type FireworksURL
- type MultiModalContent
- type TaskTextEmbeddingsInput
- type TaskTextEmbeddingsOutput
- type TaskTextEmbeddingsUsage
- type TaskTextGenerationChatInput
- type TaskTextGenerationChatOuput
- type TaskTextGenerationChatUsage
- type URL
Constants ¶
View Source
const ( TaskTextGenerationChat = "TASK_TEXT_GENERATION_CHAT" TaskTextEmbeddings = "TASK_TEXT_EMBEDDINGS" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChatMessage ¶
type ChatMessage struct { Role string `json:"role"` Content []MultiModalContent `json:"content"` }
type ChatRequest ¶
type ChatRequest struct { // reference: https://docs.fireworks.ai/api-reference/post-chatcompletions on 2024-07-23 Model string `json:"model"` Messages []FireworksChatRequestMessage `json:"messages"` Tools *[]FireworksTool `json:"tools,omitempty"` MaxTokens int `json:"max_tokens"` PromptTruncateLen int `json:"prompt_truncate_len,omitempty"` Temperature float32 `json:"temperature,omitempty"` TopP float32 `json:"top_p,omitempty"` TopK int `json:"top_k,omitempty"` FrequencyPenalty float32 `json:"frequency_penalty,omitempty"` PresencePenalty float32 `json:"presence_penalty,omitempty"` N int `json:"n,omitempty"` User string `json:"user,omitempty"` }
type ChatResponse ¶
type ChatResponse struct { ID string `json:"id"` Object FireworksObject `json:"object"` Created int64 `json:"created"` Model string `json:"model"` Choices []FireWorksChoice `json:"choices"` Usage FireworksChatUsage `json:"usage"` }
type EmbedRequest ¶
type EmbedRequest struct { // reference: https://docs.fireworks.ai/api-reference/creates-an-embedding-vector-representing-the-input-text on 2024-07-24 Model string `json:"model"` Input string `json:"input"` Dimensions int `json:"dimensions,omitempty"` }
type EmbedResponse ¶
type EmbedResponse struct { Model string `json:"model"` Data []FireworksEmbedData `json:"data"` Usage FireworksEmbedUsage `json:"usage"` Object FireworksObject `json:"object"` }
type FireWorksChoice ¶
type FireWorksChoice struct { Index int `json:"index"` FinishReason FireworksFinishReason `json:"finish_reason"` Message FireworksChatResponseMessage `json:"message"` }
type FireworksChatMessageRole ¶
type FireworksChatMessageRole string
const ( FireworksChatMessageRoleUser FireworksChatMessageRole = "user" FireworksChatMessageRoleSystem FireworksChatMessageRole = "system" FireworksChatMessageRoleAssistant FireworksChatMessageRole = "assistant" )
type FireworksChatRequestMessage ¶
type FireworksChatRequestMessage struct { Role FireworksChatMessageRole `json:"role"` Content []FireworksMultiModalContent `json:"content"` Name string `json:"name,omitempty"` }
type FireworksChatResponseMessage ¶
type FireworksChatResponseMessage struct { Role FireworksChatMessageRole `json:"role"` Content string `json:"content"` ToolCalls []FireworksToolCall `json:"tool_calls"` }
type FireworksChatUsage ¶
type FireworksClient ¶
type FireworksClient struct {
// contains filtered or unexported fields
}
func (FireworksClient) Chat ¶
func (c FireworksClient) Chat(request ChatRequest) (ChatResponse, error)
func (FireworksClient) Embed ¶
func (c FireworksClient) Embed(request EmbedRequest) (EmbedResponse, error)
type FireworksClientInterface ¶
type FireworksClientInterface interface { Chat(ChatRequest) (ChatResponse, error) Embed(EmbedRequest) (EmbedResponse, error) }
type FireworksContentType ¶
type FireworksContentType string
const ( FireworksContentTypeText FireworksContentType = "text" FireworksContentTypeImageURL FireworksContentType = "image_url" )
type FireworksEmbedData ¶
type FireworksEmbedData struct { Index int `json:"index"` Embedding []float32 `json:"embedding"` Object FireworksObject `json:"object"` }
type FireworksEmbedUsage ¶
type FireworksFinishReason ¶
type FireworksFinishReason string
const ( FireworksFinishReasonStop FireworksFinishReason = "stop" FireworksFinishReasonLength FireworksFinishReason = "length" )
type FireworksMultiModalContent ¶
type FireworksMultiModalContent struct { ImageURL FireworksURL `json:"image_url,omitempty"` Text string `json:"text,omitempty"` Type FireworksContentType `json:"type"` }
type FireworksObject ¶
type FireworksObject string
const ( FireworksResponseObjectChatCompletion FireworksObject = "chat.completion" FireworksResponseObjectEmbedding FireworksObject = "embedding" FireworksObjectList FireworksObject = "list" )
type FireworksTool ¶
type FireworksTool struct { Type FireworksToolType `json:"type"` Function FireworksToolFunction `json:"function"` }
type FireworksToolCall ¶
type FireworksToolCall struct { ID string `json:"id"` Type FireworksToolType `json:"type"` Function struct { Name string `json:"name"` Arguments string `json:"arguments"` } `json:"function"` }
type FireworksToolFunction ¶
type FireworksToolType ¶
type FireworksToolType string
const (
FireworksToolTypeFunction FireworksToolType = "function"
)
type FireworksURL ¶
type FireworksURL struct {
URL string `json:"url"`
}
type MultiModalContent ¶
type TaskTextEmbeddingsInput ¶
type TaskTextEmbeddingsOutput ¶
type TaskTextEmbeddingsOutput struct { Embedding []float32 `json:"embedding"` Usage TaskTextEmbeddingsUsage `json:"usage"` }
type TaskTextEmbeddingsUsage ¶
type TaskTextEmbeddingsUsage struct {
Tokens int `json:"tokens"`
}
type TaskTextGenerationChatInput ¶
type TaskTextGenerationChatInput struct { ChatHistory []ChatMessage `json:"chat-history"` MaxNewTokens int `json:"max-new-tokens"` Model string `json:"model"` Prompt string `json:"prompt"` PromptImages []string `json:"prompt-images"` Seed int `json:"seed"` SystemMsg string `json:"system-message"` Temperature float32 `json:"temperature"` TopK int `json:"top-k"` TopP float32 `json:"top-p"` }
type TaskTextGenerationChatOuput ¶
type TaskTextGenerationChatOuput struct { Text string `json:"text"` Usage TaskTextGenerationChatUsage `json:"usage"` }
Click to show internal directories.
Click to hide internal directories.