Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatRequest ¶
type ChatRequest struct {
Messages []Message `json:"messages"`
Model string `json:"model"`
TopP float64 `json:"top_p"`
MaxTokens int `json:"max_tokens"`
Stop []string `json:"stop,omitempty"`
Seed int `json:"seed"`
Stream bool `json:"stream"`
Format struct {
Type Format `json:"type"`
} `json:"response_format"`
}
ChatRequest is a request to the chat endpoint.
type ChatResponse ¶
type ChatResponse struct {
Id string `json:"id"`
Object string `json:"object"`
Created int `json:"created"`
Model string `json:"model"`
Choices []struct {
Index int `json:"index"`
Message struct {
Role string `json:"role"`
Content string `json:"content"`
} `json:"message"`
Logprobs interface{} `json:"logprobs"`
FinishReason string `json:"finish_reason"`
} `json:"choices"`
Usage struct {
PromptTokens int `json:"prompt_tokens"`
PromptTime float64 `json:"prompt_time"`
CompletionTokens int `json:"completion_tokens"`
CompletionTime float64 `json:"completion_time"`
ToTalTokens int `json:"to tal_tokens"`
TotalTime float64 `json:"total_time"`
} `json:"usage"`
SystemFingerprint string `json:"system_fingerprint"`
XGroq struct {
Id string `json:"id"`
} `json:"x_groq"`
}
ChatResponse is a response from the chat endpoint.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Groq api client.
func (*Client) Chat ¶
func (c *Client) Chat(ctx context.Context, req ChatRequest) (*ChatResponse, error)
Chat sends a request to the chat endpoint of the Groq API.
type GroqOpts ¶
type GroqOpts func(*Client)
GroqOpts is a function that sets options for a Groq client.
func WithClient ¶
WithClient sets the client for the Groq client.
type ModelResponse ¶
type ModelResponse struct {
Object string `json:"object"`
Data []struct {
ID string `json:"id"`
Object string `json:"object"`
Created int `json:"created"`
OwnedBy string `json:"owned_by"`
Active bool `json:"active"`
ContextWindow int `json:"context_window,omitempty"`
PublicApps any `json:"public_apps"`
ContextWindow0 int `json:"context_ window,omitempty"`
} `json:"data"`
}
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
terminal-chat
module
|
|
|
extensions
|
|
|
toolhouse
module
|
|
|
scripts
|
|
|
models
module
|
Click to show internal directories.
Click to hide internal directories.