Skip to content

Commit d88d715

Browse files
committed
Fix ollama client
Use the actual client code to be able to use remote ollama.
1 parent 9a3567b commit d88d715

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

operate/config.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ def initialize_google(self):
8585
def initialize_ollama(self):
8686
if self.ollama_host:
8787
if self.verbose:
88-
print("[Config][initialize_ollama] using cached ollama host")
88+
print("[Config][initialize_ollama] using ollama host", self.ollama_host)
8989
else:
9090
if self.verbose:
9191
print(
9292
"[Config][initialize_ollama] no cached ollama host. Assuming ollama running locally."
9393
)
94-
self.ollama_host = os.getenv("OLLAMA_HOST", None)
95-
model = Client(host=self.ollama_host)
96-
return model
94+
self.ollama_host = os.getenv("OLLAMA_HOST", "http://localhost:11434")
95+
client = Client(host=self.ollama_host)
96+
return client
9797

9898
def initialize_anthropic(self):
9999
if self.anthropic_api_key:

operate/models/apis.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ def call_ollama_llava(messages, model):
565565
print(f"[call_ollama_llava] model {model}")
566566
time.sleep(1)
567567
try:
568-
model = config.initialize_ollama()
568+
client = config.initialize_ollama()
569569
screenshots_dir = "screenshots"
570570
if not os.path.exists(screenshots_dir):
571571
os.makedirs(screenshots_dir)
@@ -592,7 +592,7 @@ def call_ollama_llava(messages, model):
592592
}
593593
messages.append(vision_message)
594594

595-
response = ollama.chat(
595+
response = client.chat(
596596
model=model,
597597
messages=messages,
598598
)

0 commit comments

Comments
 (0)