Documentation
¶
Index ¶
- func ExampleNewAiGenerator()
- type AiAttachment
- type AiGenerator
- type AiGeneratorService
- func (s *AiGeneratorService) CreateAgent(agent *models.AiAgentModel) error
- func (s *AiGeneratorService) CreateHistory(history *models.AiAgentHistory) error
- func (s *AiGeneratorService) DeleteAgent(id string) error
- func (s *AiGeneratorService) DeleteHistory(id string) error
- func (s *AiGeneratorService) GetAgent(id string) (*models.AiAgentModel, error)
- func (s *AiGeneratorService) GetAgents(request *http.Request) (paginate.Page, error)
- func (s *AiGeneratorService) GetGeneratorFromID(id string) (AiGenerator, error)
- func (s *AiGeneratorService) GetHistories(id, companyID *string, sessionCode *string, isModel *bool, limit *int) ([]models.AiAgentHistory, error)
- func (s *AiGeneratorService) SetConfig(config GeneratorConfig)
- func (s *AiGeneratorService) SetFactory(factory GeneratorFactory)
- func (s *AiGeneratorService) UpdateAgent(agent *models.AiAgentModel) error
- func (s *AiGeneratorService) UpdateHistory(history *models.AiAgentHistory) error
- type AiMessage
- type ContentConfig
- type DeepSeekService
- func (g *DeepSeekService) Generate(prompt string, attachment *AiAttachment, histories []AiMessage) (*AiMessage, error)
- func (g *DeepSeekService) SetApiKey(apiKey string)
- func (g *DeepSeekService) SetContentConfig(config *ContentConfig)
- func (g *DeepSeekService) SetHost(host string)
- func (g *DeepSeekService) SetModel(model string)
- func (g *DeepSeekService) SetSystemInstruction(instruction string)
- type GeminiV2SService
- func (g *GeminiV2SService) Generate(prompt string, attachment *AiAttachment, histories []AiMessage) (*AiMessage, error)
- func (g *GeminiV2SService) SetApiKey(apiKey string)
- func (g *GeminiV2SService) SetContentConfig(config *ContentConfig)
- func (g *GeminiV2SService) SetHost(host string)
- func (g *GeminiV2SService) SetModel(model string)
- func (g *GeminiV2SService) SetSystemInstruction(instruction string)
- type GeneratorConfig
- type GeneratorFactory
- type Message
- type OllamaService
- func (g *OllamaService) Generate(prompt string, attachment *AiAttachment, histories []AiMessage) (*AiMessage, error)
- func (g *OllamaService) SetApiKey(apiKey string)
- func (g *OllamaService) SetContentConfig(config *ContentConfig)
- func (g *OllamaService) SetHost(host string)
- func (g *OllamaService) SetModel(model string)
- func (g *OllamaService) SetSteam(stream bool)
- func (g *OllamaService) SetSystemInstruction(instruction string)
- type OpenAiService
- func (g *OpenAiService) Generate(prompt string, attachment *AiAttachment, histories []AiMessage) (*AiMessage, error)
- func (g *OpenAiService) SetApiKey(apiKey string)
- func (g *OpenAiService) SetContentConfig(config *ContentConfig)
- func (g *OpenAiService) SetHost(host string)
- func (g *OpenAiService) SetModel(model string)
- func (g *OpenAiService) SetSystemInstruction(instruction string)
- type OtherService
- func (g *OtherService) Generate(prompt string, attachment *AiAttachment, histories []AiMessage) (*AiMessage, error)
- func (g *OtherService) SetApiKey(apiKey string)
- func (g *OtherService) SetContentConfig(config *ContentConfig)
- func (g *OtherService) SetHost(host string)
- func (g *OtherService) SetModel(model string)
- func (g *OtherService) SetSystemInstruction(instruction string)
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExampleNewAiGenerator ¶
func ExampleNewAiGenerator()
Types ¶
type AiAttachment ¶
type AiGenerator ¶
type AiGenerator interface { Generate(prompt string, attachment *AiAttachment, histories []AiMessage) (*AiMessage, error) SetApiKey(apiKey string) SetSystemInstruction(instruction string) SetModel(model string) SetContentConfig(config *ContentConfig) SetHost(host string) }
func NewAiGenerator ¶
func NewAiGenerator(factory GeneratorFactory, config GeneratorConfig) (AiGenerator, error)
type AiGeneratorService ¶ added in v1.0.61
type AiGeneratorService struct {
// contains filtered or unexported fields
}
func NewAiGeneratorService ¶ added in v1.0.61
func (*AiGeneratorService) CreateAgent ¶ added in v1.0.61
func (s *AiGeneratorService) CreateAgent(agent *models.AiAgentModel) error
func (*AiGeneratorService) CreateHistory ¶ added in v1.0.61
func (s *AiGeneratorService) CreateHistory(history *models.AiAgentHistory) error
func (*AiGeneratorService) DeleteAgent ¶ added in v1.0.61
func (s *AiGeneratorService) DeleteAgent(id string) error
func (*AiGeneratorService) DeleteHistory ¶ added in v1.0.61
func (s *AiGeneratorService) DeleteHistory(id string) error
func (*AiGeneratorService) GetAgent ¶ added in v1.0.61
func (s *AiGeneratorService) GetAgent(id string) (*models.AiAgentModel, error)
func (*AiGeneratorService) GetGeneratorFromID ¶ added in v1.0.61
func (s *AiGeneratorService) GetGeneratorFromID(id string) (AiGenerator, error)
func (*AiGeneratorService) GetHistories ¶ added in v1.0.61
func (s *AiGeneratorService) GetHistories(id, companyID *string, sessionCode *string, isModel *bool, limit *int) ([]models.AiAgentHistory, error)
func (*AiGeneratorService) SetConfig ¶ added in v1.0.61
func (s *AiGeneratorService) SetConfig(config GeneratorConfig)
func (*AiGeneratorService) SetFactory ¶ added in v1.0.61
func (s *AiGeneratorService) SetFactory(factory GeneratorFactory)
func (*AiGeneratorService) UpdateAgent ¶ added in v1.0.61
func (s *AiGeneratorService) UpdateAgent(agent *models.AiAgentModel) error
func (*AiGeneratorService) UpdateHistory ¶ added in v1.0.63
func (s *AiGeneratorService) UpdateHistory(history *models.AiAgentHistory) error
type AiMessage ¶
type AiMessage struct { Role string // Contoh: "user", "model", "system" Content string Attachment *AiAttachment }
type ContentConfig ¶
type ContentConfig struct { Temperature *float32 `json:"temperature,omitempty"` TopP *float32 `json:"topP,omitempty"` TopK *float32 `json:"topK,omitempty"` CandidateCount int32 `json:"candidateCount,omitempty"` MaxOutputTokens int32 `json:"maxOutputTokens,omitempty"` StopSequences []string `json:"stopSequences,omitempty"` ResponseLogprobs bool `json:"responseLogprobs,omitempty"` Logprobs *int32 `json:"logprobs,omitempty"` PresencePenalty *float32 `json:"presencePenalty,omitempty"` FrequencyPenalty *float32 `json:"frequencyPenalty,omitempty"` Seed *int32 `json:"seed,omitempty"` ResponseMIMEType string `json:"responseMimeType,omitempty"` }
type DeepSeekService ¶
type DeepSeekService struct { ApiKey string // contains filtered or unexported fields }
func NewDeepSeekService ¶
func NewDeepSeekService(ctx *context.Context, apiKey string) *DeepSeekService
func (*DeepSeekService) Generate ¶
func (g *DeepSeekService) Generate(prompt string, attachment *AiAttachment, histories []AiMessage) (*AiMessage, error)
func (*DeepSeekService) SetApiKey ¶
func (g *DeepSeekService) SetApiKey(apiKey string)
func (*DeepSeekService) SetContentConfig ¶
func (g *DeepSeekService) SetContentConfig(config *ContentConfig)
func (*DeepSeekService) SetHost ¶
func (g *DeepSeekService) SetHost(host string)
func (*DeepSeekService) SetModel ¶
func (g *DeepSeekService) SetModel(model string)
func (*DeepSeekService) SetSystemInstruction ¶
func (g *DeepSeekService) SetSystemInstruction(instruction string)
type GeminiV2SService ¶
type GeminiV2SService struct { ApiKey string // contains filtered or unexported fields }
func NewGeminiV2Service ¶
func NewGeminiV2Service(ctx *context.Context, apiKey string) *GeminiV2SService
func (*GeminiV2SService) Generate ¶
func (g *GeminiV2SService) Generate(prompt string, attachment *AiAttachment, histories []AiMessage) (*AiMessage, error)
func (*GeminiV2SService) SetApiKey ¶
func (g *GeminiV2SService) SetApiKey(apiKey string)
func (*GeminiV2SService) SetContentConfig ¶
func (g *GeminiV2SService) SetContentConfig(config *ContentConfig)
func (*GeminiV2SService) SetHost ¶
func (g *GeminiV2SService) SetHost(host string)
func (*GeminiV2SService) SetModel ¶
func (g *GeminiV2SService) SetModel(model string)
func (*GeminiV2SService) SetSystemInstruction ¶
func (g *GeminiV2SService) SetSystemInstruction(instruction string)
type GeneratorConfig ¶
type GeneratorFactory ¶
type GeneratorFactory func(config GeneratorConfig) (AiGenerator, error)
type OllamaService ¶
type OllamaService struct {
// contains filtered or unexported fields
}
func NewOllamaService ¶
func NewOllamaService(ctx *context.Context, model string) *OllamaService
func (*OllamaService) Generate ¶
func (g *OllamaService) Generate(prompt string, attachment *AiAttachment, histories []AiMessage) (*AiMessage, error)
func (*OllamaService) SetApiKey ¶
func (g *OllamaService) SetApiKey(apiKey string)
func (*OllamaService) SetContentConfig ¶
func (g *OllamaService) SetContentConfig(config *ContentConfig)
func (*OllamaService) SetHost ¶
func (g *OllamaService) SetHost(host string)
func (*OllamaService) SetModel ¶
func (g *OllamaService) SetModel(model string)
func (*OllamaService) SetSteam ¶
func (g *OllamaService) SetSteam(stream bool)
func (*OllamaService) SetSystemInstruction ¶
func (g *OllamaService) SetSystemInstruction(instruction string)
type OpenAiService ¶ added in v1.0.60
type OpenAiService struct { ApiKey string // contains filtered or unexported fields }
func NewOpenAiService ¶ added in v1.0.60
func NewOpenAiService(ctx *context.Context, apiKey string) *OpenAiService
func (*OpenAiService) Generate ¶ added in v1.0.60
func (g *OpenAiService) Generate(prompt string, attachment *AiAttachment, histories []AiMessage) (*AiMessage, error)
func (*OpenAiService) SetApiKey ¶ added in v1.0.60
func (g *OpenAiService) SetApiKey(apiKey string)
func (*OpenAiService) SetContentConfig ¶ added in v1.0.60
func (g *OpenAiService) SetContentConfig(config *ContentConfig)
func (*OpenAiService) SetHost ¶ added in v1.0.60
func (g *OpenAiService) SetHost(host string)
func (*OpenAiService) SetModel ¶ added in v1.0.60
func (g *OpenAiService) SetModel(model string)
func (*OpenAiService) SetSystemInstruction ¶ added in v1.0.60
func (g *OpenAiService) SetSystemInstruction(instruction string)
type OtherService ¶
type OtherService struct { ApiKey string // contains filtered or unexported fields }
func NewOtherService ¶
func NewOtherService(ctx *context.Context, apiKey string) *OtherService
func (*OtherService) Generate ¶
func (g *OtherService) Generate(prompt string, attachment *AiAttachment, histories []AiMessage) (*AiMessage, error)
func (*OtherService) SetApiKey ¶
func (g *OtherService) SetApiKey(apiKey string)
func (*OtherService) SetContentConfig ¶
func (g *OtherService) SetContentConfig(config *ContentConfig)
func (*OtherService) SetHost ¶
func (g *OtherService) SetHost(host string)
func (*OtherService) SetModel ¶
func (g *OtherService) SetModel(model string)
func (*OtherService) SetSystemInstruction ¶
func (g *OtherService) SetSystemInstruction(instruction string)
type Response ¶
type Response struct { Model string `json:"model"` CreatedAt time.Time `json:"created_at"` Message Message `json:"message"` Done bool `json:"done"` TotalDuration int64 `json:"total_duration"` LoadDuration int `json:"load_duration"` PromptEvalCount int `json:"prompt_eval_count"` PromptEvalDuration int `json:"prompt_eval_duration"` EvalCount int `json:"eval_count"` EvalDuration int64 `json:"eval_duration"` }
Click to show internal directories.
Click to hide internal directories.