Skip to content

Commit

Permalink
feat: new connections for LLMS
Browse files Browse the repository at this point in the history
* fix icon for google cloud storage & GCP
  • Loading branch information
adityathebe committed Dec 26, 2024
1 parent 813c6f6 commit ab9c281
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 2 deletions.
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: "gcp",
"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

0 comments on commit ab9c281

Please sign in to comment.