Skip to content

ollama not working without some api_key #261

@fbnrst

Description

@fbnrst

You have a local ollama server running and initialize bia-bob:

from bia_bob import bob
bob.initialize(endpoint='ollama', model='gemma3:4b')

Then %bob will not work:

%bob load blobs.tif and show it
---------------------------------------------------------------------------

OpenAIError                               Traceback (most recent call last)

[/tmp/ipython-input-298324625.py](https://localhost:8080/#) in <cell line: 0>()
----> 1 get_ipython().run_line_magic('bob', 'load blobs.tif and show it')

5 frames

[/usr/local/lib/python3.11/dist-packages/openai/_client.py](https://localhost:8080/#) in __init__(self, api_key, organization, project, webhook_secret, base_url, websocket_base_url, timeout, max_retries, default_headers, default_query, http_client, _strict_response_validation)
    128             api_key = os.environ.get("OPENAI_API_KEY")
    129         if api_key is None:
--> 130             raise OpenAIError(
    131                 "The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable"
    132             )

OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

workaround that I used in #255

from bia_bob import bob
bob.initialize(endpoint='ollama', model='gemma3:4b', api_key='') # set api_key to anything

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions