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

Rohit/s3 en 2471 add vercel sdk constants #70

Merged
merged 9 commits into from
Jul 23, 2024
32 changes: 32 additions & 0 deletions src/typescript/constants/ai.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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_TEXT: {
METHOD: 'ai.generateText',
},
STREAM_TEXT: {
METHOD: 'ai.streamText',
},
EMBED: {
METHOD: 'ai.embed',
},
EMBED_MANY: {
METHOD: 'ai.embedMany',
}
} as const
export type VercelAIFunctions = typeof APIS[keyof typeof APIS]['METHOD']
export const VercelAIFunctionNames: VercelAIFunctions[] = Object.values(APIS).map((api) => api.METHOD)
4 changes: 4 additions & 0 deletions src/typescript/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { QdrantFunctionNames, QdrantFunctions } from './qdrant'
import { WeaviateFunctionNames, WeaviateFunctions } from './weaviate'
import { TiktokenModel, TiktokenEncoding } from 'tiktoken'
import { OllamaFunctionNames, OllamaFunctions } from './ollama'
import { VercelAIFunctionNames, VercelAIFunctions } from './ai'

export const LLMSpanAttributeNames: Array<keyof typeof LLMSpanAttributesObj> = Object.keys(LLMSpanAttributesObj) as Array<keyof typeof LLMSpanAttributesObj>
export const DatabaseSpanAttributeNames: Array<keyof typeof DatabaseSpanAttributesObj> = Object.keys(DatabaseSpanAttributesObj) as Array<keyof typeof DatabaseSpanAttributesObj>
Expand All @@ -30,6 +31,7 @@ export const Vendors = {
QDRANT: 'qdrant',
WEAVIATE: 'weaviate',
PG: 'pg',
VERCEL: 'ai',
OLLAMA: 'ollama'
} as const

Expand All @@ -55,6 +57,7 @@ interface VendorInstrumentationFunctions {
qdrant: QdrantFunctions[]
weaviate: WeaviateFunctions[]
pg: PgFunctions[],
ai: VercelAIFunctions[],
ollama: OllamaFunctions[]
}

Expand All @@ -75,6 +78,7 @@ export const TracedFunctionsByVendor: VendorTracedFunctions = {
pinecone: PineConeFunctionNames,
qdrant: QdrantFunctionNames,
weaviate: WeaviateFunctionNames,
ai: VercelAIFunctionNames,
ollama: OllamaFunctionNames
} as const

Expand Down
2 changes: 2 additions & 0 deletions src/typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { APIS as LlamaIndexAPIS } from "./constants/llamaindex";
import { APIS as OpenAIAPIs } from "./constants/openai";
import { APIS as PineConeAPIS } from "./constants/pinecone";
import { APIS as QdrantAPIS } from "./constants/qdrant";
import { APIS as vercelAIAPIS } from "./constants/ai";
import { APIS as ollamaAPIS } from "./constants/ollama";
import { queryTypeToFunctionToProps } from "./constants/weaviate";
import { TIKTOKEN_MODEL_MAPPING } from "./constants/common";
Expand Down Expand Up @@ -46,6 +47,7 @@ const APIS = {
openai: OpenAIAPIs,
pinecone: PineConeAPIS,
qdrant: QdrantAPIS,
ai: vercelAIAPIS,
ollama: ollamaAPIS
}
export {
Expand Down
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": "6.0.5",
"version": "6.0.6",
"description": "LangTrace - Trace Attributes",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
Loading