Skip to content

Commit

Permalink
Add alert sideloading, Scaling Improvements (#1924)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljguarino authored Feb 20, 2025
1 parent 53e5ecc commit bee7e5c
Show file tree
Hide file tree
Showing 36 changed files with 2,295 additions and 1,988 deletions.
7 changes: 7 additions & 0 deletions assets/src/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,8 @@ export type BackupAttributes = {
export type BedrockAiAttributes = {
/** aws access key id to use, you can also use IRSA for self-hosted consoles */
accessKeyId?: InputMaybe<Scalars['String']['input']>;
/** the model to use for vector embeddings */
embeddingModel?: InputMaybe<Scalars['String']['input']>;
/** the bedrock model id to use */
modelId: Scalars['String']['input'];
/** aws secret access key to use, you can also use IRSA for self-hosted consoles */
Expand Down Expand Up @@ -4849,6 +4851,8 @@ export type PolicyEngine = {
};

export type PolicyEngineAttributes = {
/** the maximum allowed severity without failing the stack run */
maxSeverity?: InputMaybe<VulnSeverity>;
/** the policy engine to use with this stack */
type: PolicyEngineType;
};
Expand Down Expand Up @@ -7111,6 +7115,7 @@ export type RootQueryTypeClustersArgs = {
q?: InputMaybe<Scalars['String']['input']>;
tag?: InputMaybe<TagInput>;
tagQuery?: InputMaybe<TagQuery>;
upgradeable?: InputMaybe<Scalars['Boolean']['input']>;
};


Expand Down Expand Up @@ -8964,13 +8969,15 @@ export enum StackType {
export type StackViolationCause = {
__typename?: 'StackViolationCause';
end: Scalars['Int']['output'];
filename?: Maybe<Scalars['String']['output']>;
lines?: Maybe<Array<Maybe<StackViolationCauseLine>>>;
resource: Scalars['String']['output'];
start: Scalars['Int']['output'];
};

export type StackViolationCauseAttributes = {
end: Scalars['Int']['input'];
filename?: InputMaybe<Scalars['String']['input']>;
lines?: InputMaybe<Array<InputMaybe<StackViolationCauseLineAttributes>>>;
resource: Scalars['String']['input'];
start: Scalars['Int']['input'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ spec:
of the same API scheme (for instance Together.ai uses the
OpenAI API spec)
type: string
embeddingModel:
description: Model to use for generating embeddings
type: string
model:
description: Model is the LLM model name to use.
type: string
Expand Down Expand Up @@ -96,6 +99,9 @@ spec:
description: The azure openai Data plane - inference api version
to use, defaults to 2024-10-01-preview or the latest available
type: string
embeddingModel:
description: Model to use for generating embeddings
type: string
endpoint:
description: 'Your Azure OpenAI endpoint, should be formatted
like: https://{endpoint}/openai/deployments/{deployment-id}"'
Expand Down Expand Up @@ -173,6 +179,18 @@ spec:
required:
- modelId
type: object
embeddingProvider:
description: Provider to use for generating embeddings. Oftentimes
foundational model providers do not have embeddings models,
and it's better to simply use OpenAI.
enum:
- OPENAI
- ANTHROPIC
- OLLAMA
- AZURE
- BEDROCK
- VERTEX
type: string
enabled:
default: false
description: Enabled defines whether to enable the AI integration
Expand Down Expand Up @@ -227,6 +245,9 @@ spec:
of the same API scheme (for instance Together.ai uses the
OpenAI API spec)
type: string
embeddingModel:
description: Model to use for generating embeddings
type: string
model:
description: Model is the LLM model name to use.
type: string
Expand Down
7 changes: 6 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ config :console,
audit_expiry: 30,
admin_emails: [],
cloud: false,
chunk_size: 1024 * 10,
sidecar_token: "example",
sidecar_token_path: "./secrets",
cache_adapter: Console.Cache,
Expand Down Expand Up @@ -112,7 +113,7 @@ config :console, Console.PartitionedCache,
allocated_memory: 1000 * 1000 * 500
]

config :my_app, Console.MultilevelCache,
config :console, Console.MultilevelCache,
model: :inclusive,
levels: [
{
Expand Down Expand Up @@ -161,4 +162,8 @@ config :console, Console.PromEx,
metrics_server: :disabled,
version: "0.11.0"

config :console, :ttls,
helm: :timer.minutes(30),
cluster_metrics: :timer.hours(6)

import_config "#{Mix.env()}.exs"
1 change: 1 addition & 0 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ config :console, Console.Cron.Scheduler,
{"*/4 * * * *", {Console.Deployments.Cron, :scan_pipeline_stages, []}},
{"*/4 * * * *", {Console.Deployments.Cron, :scan_pending_promotions, []}},
{"*/4 * * * *", {Console.Deployments.Cron, :scan_pending_contexts, []}},
{"*/5 * * * *", {Console.Deployments.Cron, :cache_warm, []}},
{"*/10 * * * *", {Console.Deployments.Init, :ensure_secret, []}},
{"*/5 * * * *", {Console.AI.Cron, :services, []}},
{"*/5 * * * *", {Console.AI.Cron, :stacks, []}},
Expand Down
6 changes: 6 additions & 0 deletions go/client/models_gen.go

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

50 changes: 35 additions & 15 deletions go/controller/api/v1alpha1/deploymentsettings_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ type AISettings struct {
// +kubebuilder:validation:Optional
ToolProvider *console.AiProvider `json:"toolProvider,omitempty"`

// Provider to use for generating embeddings. Oftentimes foundational model providers do not have embeddings models, and it's better to simply use OpenAI.
//
// +kubebuilder:validation:Enum=OPENAI;ANTHROPIC;OLLAMA;AZURE;BEDROCK;VERTEX
// +kubebuilder:validation:Optional
EmbeddingProvider *console.AiProvider `json:"embeddingProvider,omitempty"`

// OpenAI holds the OpenAI provider configuration.
//
// +kubebuilder:validation:Optional
Expand Down Expand Up @@ -364,9 +370,10 @@ func (in *LoggingSettings) Attributes(ctx context.Context, c client.Client, name

func (in *AISettings) Attributes(ctx context.Context, c client.Client, namespace string) (*console.AiSettingsAttributes, error) {
attr := &console.AiSettingsAttributes{
Enabled: in.Enabled,
Provider: in.Provider,
ToolProvider: in.ToolProvider,
Enabled: in.Enabled,
Provider: in.Provider,
ToolProvider: in.ToolProvider,
EmbeddingProvider: in.EmbeddingProvider,
}

if in.Tools != nil && in.Tools.CreatePr != nil {
Expand Down Expand Up @@ -397,10 +404,11 @@ func (in *AISettings) Attributes(ctx context.Context, c client.Client, namespace
}

attr.Openai = &console.OpenaiSettingsAttributes{
AccessToken: &token,
Model: in.OpenAI.Model,
BaseURL: in.OpenAI.BaseUrl,
ToolModel: in.OpenAI.ToolModel,
AccessToken: &token,
Model: in.OpenAI.Model,
BaseURL: in.OpenAI.BaseUrl,
ToolModel: in.OpenAI.ToolModel,
EmbeddingModel: in.OpenAI.EmbeddingModel,
}
case console.AiProviderAnthropic:
if in.Anthropic == nil {
Expand All @@ -413,9 +421,10 @@ func (in *AISettings) Attributes(ctx context.Context, c client.Client, namespace
}

attr.Anthropic = &console.AnthropicSettingsAttributes{
AccessToken: lo.ToPtr(token),
Model: in.Anthropic.Model,
ToolModel: in.Anthropic.ToolModel,
AccessToken: lo.ToPtr(token),
Model: in.Anthropic.Model,
ToolModel: in.Anthropic.ToolModel,
EmbeddingModel: in.Anthropic.EmbeddingModel,
}
case console.AiProviderAzure:
if in.Azure == nil {
Expand All @@ -428,11 +437,12 @@ func (in *AISettings) Attributes(ctx context.Context, c client.Client, namespace
}

attr.Azure = &console.AzureOpenaiAttributes{
Endpoint: in.Azure.Endpoint,
APIVersion: in.Azure.ApiVersion,
Model: in.Azure.Model,
ToolModel: in.Azure.ToolModel,
AccessToken: token,
Endpoint: in.Azure.Endpoint,
APIVersion: in.Azure.ApiVersion,
Model: in.Azure.Model,
ToolModel: in.Azure.ToolModel,
EmbeddingModel: in.Azure.EmbeddingModel,
AccessToken: token,
}
case console.AiProviderVertex:
if in.Vertex == nil {
Expand Down Expand Up @@ -499,6 +509,11 @@ type AIProviderSettings struct {
// +kubebuilder:validation:Optional
ToolModel *string `json:"toolModel,omitempty"`

// Model to use for generating embeddings
//
// +kubebuilder:validation:Optional
EmbeddingModel *string `json:"embeddingModel,omitempty"`

// A custom base url to use, for reimplementations of the same API scheme (for instance Together.ai uses the OpenAI API spec)
//
// +kubebuilder:validation:Optional
Expand Down Expand Up @@ -556,6 +571,11 @@ type AzureOpenAISettings struct {
// +kubebuilder:validation:Optional
ToolModel *string `json:"toolModel,omitempty"`

// Model to use for generating embeddings
//
// +kubebuilder:validation:Optional
EmbeddingModel *string `json:"embeddingModel,omitempty"`

// TokenSecretRef is a reference to the local secret holding the token to access
// the configured AI provider.
//
Expand Down
15 changes: 15 additions & 0 deletions go/controller/api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ spec:
of the same API scheme (for instance Together.ai uses the
OpenAI API spec)
type: string
embeddingModel:
description: Model to use for generating embeddings
type: string
model:
description: Model is the LLM model name to use.
type: string
Expand Down Expand Up @@ -96,6 +99,9 @@ spec:
description: The azure openai Data plane - inference api version
to use, defaults to 2024-10-01-preview or the latest available
type: string
embeddingModel:
description: Model to use for generating embeddings
type: string
endpoint:
description: 'Your Azure OpenAI endpoint, should be formatted
like: https://{endpoint}/openai/deployments/{deployment-id}"'
Expand Down Expand Up @@ -173,6 +179,18 @@ spec:
required:
- modelId
type: object
embeddingProvider:
description: Provider to use for generating embeddings. Oftentimes
foundational model providers do not have embeddings models,
and it's better to simply use OpenAI.
enum:
- OPENAI
- ANTHROPIC
- OLLAMA
- AZURE
- BEDROCK
- VERTEX
type: string
enabled:
default: false
description: Enabled defines whether to enable the AI integration
Expand Down Expand Up @@ -227,6 +245,9 @@ spec:
of the same API scheme (for instance Together.ai uses the
OpenAI API spec)
type: string
embeddingModel:
description: Model to use for generating embeddings
type: string
model:
description: Model is the LLM model name to use.
type: string
Expand Down
6 changes: 5 additions & 1 deletion lib/console/ai/provider.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ defmodule Console.AI.Provider do

def embeddings(text) do
settings = Console.Deployments.Settings.cached()
with {:ok, %mod{} = client} <- client(settings),
with {:ok, %mod{} = client} <- embedding_client(settings),
do: mod.embeddings(client, text)
end

def summary(text), do: completion([{:user, text}], preface: @summary)

defp embedding_client(%DeploymentSettings{ai: %AI{embedding_provider: p}} = settings) when not is_nil(p),
do: client(put_in(settings.ai.provider, p))
defp embedding_client(settings), do: client(settings)

defp tool_client(%DeploymentSettings{ai: %AI{tool_provider: p}} = settings) when not is_nil(p),
do: client(put_in(settings.ai.provider, p))
defp tool_client(settings), do: client(settings)
Expand Down
2 changes: 2 additions & 0 deletions lib/console/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ defmodule Console.Application do
{Phoenix.PubSub, [name: Console.PubSub, adapter: Phoenix.PubSub.PG2]},
Console.Cache,
Console.ReplicatedCache,
Console.MultilevelCache,
Console.TestCache,
Console.LocalCache,
ConsoleWeb.Endpoint,
Console.Plural.Config,
Console.Features,
Console.Cron.Scheduler,
Console.Buffers.ClusterAudit,
Console.Deployments.Local.Server,
{Registry, [keys: :unique, name: Console.Buffer.Base.registry()]},
{Registry, [keys: :unique, name: Console.Deployments.Git.Agent.registry()]},
{Registry, [keys: :unique, name: Console.Deployments.Pipelines.Supervisor.registry()]},
Expand Down
Loading

0 comments on commit bee7e5c

Please sign in to comment.