Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatRequest ¶
type ChatRequest struct {
Model string `json:"model"`
Prompt string `json:"prompt"`
Stream bool `json:"stream"`
}
ChatRequest is the payload sent to Ollama.
type ChatResponse ¶
ChatResponse represents one chunk of streamed output.
type NIMChatMessage ¶
type NIMChatRequest ¶
type NIMChatRequest struct {
Model string `json:"model"`
Messages []NIMChatMessage `json:"messages"`
Stream bool `json:"stream"`
MaxTokens int `json:"max_tokens,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
}
type NIMChatResponse ¶
type NIMChatResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created int64 `json:"created"`
Model string `json:"model"`
Choices []struct {
Index int `json:"index"`
Message NIMChatMessage `json:"message"`
FinishReason string `json:"finish_reason"`
} `json:"choices"`
Error *struct {
Message string `json:"message"`
Type string `json:"type"`
Param string `json:"param,omitempty"`
Code string `json:"code,omitempty"`
} `json:"error,omitempty"`
}
type NIMProvider ¶
type NIMProvider struct {
// contains filtered or unexported fields
}
NIMProvider handles LLM interactions with NVIDIA NIM API.
func NewNIMProvider ¶
func NewNIMProvider(baseURL, apiKey string) (*NIMProvider, error)
NewNIMProvider creates a new NVIDIA NIM provider. The baseURL should be the API endpoint (e.g., "https://api.nvidia.com/v1") The apiKey is the NVIDIA API key. If empty, it reads from NVIDIA_API_KEY env var. Returns an error if the API key is missing.
func (*NIMProvider) Generate ¶
func (p *NIMProvider) Generate(ctx context.Context, prompt, model string) error
Generate streams response from the NIM API.
func (*NIMProvider) GenerateSync ¶
GenerateSync returns the full response as a string (non-streaming).
type NIMStreamChunk ¶
Click to show internal directories.
Click to hide internal directories.