openai

package
v0.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IntegrationActionType_Chat              domain.IntegrationActionType = "chat"
	IntegrationActionType_GenerateImage     domain.IntegrationActionType = "generate_image"
	IntegrationActionType_AgentChat         domain.IntegrationActionType = "ai_agent_chat" // Added for agent LLM
	IntegrationActionType_GenerateEmbedding domain.IntegrationActionType = "generate_embeddings"
)
View Source
const (
	OpenAIIntegrationPeekable_Models domain.IntegrationPeekableType = "models"
)

Variables

View Source
var (
	Schema = schema
)

Functions

func NewOpenAIIntegrationCreator

func NewOpenAIIntegrationCreator(deps domain.IntegrationDeps) domain.IntegrationCreator

Types

type AgentChatParams

type AgentChatParams struct {
	Model        string                         `json:"model"`
	Messages     []openai.ChatCompletionMessage `json:"messages"`
	Tools        []openai.Tool                  `json:"tools,omitempty"`
	SystemPrompt string                         `json:"system_prompt,omitempty"`
	Temperature  float32                        `json:"temperature"`
	MaxTokens    int                            `json:"max_tokens"`
}

AgentChatParams represents parameters for AI agent chat requests

type ChatCompletionParams

type ChatCompletionParams struct {
	Model       string                         `json:"model"`
	Messages    []openai.ChatCompletionMessage `json:"messages"`
	Temperature float32                        `json:"temperature"`
	MaxTokens   int                            `json:"max_tokens"`
}

type GenerateEmbeddingsParams

type GenerateEmbeddingsParams struct {
	Model string   `json:"model"`
	Input []string `json:"input"`
}

type ImageGenerationParams

type ImageGenerationParams struct {
	Prompt  string `json:"prompt"`
	Size    string `json:"size"`
	Model   string `json:"model"`
	Quality string `json:"quality"` // "standard" or "hd"
	Count   int    `json:"count"`
	Style   string `json:"style"` // "vivid" or "natural"

}

type OpenAICredential

type OpenAICredential struct {
	APIKey string `json:"api_key"`
}

type OpenAIIntegration

type OpenAIIntegration struct {
	// contains filtered or unexported fields
}

func (*OpenAIIntegration) AgentChat

func (i *OpenAIIntegration) AgentChat(ctx context.Context, params domain.IntegrationInput, item domain.Item) (domain.Item, error)

Add the AgentChat handler implementation

func (*OpenAIIntegration) ChatCompletion

func (i *OpenAIIntegration) ChatCompletion(ctx context.Context, params domain.IntegrationInput, item domain.Item) (domain.Item, error)

func (*OpenAIIntegration) Execute

func (*OpenAIIntegration) GenerateEmbeddings

func (i *OpenAIIntegration) GenerateEmbeddings(ctx context.Context, params domain.IntegrationInput, item domain.Item) (domain.Item, error)

func (*OpenAIIntegration) GenerateImage

func (i *OpenAIIntegration) GenerateImage(ctx context.Context, params domain.IntegrationInput, item domain.Item) (domain.Item, error)

func (*OpenAIIntegration) GenerateWithConversation

func (i *OpenAIIntegration) GenerateWithConversation(ctx context.Context, req domain.GenerateRequest) (domain.ModelResponse, error)

GenerateWithConversation implements domain.IntegrationLLM interface

func (*OpenAIIntegration) ListModels

func (*OpenAIIntegration) Peek

func (*OpenAIIntegration) PeekModels

func (i *OpenAIIntegration) PeekModels(ctx context.Context) (domain.PeekResult, error)

func (*OpenAIIntegration) SetClient

func (i *OpenAIIntegration) SetClient(client *openai.Client)

type OpenAIIntegrationCreator

type OpenAIIntegrationCreator struct {
	// contains filtered or unexported fields
}

func (*OpenAIIntegrationCreator) CreateIntegration

type OpenAIIntegrationDependencies

type OpenAIIntegrationDependencies struct {
	CredentialID           string
	CredentialGetter       domain.CredentialGetter[OpenAICredential]
	ParameterBinder        domain.IntegrationParameterBinder
	WorkspaceID            string
	ExecutorStorageManager domain.ExecutorStorageManager
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL