How do I define the 'base_url' using embeddings() #41

Closed
opened 2026-02-15 16:27:39 -05:00 by yindo · 2 comments
Owner

Originally created by @pandego on GitHub (Feb 28, 2024).

Hello, this might be extremely basic, but when I try to run the following command:

result = ollama.embeddings(
        model="nomic-embed-text", 
        prompt=prompt, 
        base_url="http://10.1.8.100:11434",
        )

I get the following unexpected argument base_url:

result = ollama.embeddings(
         ^^^^^^^^^^^^^^^^^^
TypeError: Client.embeddings() got an unexpected keyword argument 'base_url'

What am I missing? 🥲 Thanks!

Originally created by @pandego on GitHub (Feb 28, 2024). Hello, this might be extremely basic, but when I try to run the following command: ``` result = ollama.embeddings( model="nomic-embed-text", prompt=prompt, base_url="http://10.1.8.100:11434", ) ``` I get the following unexpected argument `base_url`: ``` result = ollama.embeddings( ^^^^^^^^^^^^^^^^^^ TypeError: Client.embeddings() got an unexpected keyword argument 'base_url' ``` What am I missing? 🥲 Thanks!
yindo closed this issue 2026-02-15 16:27:39 -05:00
Author
Owner

@mxyng commented on GitHub (Feb 28, 2024):

The module level client is intended for quick integration using default client configurations. If you want to change things like base_url, you need to instantiate a new client

client = ollama.Client(base_url="http://10.1.8.100:11434")
client.embeddings(...)

Alternatively, you can use the module-level client and set base URL with OLLAMA_HOST

$ export OLLAMA_HOST=10.1.8.0
$ python -c 'import ollama; ollama.embeddings(...)'
@mxyng commented on GitHub (Feb 28, 2024): The module level client is intended for quick integration using default client configurations. If you want to change things like `base_url,` you need to instantiate a new client ```python client = ollama.Client(base_url="http://10.1.8.100:11434") client.embeddings(...) ``` Alternatively, you can use the module-level client and set base URL with `OLLAMA_HOST` ``` $ export OLLAMA_HOST=10.1.8.0 $ python -c 'import ollama; ollama.embeddings(...)' ```
Author
Owner

@alexiewx commented on GitHub (Feb 22, 2025):

@mxyng tks ! it works for me .

@alexiewx commented on GitHub (Feb 22, 2025): @mxyng tks ! it works for me .
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ollama/ollama-python#41