Skip to content

Commit 034227b

Browse files
committed
Fix ollama client
Use the actual client code to be able to use remote ollama.
1 parent 4b50d62 commit 034227b

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
@@ -563,7 +563,7 @@ def call_ollama_llava(messages):
563563
print("[call_ollama_llava]")
564564
time.sleep(1)
565565
try:
566-
model = config.initialize_ollama()
566+
client = config.initialize_ollama()
567567
screenshots_dir = "screenshots"
568568
if not os.path.exists(screenshots_dir):
569569
os.makedirs(screenshots_dir)
@@ -590,7 +590,7 @@ def call_ollama_llava(messages):
590590
}
591591
messages.append(vision_message)
592592

593-
response = model.chat(
593+
response = client.chat(
594594
model="llava",
595595
messages=messages,
596596
)

0 commit comments

Comments
 (0)