Skip to content

Commit

Permalink
Fix Assistant
Browse files Browse the repository at this point in the history
  • Loading branch information
artitw committed Oct 7, 2024
1 parent e8bb2e2 commit d0768e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="text2text",
version="1.6.0",
version="1.6.1",
author="artitw",
author_email="artitw@gmail.com",
description="Text2Text: Crosslingual NLP/G toolkit",
Expand Down
9 changes: 6 additions & 3 deletions text2text/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
from llama_index.core.llms import ChatMessage

def ollama_version():
result = subprocess.check_output(["ollama", "-v"], stderr=subprocess.STDOUT).decode("utf-8")
if result.startswith("ollama version "):
return result.replace("ollama version ", "")
try:
result = subprocess.check_output(["ollama", "-v"], stderr=subprocess.STDOUT).decode("utf-8")
if result.startswith("ollama version "):
return result.replace("ollama version ", "")
except Exception as e:
warnings.warn(str(e))
return ""

class Assistant(object):
Expand Down

0 comments on commit d0768e0

Please sign in to comment.