Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new connections for LLMS #2428

Merged
merged 2 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@clerk/nextjs": "^5.3.0",
"@dagrejs/dagre": "^1.1.1",
"@flanksource/icons": "^1.0.31",
"@flanksource/icons": "^1.0.32",
"@floating-ui/react": "^0.26.9",
"@headlessui/react": "^2.1.2",
"@heroicons/react": "^1.0.3",
Expand Down
1 change: 1 addition & 0 deletions src/components/Connections/ConnectionFormModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
export type Connection = {
altID?: string;
authMethod?: string;
model?: string;
bucket?: string;
certificate?: string;
channel?: string;
Expand Down
131 changes: 131 additions & 0 deletions src/components/Connections/connectionTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export type ConnectionFormFields = {
};

export const enum ConnectionValueType {
Anthropic = "anthropic",
Ollama = "ollama",
OpenAI = "openai",
AWS = "aws",
AWS_S3 = "s3",
Azure = "azure",
Expand Down Expand Up @@ -123,6 +126,134 @@ export const commonConnectionFormFields: ConnectionFormFields[] = [
];

export const connectionTypes: ConnectionType[] = [
{
title: "Anthropic",
icon: "anthropic",
value: ConnectionValueType.Anthropic,
fields: [
...commonConnectionFormFields,
{
label: "Model",
key: "model",
type: ConnectionsFieldTypes.input,
required: false
},
{
label: "Base URL",
hint: "appropriate when using a proxy",
key: "url",
type: ConnectionsFieldTypes.EnvVarSource,
required: false
},
{
label: "API Key",
key: "password",
type: ConnectionsFieldTypes.EnvVarSource,
required: true
}
],
convertToFormSpecificValue: (data: Record<string, any>) => {
return {
...data,
model: data?.properties?.model
} as Connection;
},
preSubmitConverter: (data: Record<string, string>) => {
return {
name: data.name,
url: data.url,
password: data.password,
properties: {
model: data.model
}
};
}
},
{
title: "OpenAI",
icon: "openai",
value: ConnectionValueType.OpenAI,
fields: [
...commonConnectionFormFields,
{
label: "URL",
key: "url",
hint: "appropriate when using a proxy",
type: ConnectionsFieldTypes.input,
required: false
},
{
label: "Model",
key: "model",
type: ConnectionsFieldTypes.EnvVarSource,
required: false
},
{
label: "API Key",
key: "password",
type: ConnectionsFieldTypes.EnvVarSource,
required: true
}
],
convertToFormSpecificValue: (data: Record<string, any>) => {
return {
...data,
model: data?.properties?.model
} as Connection;
},
preSubmitConverter: (data: Record<string, string>) => {
return {
name: data.name,
url: data.url,
password: data.password,
properties: {
model: data.model
}
};
}
},
{
title: "Ollama",
icon: "ollama",
value: ConnectionValueType.Ollama,
fields: [
...commonConnectionFormFields,
{
label: "URL",
key: "url",
type: ConnectionsFieldTypes.input,
required: true
},
{
label: "Model",
key: "model",
type: ConnectionsFieldTypes.EnvVarSource,
required: false
},
{
label: "API Key",
key: "password",
type: ConnectionsFieldTypes.EnvVarSource,
required: true
}
],
convertToFormSpecificValue: (data: Record<string, any>) => {
return {
...data,
model: data?.properties?.model
} as Connection;
},
preSubmitConverter: (data: Record<string, string>) => {
return {
name: data.name,
url: data.url,
password: data.password,
properties: {
model: data.model
}
};
}
},
{
title: "Postgres",
icon: "postgres",
Expand Down
8 changes: 6 additions & 2 deletions src/ui/Icons/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { isEmpty } from "lodash";

type IconMap = Record<string, string>;
export const aliases: IconMap = {
anthropic: "anthropic",
openai: "openai",
ollama: "ollama",
aws_s3: "aws-s3",
kubernetes_resource: "k8s",
generic_webhook: "webhook",
Expand Down Expand Up @@ -115,7 +118,9 @@ export const aliases: IconMap = {
"elasticloadbalancing-loadbalancer": "aws-elb",
fluentbit: "fluentd",
"google chat": "google-chat",
"google cloud": "gcp",
"google cloud": "google-cloud",
google_cloud: "google-cloud",
gcs: "google-cloud",
"iam-instanceprofile": "server",
"iam-role": "shield",
"iam-user": "user",
Expand All @@ -142,7 +147,6 @@ export const aliases: IconMap = {
"k8s-servicemonitor": "prometheus",
"k8s-tigerastatus": "calico",
"k8s-topology": "mission-control",
gcs: "gcsbucket",
kubernetes: "k8s",
"mssql-database": "sqlserver",
mssql: "sqlserver",
Expand Down
Loading