这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f6af8a1
working snapshot
allisoneer Mar 25, 2025
e372425
google and other stuff plus passing tests
allisoneer Mar 25, 2025
ebc5b25
simplified by removing some providers
allisoneer Mar 25, 2025
2b3a9e9
Merge branch 'main' into allison/eng-1108-flexible-model-support-eg-v…
allisoneer Mar 25, 2025
1b6507f
Merge branch 'main' into allison/eng-1108-flexible-model-support-eg-v…
allisoneer Mar 25, 2025
2fc5235
fix up existing tests
allisoneer Mar 25, 2025
d6f84f5
tests + fixes
allisoneer Mar 25, 2025
b7d1dcf
happy lint and happy life
allisoneer Mar 25, 2025
5c7c7ef
Merge branch 'main' into allison/eng-1108-flexible-model-support-eg-v…
allisoneer Mar 25, 2025
538a9a8
test passing checkpoint
allisoneer Mar 26, 2025
fdb81ea
very close to working
allisoneer Mar 26, 2025
f38f0ec
fixed up and working fully now
allisoneer Mar 26, 2025
8ebbe16
Merge branch 'main' into allison/eng-1108-flexible-model-support-eg-v…
allisoneer Mar 26, 2025
201f0a1
make linting happy
allisoneer Mar 26, 2025
1ef6107
doc cleanup
allisoneer Mar 26, 2025
f85aff3
doc update
allisoneer Mar 26, 2025
c755459
some more cleanup
allisoneer Mar 26, 2025
a5a3ff8
git check point
allisoneer Apr 3, 2025
b8cca5f
Merge branch 'main' into allison/eng-1108-flexible-model-support-eg-v…
allisoneer Apr 3, 2025
913d1a1
compiling/working
allisoneer Apr 3, 2025
64ef941
closer to happy anthropic
allisoneer Apr 3, 2025
3b060ec
anthropic is happy but openai is not now (mcp related)
allisoneer Apr 3, 2025
80e7c77
weird mcp tool handling solution
allisoneer Apr 3, 2025
11a70a5
Update kubechain/internal/controller/taskrun/taskrun_controller_test.go
allisoneer Apr 4, 2025
3fe1820
Update kubechain/internal/controller/taskrun/taskrun_controller.go
allisoneer Apr 4, 2025
f9f74e5
Put back test and undo Debug change
allisoneer Apr 4, 2025
8a9462c
add todo to look at later
allisoneer Apr 4, 2025
552ffae
Merge branch 'main' into allison/eng-1108-flexible-model-support-eg-v…
allisoneer Apr 4, 2025
173aa87
fixup
allisoneer Apr 4, 2025
5b3913e
Merge branch 'main' into allison/eng-1108-flexible-model-support-eg-v…
allisoneer Apr 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 125 additions & 10 deletions kubechain/api/v1alpha1/llm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,139 @@ type APIKeySource struct {
SecretKeyRef SecretKeyRef `json:"secretKeyRef"`
}

// LLMSpec defines the desired state of LLM
type LLMSpec struct {
// Provider is the LLM provider name (ex: "openai", "anthropic")
// +kubebuilder:validation:Required
// +kubebuilder:validation:Enum=openai;anthropic
Provider string `json:"provider"`
// BaseConfig holds common configuration options across providers
type BaseConfig struct {
// Model name to use
Model string `json:"model,omitempty"`

// APIKeyFrom references the secret containing the API key
// +kubebuilder:validation:Required
APIKeyFrom APIKeySource `json:"apiKeyFrom"`
// BaseURL for API endpoints (used by many providers)
BaseURL string `json:"baseUrl,omitempty"`

// Temperature adjusts the LLM response randomness (0.0 to 1.0)
// +kubebuilder:validation:Pattern=^0(\.[0-9]+)?|1(\.0+)?$
Temperature string `json:"temperature,omitempty"`

// MaxTokens defines the maximum number of tokens for the LLM.
// MaxTokens defines the maximum number of tokens for the LLM
// +kubebuilder:validation:Minimum=1
MaxTokens *int `json:"maxTokens,omitempty"`

// TopP controls diversity via nucleus sampling (0.0 to 1.0)
// +kubebuilder:validation:Pattern=^(0(\.[0-9]+)?|1(\.0+)?)$
TopP string `json:"topP,omitempty"`

// TopK controls diversity by limiting the top K tokens to sample from
// +kubebuilder:validation:Minimum=1
TopK *int `json:"topK,omitempty"`

// FrequencyPenalty reduces repetition by penalizing frequent tokens
// +kubebuilder:validation:Pattern=^-?[0-2](\.[0-9]+)?$
FrequencyPenalty string `json:"frequencyPenalty,omitempty"`

// PresencePenalty reduces repetition by penalizing tokens that appear at all
// +kubebuilder:validation:Pattern=^-?[0-2](\.[0-9]+)?$
PresencePenalty string `json:"presencePenalty,omitempty"`
}

// OpenAIConfig for OpenAI-specific options
type OpenAIConfig struct {
// Organization is the OpenAI organization ID
Organization string `json:"organization,omitempty"`

// APIType specifies which OpenAI API type to use
// +kubebuilder:validation:Enum=OPEN_AI;AZURE;AZURE_AD
// +kubebuilder:default=OPEN_AI
APIType string `json:"apiType,omitempty"`

// APIVersion is required when using Azure API types
// Example: "2023-05-15"
APIVersion string `json:"apiVersion,omitempty"`
}

// AnthropicConfig for Anthropic-specific options
type AnthropicConfig struct {
// AnthropicBetaHeader adds the Anthropic Beta header to support extended options
// Common values include "max-tokens-3-5-sonnet-2024-07-15" for extended token limits
// +kubebuilder:validation:Optional
AnthropicBetaHeader string `json:"anthropicBetaHeader,omitempty"`
}

// VertexConfig for Vertex-specific options
type VertexConfig struct {
// CloudProject is the Google Cloud project ID
// +kubebuilder:validation:Required
CloudProject string `json:"cloudProject"`

// CloudLocation is the Google Cloud region
// +kubebuilder:validation:Required
CloudLocation string `json:"cloudLocation"`
}

// MistralConfig for Mistral-specific options
type MistralConfig struct {
// MaxRetries sets the maximum number of retries for API calls
// +kubebuilder:validation:Minimum=0
MaxRetries *int `json:"maxRetries,omitempty"`

// Timeout specifies the timeout duration for API calls (in seconds)
// +kubebuilder:validation:Minimum=1
Timeout *int `json:"timeout,omitempty"`

// RandomSeed provides a seed for deterministic sampling
// +kubebuilder:validation:Optional
RandomSeed *int `json:"randomSeed,omitempty"`
}

// GoogleConfig for Google AI-specific options
type GoogleConfig struct {
// CloudProject is the Google Cloud project ID
CloudProject string `json:"cloudProject,omitempty"`

// CloudLocation is the Google Cloud region
CloudLocation string `json:"cloudLocation,omitempty"`
}

// ProviderConfig holds provider-specific configurations
type ProviderConfig struct {
OpenAIConfig *OpenAIConfig `json:"openaiConfig,omitempty"`
AnthropicConfig *AnthropicConfig `json:"anthropicConfig,omitempty"`
VertexConfig *VertexConfig `json:"vertexConfig,omitempty"`
MistralConfig *MistralConfig `json:"mistralConfig,omitempty"`
GoogleConfig *GoogleConfig `json:"googleConfig,omitempty"`
}

// LLMSpec defines the desired state of LLM
type LLMSpec struct {
// Provider is the LLM provider name
// +kubebuilder:validation:Required
// +kubebuilder:validation:Enum=openai;anthropic;mistral;google;vertex;
Provider string `json:"provider"`

// APIKeyFrom references the secret containing the API key or credentials
APIKeyFrom *APIKeySource `json:"apiKeyFrom,omitempty"`

// Parameters holds common configuration options across providers
// +optional
Parameters BaseConfig `json:"parameters,omitempty"`

// OpenAI provider-specific configuration
// +optional
OpenAI *OpenAIConfig `json:"openai,omitempty"`

// Anthropic provider-specific configuration
// +optional
Anthropic *AnthropicConfig `json:"anthropic,omitempty"`

// Vertex provider-specific configuration
// +optional
Vertex *VertexConfig `json:"vertex,omitempty"`

// Mistral provider-specific configuration
// +optional
Mistral *MistralConfig `json:"mistral,omitempty"`

// Google provider-specific configuration
// +optional
Google *GoogleConfig `json:"google,omitempty"`
}

// LLMStatus defines the observed state of LLM
Expand Down
188 changes: 184 additions & 4 deletions kubechain/api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading