Skip to content

Commit

Permalink
Merge pull request #2 from yodamaster726/ollama-fix
Browse files Browse the repository at this point in the history
Ollama fix
  • Loading branch information
yodamaster726 authored Nov 23, 2024
2 parents b2a947b + c6afcd9 commit d0aed6d
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 @@ -169,6 +169,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 @@ -184,6 +185,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 @@ -671,13 +673,12 @@ export class LlamaService extends Service {
throw new Error("Sequence not initialized");
}

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 d0aed6d

Please sign in to comment.