Skip to content

Commit

Permalink
fix: ollamaModel already defined
Browse files Browse the repository at this point in the history
fix: ollamaModel already defined
  • Loading branch information
yodamaster726 committed Nov 23, 2024
1 parent 3e4cb1e commit c6afcd9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/plugin-node/src/services/llama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export class LlamaService extends Service {
private ctx: LlamaContext | undefined;
private sequence: LlamaContextSequence | undefined;
private modelUrl: string;
private ollamaModel: string | undefined;

private messageQueue: QueuedMessage[] = [];
private isProcessing: boolean = false;
Expand All @@ -179,6 +180,7 @@ export class LlamaService extends Service {
"https://huggingface.co/NousResearch/Hermes-3-Llama-3.1-8B-GGUF/resolve/main/Hermes-3-Llama-3.1-8B.Q8_0.gguf?download=true";
const modelName = "model.gguf";
this.modelPath = path.join(__dirname, modelName);
this.ollamaModel = process.env.OLLAMA_MODEL;
}

async initialize(runtime: IAgentRuntime): Promise<void> {}
Expand Down Expand Up @@ -486,13 +488,12 @@ export class LlamaService extends Service {
throw new Error("Model not initialized. Call initialize() first.");
}

const ollamaModel = process.env.OLLAMA_MODEL;
const ollamaUrl =
process.env.OLLAMA_SERVER_URL || "http://localhost:11434";
const embeddingModel =
process.env.OLLAMA_EMBEDDING_MODEL || "mxbai-embed-large";
elizaLogger.info(
`Using Ollama API for embeddings with model ${embeddingModel} (base: ${ollamaModel})`
`Using Ollama API for embeddings with model ${embeddingModel} (base: ${this.ollamaModel})`
);

const response = await fetch(`${ollamaUrl}/api/embeddings`, {
Expand Down

0 comments on commit c6afcd9

Please sign in to comment.