-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--------- Co-authored-by: leehuwuj <[email protected]>
- Loading branch information
Showing
31 changed files
with
274 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"create-llama": patch | ||
--- | ||
|
||
chore: bump LITS 0.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
templates/components/loaders/typescript/llama_parse/loader.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
templates/components/providers/typescript/anthropic/provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { | ||
ALL_AVAILABLE_ANTHROPIC_MODELS, | ||
Anthropic, | ||
} from "@llamaindex/anthropic"; | ||
import { HuggingFaceEmbedding } from "@llamaindex/huggingface"; | ||
import { Settings } from "llamaindex"; | ||
|
||
export function setupProvider() { | ||
const embedModelMap: Record<string, string> = { | ||
"all-MiniLM-L6-v2": "Xenova/all-MiniLM-L6-v2", | ||
"all-mpnet-base-v2": "Xenova/all-mpnet-base-v2", | ||
}; | ||
Settings.llm = new Anthropic({ | ||
model: process.env.MODEL as keyof typeof ALL_AVAILABLE_ANTHROPIC_MODELS, | ||
}); | ||
Settings.embedModel = new HuggingFaceEmbedding({ | ||
modelType: embedModelMap[process.env.EMBEDDING_MODEL!], | ||
}); | ||
} |
49 changes: 49 additions & 0 deletions
49
templates/components/providers/typescript/azure-openai/provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { OpenAI, OpenAIEmbedding } from "@llamaindex/openai"; | ||
import { Settings } from "llamaindex"; | ||
|
||
export function setupProvider() { | ||
// Map Azure OpenAI model names to OpenAI model names (only for TS) | ||
const AZURE_OPENAI_MODEL_MAP: Record<string, string> = { | ||
"gpt-35-turbo": "gpt-3.5-turbo", | ||
"gpt-35-turbo-16k": "gpt-3.5-turbo-16k", | ||
"gpt-4o": "gpt-4o", | ||
"gpt-4": "gpt-4", | ||
"gpt-4-32k": "gpt-4-32k", | ||
"gpt-4-turbo": "gpt-4-turbo", | ||
"gpt-4-turbo-2024-04-09": "gpt-4-turbo", | ||
"gpt-4-vision-preview": "gpt-4-vision-preview", | ||
"gpt-4-1106-preview": "gpt-4-1106-preview", | ||
"gpt-4o-2024-05-13": "gpt-4o-2024-05-13", | ||
}; | ||
|
||
const azureConfig = { | ||
apiKey: process.env.AZURE_OPENAI_KEY, | ||
endpoint: process.env.AZURE_OPENAI_ENDPOINT, | ||
apiVersion: | ||
process.env.AZURE_OPENAI_API_VERSION || process.env.OPENAI_API_VERSION, | ||
}; | ||
|
||
Settings.llm = new OpenAI({ | ||
model: | ||
AZURE_OPENAI_MODEL_MAP[process.env.MODEL ?? "gpt-35-turbo"] ?? | ||
"gpt-3.5-turbo", | ||
maxTokens: process.env.LLM_MAX_TOKENS | ||
? Number(process.env.LLM_MAX_TOKENS) | ||
: undefined, | ||
azure: { | ||
...azureConfig, | ||
deployment: process.env.AZURE_OPENAI_LLM_DEPLOYMENT, | ||
}, | ||
}); | ||
|
||
Settings.embedModel = new OpenAIEmbedding({ | ||
model: process.env.EMBEDDING_MODEL, | ||
dimensions: process.env.EMBEDDING_DIM | ||
? parseInt(process.env.EMBEDDING_DIM) | ||
: undefined, | ||
azure: { | ||
...azureConfig, | ||
deployment: process.env.AZURE_OPENAI_EMBEDDING_DEPLOYMENT, | ||
}, | ||
}); | ||
} |
16 changes: 16 additions & 0 deletions
16
templates/components/providers/typescript/gemini/provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { | ||
Gemini, | ||
GEMINI_EMBEDDING_MODEL, | ||
GEMINI_MODEL, | ||
GeminiEmbedding, | ||
} from "@llamaindex/google"; | ||
import { Settings } from "llamaindex"; | ||
|
||
export function setupProvider() { | ||
Settings.llm = new Gemini({ | ||
model: process.env.MODEL as GEMINI_MODEL, | ||
}); | ||
Settings.embedModel = new GeminiEmbedding({ | ||
model: process.env.EMBEDDING_MODEL as GEMINI_EMBEDDING_MODEL, | ||
}); | ||
} |
18 changes: 18 additions & 0 deletions
18
templates/components/providers/typescript/groq/provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Groq } from "@llamaindex/groq"; | ||
import { HuggingFaceEmbedding } from "@llamaindex/huggingface"; | ||
import { Settings } from "llamaindex"; | ||
|
||
export function setupProvider() { | ||
const embedModelMap: Record<string, string> = { | ||
"all-MiniLM-L6-v2": "Xenova/all-MiniLM-L6-v2", | ||
"all-mpnet-base-v2": "Xenova/all-mpnet-base-v2", | ||
}; | ||
|
||
Settings.llm = new Groq({ | ||
model: process.env.MODEL!, | ||
}); | ||
|
||
Settings.embedModel = new HuggingFaceEmbedding({ | ||
modelType: embedModelMap[process.env.EMBEDDING_MODEL!], | ||
}); | ||
} |
16 changes: 16 additions & 0 deletions
16
templates/components/providers/typescript/mistral/provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { | ||
ALL_AVAILABLE_MISTRAL_MODELS, | ||
MistralAI, | ||
MistralAIEmbedding, | ||
MistralAIEmbeddingModelType, | ||
} from "@llamaindex/mistral"; | ||
import { Settings } from "llamaindex"; | ||
|
||
export function setupProvider() { | ||
Settings.llm = new MistralAI({ | ||
model: process.env.MODEL as keyof typeof ALL_AVAILABLE_MISTRAL_MODELS, | ||
}); | ||
Settings.embedModel = new MistralAIEmbedding({ | ||
model: process.env.EMBEDDING_MODEL as MistralAIEmbeddingModelType, | ||
}); | ||
} |
16 changes: 16 additions & 0 deletions
16
templates/components/providers/typescript/ollama/provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Ollama, OllamaEmbedding } from "@llamaindex/ollama"; | ||
import { Settings } from "llamaindex"; | ||
|
||
export function setupProvider() { | ||
const config = { | ||
host: process.env.OLLAMA_BASE_URL ?? "http://127.0.0.1:11434", | ||
}; | ||
Settings.llm = new Ollama({ | ||
model: process.env.MODEL ?? "", | ||
config, | ||
}); | ||
Settings.embedModel = new OllamaEmbedding({ | ||
model: process.env.EMBEDDING_MODEL ?? "", | ||
config, | ||
}); | ||
} |
17 changes: 17 additions & 0 deletions
17
templates/components/providers/typescript/openai/provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { OpenAI, OpenAIEmbedding } from "@llamaindex/openai"; | ||
import { Settings } from "llamaindex"; | ||
|
||
export function setupProvider() { | ||
Settings.llm = new OpenAI({ | ||
model: process.env.MODEL ?? "gpt-4o-mini", | ||
maxTokens: process.env.LLM_MAX_TOKENS | ||
? Number(process.env.LLM_MAX_TOKENS) | ||
: undefined, | ||
}); | ||
Settings.embedModel = new OpenAIEmbedding({ | ||
model: process.env.EMBEDDING_MODEL, | ||
dimensions: process.env.EMBEDDING_DIM | ||
? parseInt(process.env.EMBEDDING_DIM) | ||
: undefined, | ||
}); | ||
} |
Oops, something went wrong.