Skip to content

Commit

Permalink
add gemmini 1.5 commands
Browse files Browse the repository at this point in the history
  • Loading branch information
fegloff committed Apr 16, 2024
1 parent 36b20bf commit 147b336
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/modules/llms/api/vertex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const vertexCompletion = async (
model = config.llms.model
): Promise<LlmCompletion> => {
const data = {
model, // chat-bison@001 'chat-bison', //'gpt-3.5-turbo',
model,
stream: false,
messages: conversation.filter(c => c.model === model)
.map((msg) => {
Expand Down
2 changes: 2 additions & 0 deletions src/modules/llms/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export enum SupportedCommands {
pdf = 'pdf',
gemini = 'gemini',
gShort = 'g',
gemini15 = 'gemini15',
g15short = 'g15',
chat = 'chat',
ask = 'ask',
vision = 'vision',
Expand Down
14 changes: 11 additions & 3 deletions src/modules/llms/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum LlmsModelsEnum {
CLAUDE_OPUS = 'claude-3-opus-20240229',
CLAUDE_SONNET = 'claude-3-sonnet-20240229',
CLAUDE_HAIKU = 'claude-3-haiku-20240307',
GEMINI_15 = 'gemini-1.5-pro-latest',
GEMINI = 'gemini-1.0-pro',
GPT_4 = 'gpt-4',
GPT_35_TURBO = 'gpt-3.5-turbo',
Expand Down Expand Up @@ -35,9 +36,16 @@ export const LlmsModels: Record<string, ChatModel> = {
},
'gemini-1.0-pro': {
name: 'gemini-1.0-pro',
inputPrice: 0.00025, // 3.00 (1M Tokens) => 0.003 (1K tokens)
outputPrice: 0.00125,
maxContextTokens: 4096,
inputPrice: 0.000125, // 3.00 (1M Tokens) => 0.003 (1K tokens)
outputPrice: 0.000375,
maxContextTokens: 30720,
chargeType: 'CHAR'
},
'gemini-1.5-pro-latest': {
name: 'gemini-1.5-pro-latest',
inputPrice: 0.0025, // 3.00 (1M Tokens) => 0.003 (1K tokens)
outputPrice: 0.0075,
maxContextTokens: 1048576,
chargeType: 'CHAR'
},
'j2-ultra': {
Expand Down
8 changes: 7 additions & 1 deletion src/modules/llms/vertexBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export class VertexBot extends LlmsBase {
SupportedCommands.bard,
SupportedCommands.bardF,
SupportedCommands.gemini,
SupportedCommands.gShort])
SupportedCommands.gShort,
SupportedCommands.g15short,
SupportedCommands.gemini15])
if (isMentioned(ctx)) {
return true
}
Expand Down Expand Up @@ -83,6 +85,10 @@ export class VertexBot extends LlmsBase {
}
if (ctx.hasCommand([SupportedCommands.gemini, SupportedCommands.gShort]) || (hasGeminiPrefix(ctx.message?.text ?? '') !== '')) {
await this.onChat(ctx, LlmsModelsEnum.GEMINI, true)
return
}
if (ctx.hasCommand([SupportedCommands.gemini15, SupportedCommands.g15short])) {
await this.onChat(ctx, LlmsModelsEnum.GEMINI_15, true)
}
}
}

0 comments on commit 147b336

Please sign in to comment.