Compare commits

...

4 Commits

Author SHA1 Message Date
yisding 06559ed8d7 tighten chroma version to unbreak create-llama 2024-01-24 22:55:55 -08:00
yisding 20770cf89e docs(changeset): fix bugs in Together.AI integration (thanks @Nutlope for reporting) 2024-01-24 22:29:32 -08:00
yisding 980f64cabc change default model to llama 2 7b chat
Probably better performance since we're using the OpenAI compatible
endpoint. Also the model more people will be using.
2024-01-24 22:27:30 -08:00
yisding 6109ca2f1f minor bug fixes with together AI 2024-01-24 22:20:25 -08:00
8 changed files with 46 additions and 17 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"llamaindex": patch
---
fix bugs in Together.AI integration (thanks @Nutlope for reporting)
+1
View File
@@ -1,4 +1,5 @@
apps/docs/i18n
apps/docs/docs/api
pnpm-lock.yaml
lib/
dist/
+1
View File
@@ -23,6 +23,7 @@ const together = new TogetherLLM({
for await (const message of generator) {
process.stdout.write(message.delta);
}
console.log();
const embedding = new TogetherEmbedding();
const vector = await embedding.getTextEmbedding("Hello world!");
console.log("vector:", vector);
+1 -1
View File
@@ -11,7 +11,7 @@
"@qdrant/js-client-rest": "^1.7.0",
"@xenova/transformers": "^2.10.0",
"assemblyai": "^4.0.0",
"chromadb": "^1.7.3",
"chromadb": "~1.7.3",
"file-type": "^18.7.0",
"js-tiktoken": "^1.0.8",
"lodash": "^4.17.21",
@@ -30,7 +30,7 @@ export class OpenAIEmbedding extends BaseEmbedding {
constructor(init?: Partial<OpenAIEmbedding> & { azure?: AzureOpenAIConfig }) {
super();
this.model = OpenAIEmbeddingModelType.TEXT_EMBED_ADA_002;
this.model = init?.model ?? OpenAIEmbeddingModelType.TEXT_EMBED_ADA_002;
this.maxRetries = init?.maxRetries ?? 10;
this.timeout = init?.timeout ?? 60 * 1000; // Default is 60 seconds
+18 -8
View File
@@ -1,16 +1,26 @@
import { OpenAIEmbedding } from "./OpenAIEmbedding";
export class TogetherEmbedding extends OpenAIEmbedding {
override model: string;
constructor(init?: Partial<OpenAIEmbedding>) {
const {
apiKey = process.env.TOGETHER_API_KEY,
additionalSessionOptions = {},
model = "togethercomputer/m2-bert-80M-32k-retrieval",
...rest
} = init ?? {};
if (!apiKey) {
throw new Error("Set Together Key in TOGETHER_API_KEY env variable"); // Tell user to set correct env variable, and not OPENAI_API_KEY
}
additionalSessionOptions.baseURL =
additionalSessionOptions.baseURL ?? "https://api.together.xyz/v1";
super({
apiKey: process.env.TOGETHER_API_KEY,
...init,
additionalSessionOptions: {
...init?.additionalSessionOptions,
baseURL: "https://api.together.xyz/v1",
},
apiKey,
additionalSessionOptions,
model,
...rest,
});
this.model = init?.model ?? "togethercomputer/m2-bert-80M-32k-retrieval";
}
}
+18 -6
View File
@@ -2,13 +2,25 @@ import { OpenAI } from "./LLM";
export class TogetherLLM extends OpenAI {
constructor(init?: Partial<OpenAI>) {
const {
apiKey = process.env.TOGETHER_API_KEY,
additionalSessionOptions = {},
model = "togethercomputer/llama-2-7b-chat",
...rest
} = init ?? {};
if (!apiKey) {
throw new Error("Set Together Key in TOGETHER_API_KEY env variable"); // Tell user to set correct env variable, and not OPENAI_API_KEY
}
additionalSessionOptions.baseURL =
additionalSessionOptions.baseURL ?? "https://api.together.xyz/v1";
super({
...init,
apiKey: process.env.TOGETHER_API_KEY,
additionalSessionOptions: {
...init?.additionalSessionOptions,
baseURL: "https://api.together.xyz/v1",
},
apiKey,
additionalSessionOptions,
model,
...rest,
});
}
}
+1 -1
View File
@@ -174,7 +174,7 @@ importers:
specifier: ^4.0.0
version: 4.0.0
chromadb:
specifier: ^1.7.3
specifier: ~1.7.3
version: 1.7.3(openai@4.20.1)
file-type:
specifier: ^18.7.0