Skip to content

[JS] ollama embeddings plugin is "misconfigured" #1080

@pavelgj

Description

@pavelgj

Ollama config options have required fields: modelName and serverAddress

* Copyright 2024 Google LLC

which means that those two config options must be provided at call time:

await embed({
  embedder: 'ollama-embedder',
  content: 'foo',
  options: {
    modelName: 'ollama-embedder',
    serverAddress: 'http://localhost:...',
  }
})

(and they are actually unused)

Which is not right. Intended usage is:

export default configureGenkit({
  plugins: [
    ollama({
      embedders: [
        {  name: 'ollama-embedder',  dimensions: 123  },
      ],
      serverAddress: 'http://127.0.0.1:11434', // default local address
    }),
  ],
});

await embed({
  embedder: 'ollama-embedder',
  content: 'foo',
  options: {
    truncate: true,
  }
})

the options are these: https://github.com/ollama/ollama/blob/main/docs/api.md#parameters-7 (sans model name because it's already provided to configureGenkit).

I say OllamaEmbeddingConfigSchema must be .passthrough() (https://zod.dev/?id=passthrough) and we should just pass all extra/unknown options directly to ollama API as is.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingjs

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions