Skip to content

Commit dd99109

Browse files
switch over to using config.json for configuring models. Add language model dropdown selector
1 parent 27ef6d3 commit dd99109

File tree

26 files changed

+3255
-211
lines changed

26 files changed

+3255
-211
lines changed

docs/snippets/schemas/v3/index.schema.mdx

Lines changed: 576 additions & 0 deletions
Large diffs are not rendered by default.

docs/snippets/schemas/v3/languageModel.schema.mdx

Lines changed: 575 additions & 0 deletions
Large diffs are not rendered by default.

packages/schemas/src/v3/index.schema.ts

Lines changed: 576 additions & 0 deletions
Large diffs are not rendered by default.

packages/schemas/src/v3/index.type.ts

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ export type ConnectionConfig =
1111
| GerritConnectionConfig
1212
| BitbucketConnectionConfig
1313
| GenericGitHostConnectionConfig;
14+
export type LanguageModel =
15+
| OpenAILanguageModel
16+
| AmazonBedrockLanguageModel
17+
| AnthropicLanguageModel
18+
| GoogleGenerativeAILanguageModel;
1419

1520
export interface SourcebotConfig {
1621
$schema?: string;
@@ -27,6 +32,10 @@ export interface SourcebotConfig {
2732
connections?: {
2833
[k: string]: ConnectionConfig;
2934
};
35+
/**
36+
* Defines a collection of language models that are available to Sourcebot.
37+
*/
38+
models?: LanguageModel[];
3039
}
3140
/**
3241
* Defines the global settings for Sourcebot.
@@ -417,3 +426,159 @@ export interface GenericGitHostConnectionConfig {
417426
url: string;
418427
revisions?: GitRevisions;
419428
}
429+
export interface OpenAILanguageModel {
430+
/**
431+
* OpenAI Configuration
432+
*/
433+
provider: "openai";
434+
/**
435+
* The name of the language model.
436+
*/
437+
model: string;
438+
/**
439+
* Optional display name.
440+
*/
441+
displayName?: string;
442+
/**
443+
* Optional API key to use with the model. Defaults to the `OPENAI_API_KEY` environment variable.
444+
*/
445+
token?:
446+
| {
447+
/**
448+
* The name of the secret that contains the token.
449+
*/
450+
secret: string;
451+
}
452+
| {
453+
/**
454+
* The name of the environment variable that contains the token. Only supported in declarative connection configs.
455+
*/
456+
env: string;
457+
};
458+
/**
459+
* Optional base URL.
460+
*/
461+
baseUrl?: string;
462+
}
463+
export interface AmazonBedrockLanguageModel {
464+
/**
465+
* Amazon Bedrock Configuration
466+
*/
467+
provider: "amazon-bedrock";
468+
/**
469+
* The name of the language model.
470+
*/
471+
model: string;
472+
/**
473+
* Optional display name.
474+
*/
475+
displayName?: string;
476+
/**
477+
* Optional access key ID to use with the model. Defaults to the `AWS_ACCESS_KEY_ID` environment variable.
478+
*/
479+
accessKeyId?:
480+
| {
481+
/**
482+
* The name of the secret that contains the token.
483+
*/
484+
secret: string;
485+
}
486+
| {
487+
/**
488+
* The name of the environment variable that contains the token. Only supported in declarative connection configs.
489+
*/
490+
env: string;
491+
};
492+
/**
493+
* Optional secret access key to use with the model. Defaults to the `AWS_SECRET_ACCESS_KEY` environment variable.
494+
*/
495+
accessKeySecret?:
496+
| {
497+
/**
498+
* The name of the secret that contains the token.
499+
*/
500+
secret: string;
501+
}
502+
| {
503+
/**
504+
* The name of the environment variable that contains the token. Only supported in declarative connection configs.
505+
*/
506+
env: string;
507+
};
508+
/**
509+
* The AWS region. Defaults to the `AWS_REGION` environment variable.
510+
*/
511+
region?: string;
512+
/**
513+
* Optional base URL.
514+
*/
515+
baseUrl?: string;
516+
}
517+
export interface AnthropicLanguageModel {
518+
/**
519+
* Anthropic Configuration
520+
*/
521+
provider: "anthropic";
522+
/**
523+
* The name of the language model.
524+
*/
525+
model: string;
526+
/**
527+
* Optional display name.
528+
*/
529+
displayName?: string;
530+
/**
531+
* Optional API key to use with the model. Defaults to the `ANTHROPIC_API_KEY` environment variable.
532+
*/
533+
token?:
534+
| {
535+
/**
536+
* The name of the secret that contains the token.
537+
*/
538+
secret: string;
539+
}
540+
| {
541+
/**
542+
* The name of the environment variable that contains the token. Only supported in declarative connection configs.
543+
*/
544+
env: string;
545+
};
546+
/**
547+
* Optional base URL.
548+
*/
549+
baseUrl?: string;
550+
}
551+
export interface GoogleGenerativeAILanguageModel {
552+
/**
553+
* Google Generative AI Configuration
554+
*/
555+
provider: "google-generative-ai";
556+
/**
557+
* The name of the language model.
558+
*/
559+
model: string;
560+
/**
561+
* Optional display name.
562+
*/
563+
displayName?: string;
564+
/**
565+
* Optional API key to use with the model. Defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable.
566+
*/
567+
token?:
568+
| {
569+
/**
570+
* The name of the secret that contains the token.
571+
*/
572+
secret: string;
573+
}
574+
| {
575+
/**
576+
* The name of the environment variable that contains the token. Only supported in declarative connection configs.
577+
*/
578+
env: string;
579+
};
580+
/**
581+
* Optional base URL.
582+
*/
583+
baseUrl?: string;
584+
}

0 commit comments

Comments
 (0)