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

Adding Gemini Typescript SDK support methods #85

Merged
merged 2 commits into from
Aug 23, 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
4 changes: 4 additions & 0 deletions src/typescript/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { AnthropicFunctions, AnthropicFunctionNames } from './anthropic';
import { PgFunctionNames, PgFunctions } from './pg';
import { ChromadbFunctionNames, ChromadbFunctions } from './chroma';
import { CohereFunctionNames, CohereFunctions } from './cohere';
import { GeminiFunctionNames, GeminiFunctions } from './gemini';
import { GroqFunctionNames, GroqFunctions } from './groq';
import { LlamaIndexFunctionNames, LlamaIndexFunctions } from './llamaindex';
import { OpenAIFunctionNames, OpenAIFunctions } from './openai';
Expand All @@ -27,6 +28,7 @@ export const Vendors = {
OPENAI: 'openai',
COHERE: 'cohere',
ANTHROPIC: 'anthropic',
GEMINI: 'gemini',
GROQ: 'groq',
PINECONE: 'pinecone',
LLAMAINDEX: 'llamaindex',
Expand All @@ -53,6 +55,7 @@ interface VendorInstrumentationFunctions {
openai: OpenAIFunctions[];
cohere: CohereFunctions[];
anthropic: AnthropicFunctions[];
gemini: GeminiFunctions[];
groq: GroqFunctions[];
pinecone: PineConeFunctions[];
llamaindex: LlamaIndexFunctions[];
Expand All @@ -73,6 +76,7 @@ export const TracedFunctionsByVendor: VendorTracedFunctions = {
pg: PgFunctionNames,
chromadb: ChromadbFunctionNames,
cohere: CohereFunctionNames,
gemini: GeminiFunctionNames,
groq: GroqFunctionNames,
llamaindex: LlamaIndexFunctionNames,
openai: OpenAIFunctionNames,
Expand Down
26 changes: 26 additions & 0 deletions src/typescript/constants/gemini.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 Scale3 Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export const APIS = {
GENERATE_CONTENT: {
METHOD: "gemini.GenerativeModel.generateContent",
},
GENERATE_CONTENT_STREAM: {
METHOD: "gemini.GenerativeModel.generateContentStream",
},
} as const;
export type GeminiFunctions = typeof APIS[keyof typeof APIS]['METHOD']
export const GeminiFunctionNames: GeminiFunctions[] = Object.values(APIS).map((api) => api.METHOD)
4 changes: 3 additions & 1 deletion src/typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { APIS as AnthropicAPIS } from "./constants/anthropic";
import { APIS as PgAPIS } from "./constants/pg";
import { APIS as ChromadbAPIS } from "./constants/chroma";
import { APIS as CohereAPIS } from "./constants/cohere";
import { APIS as GeminiAPIS } from "./constants/gemini";
import { APIS as GroqAPIS } from "./constants/groq";
import { APIS as LlamaIndexAPIS } from "./constants/llamaindex";
import { APIS as OpenAIAPIs } from "./constants/openai";
Expand Down Expand Up @@ -42,6 +43,7 @@ const APIS = {
pg: PgAPIS,
chromadb: ChromadbAPIS,
cohere: CohereAPIS,
gemini: GeminiAPIS,
groq: GroqAPIS,
llamaindex: LlamaIndexAPIS,
openai: OpenAIAPIs,
Expand All @@ -64,4 +66,4 @@ export {
APIS,
TIKTOKEN_MODEL_MAPPING,
queryTypeToFunctionToProps
}
}
4 changes: 2 additions & 2 deletions src/typescript/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 src/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@langtrase/trace-attributes",
"version": "7.1.2",
"version": "7.2.0",
"description": "LangTrace - Trace Attributes",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
Loading