entconfig

package
v0.19.3 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package entconfig holds configuration stuff for the ent server

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLLMProvider = errors.New("not a valid LLMProvider")
View Source
var ErrInvalidSummarizerType = errors.New("not a valid SummarizerType")

Functions

This section is empty.

Types

type AnthropicConfig added in v0.11.0

type AnthropicConfig struct {
	// BetaHeader specifies the beta API features to enable
	BetaHeader string `json:"betaHeader" koanf:"betaHeader"`

	// LegacyTextCompletion enables legacy text completion API
	LegacyTextCompletion bool `json:"legacyTextCompletion" koanf:"legacyTextCompletion"`

	// BaseURL specifies the API endpoint
	BaseURL string `json:"baseURL" koanf:"baseURL"`

	GenericLLMConfig
}

AnthropicConfig contains Anthropic specific configuration

type CloudflareConfig added in v0.11.0

type CloudflareConfig struct {
	GenericLLMConfig

	// AccountID specifies the Cloudflare account ID
	AccountID string `json:"accountID" koanf:"accountID"`

	// ServerURL specifies the API endpoint
	ServerURL string `json:"serverURL" koanf:"serverURL"`
}

CloudflareConfig contains Cloudflare specific configuration

type Config

type Config struct {
	// EntityTypes is the list of entity types to create by default for the organization
	EntityTypes []string `json:"entityTypes" koanf:"entityTypes" default:"" description:"entity types to create for the organization"`

	// Summarizer contains configuration for text summarization
	Summarizer Summarizer `json:"summarizer" koanf:"summarizer"`
}

Config holds the configuration for the ent server

type GeminiConfig added in v0.11.0

type GeminiConfig struct {
	GenericLLMConfig

	// CredentialsPath is the path to Google Cloud credentials file
	CredentialsPath string `json:"credentialsPath" koanf:"credentialsPath"`

	// CredentialsJSON contains Google Cloud credentials as JSON string
	CredentialsJSON string `json:"credentialsJSON" koanf:"credentialsJSON"`

	// MaxTokens specifies the maximum tokens for response
	MaxTokens int `json:"maxTokens" koanf:"maxTokens"`
}

GeminiConfig contains Google Gemini specific configuration

type GenericLLMConfig added in v0.11.0

type GenericLLMConfig struct {
	// Model specifies the model name to use
	Model string `json:"model" koanf:"model"`

	// APIKey contains the authentication key for the service
	APIKey string `json:"apiKey" koanf:"apiKey"`
}

GenericLLMConfig contains common and reusable fields for LLM providers

type HuggingFaceConfig added in v0.11.0

type HuggingFaceConfig struct {
	GenericLLMConfig

	// URL specifies the API endpoint
	URL string `json:"url" koanf:"url"`
}

HuggingFaceConfig contains HuggingFace specific configuration

type LLMProvider added in v0.11.0

type LLMProvider string

LLMProvider defines supported LLM service providers ENUM(openai,anthropic,mistral,gemini,cloudflare,huggingface,ollama)

const (
	// LLMProviderOpenai is a LLMProvider of type openai.
	LLMProviderOpenai LLMProvider = "openai"
	// LLMProviderAnthropic is a LLMProvider of type anthropic.
	LLMProviderAnthropic LLMProvider = "anthropic"
	// LLMProviderMistral is a LLMProvider of type mistral.
	LLMProviderMistral LLMProvider = "mistral"
	// LLMProviderGemini is a LLMProvider of type gemini.
	LLMProviderGemini LLMProvider = "gemini"
	// LLMProviderCloudflare is a LLMProvider of type cloudflare.
	LLMProviderCloudflare LLMProvider = "cloudflare"
	// LLMProviderHuggingface is a LLMProvider of type huggingface.
	LLMProviderHuggingface LLMProvider = "huggingface"
	// LLMProviderOllama is a LLMProvider of type ollama.
	LLMProviderOllama LLMProvider = "ollama"
)

func ParseLLMProvider added in v0.11.0

func ParseLLMProvider(name string) (LLMProvider, error)

ParseLLMProvider attempts to convert a string to a LLMProvider.

func (LLMProvider) IsValid added in v0.11.0

func (x LLMProvider) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (LLMProvider) String added in v0.11.0

func (x LLMProvider) String() string

String implements the Stringer interface.

type MistralConfig added in v0.11.0

type MistralConfig struct {
	GenericLLMConfig

	// URL specifies the API endpoint
	URL string `json:"url" koanf:"url"`
}

MistralConfig contains Mistral specific configuration

type OllamaConfig added in v0.11.0

type OllamaConfig struct {
	// Model specifies the model to use
	Model string `json:"model" koanf:"model"`

	// URL specifies the API endpoint
	URL string `json:"url" koanf:"url"`
}

OllamaConfig contains Ollama specific configuration

type OpenAIConfig added in v0.11.0

type OpenAIConfig struct {
	GenericLLMConfig

	// URL specifies the API endpoint
	URL string `json:"url" koanf:"url"`

	// OrganizationID specifies the OpenAI organization ID
	OrganizationID string `json:"organizationID" koanf:"organizationID"`
}

OpenAIConfig contains OpenAI specific configuration

type Summarizer added in v0.11.0

type Summarizer struct {
	// Type specifies the summarization algorithm to use
	Type SummarizerType `json:"type" koanf:"type" default:"lexrank"`
	// LLM contains configuration for large language model based summarization
	LLM SummarizerLLM `json:"llm" koanf:"llm"`
	// MaximumSentences specifies the maximum number of sentences in the summary
	MaximumSentences int `json:"maximumSentences" koanf:"maximumSentences" default:"60"`
}

Summarizer holds configuration for the text summarization functionality

type SummarizerLLM added in v0.11.0

type SummarizerLLM struct {
	// Provider specifies which LLM service to use
	Provider LLMProvider `json:"provider" koanf:"provider"`

	// Anthropic contains configuration for Anthropic's API
	Anthropic AnthropicConfig `json:"anthropic" koanf:"anthropic"`

	// Mistral contains configuration for Mistral's API
	Mistral MistralConfig `json:"mistral" koanf:"mistral"`

	// Gemini contains configuration for Google's Gemini API
	Gemini GeminiConfig `json:"gemini" koanf:"gemini"`

	// HuggingFace contains configuration for HuggingFace's API
	HuggingFace HuggingFaceConfig `json:"huggingFace" koanf:"huggingFace"`

	// Ollama contains configuration for Ollama's API
	Ollama OllamaConfig `json:"ollama" koanf:"ollama"`

	// Cloudflare contains configuration for Cloudflare's API
	Cloudflare CloudflareConfig `json:"cloudflare" koanf:"cloudflare"`

	// OpenAI contains configuration for OpenAI's API
	OpenAI OpenAIConfig `json:"openai" koanf:"openai"`
}

SummarizerLLM contains configuration for multiple LLM providers

type SummarizerType added in v0.11.0

type SummarizerType string

SummarizerType defines the type of summarization algorithm ENUM(lexrank,llm)

const (
	// SummarizerTypeLexrank is a SummarizerType of type lexrank.
	SummarizerTypeLexrank SummarizerType = "lexrank"
	// SummarizerTypeLlm is a SummarizerType of type llm.
	SummarizerTypeLlm SummarizerType = "llm"
)

func ParseSummarizerType added in v0.11.0

func ParseSummarizerType(name string) (SummarizerType, error)

ParseSummarizerType attempts to convert a string to a SummarizerType.

func (SummarizerType) IsValid added in v0.11.0

func (x SummarizerType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (SummarizerType) String added in v0.11.0

func (x SummarizerType) String() string

String implements the Stringer interface.

Jump to

Keyboard shortcuts

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