monarch-initiative / curate-gpt

LLM-driven curation assist tool (pre-alpha)
https://monarch-initiative.github.io/curate-gpt/
BSD 3-Clause "New" or "Revised" License
49 stars 11 forks source link

Added documentation on using other models via litellm. #16

Closed cmungall closed 5 months ago

cmungall commented 6 months ago

See also #15

justaddcoffee commented 6 months ago

possibly out of scope for this PR, but it looks GH actions is using python 3.8 here when the project requires python 3.9 or better

caufieldjh commented 6 months ago

With some of these models there may be no response, which causes errors. I got the following with the example question and collection, but with the phi model through ollama:

DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 0.0.0.0:8000
DEBUG:urllib3.connectionpool:http://0.0.0.0:8000 "POST /chat/completions HTTP/1.1" 200 None
DEBUG:openai:message='OpenAI API response' path=http://0.0.0.0:8000/chat/completions processing_ms=None request_id=None response_code=200
Traceback (most recent call last):
  File "/home/harry/curate-gpt/.venv/bin/curategpt", line 6, in <module>
    sys.exit(main())
  File "/home/harry/curate-gpt/.venv/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/harry/curate-gpt/.venv/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/harry/curate-gpt/.venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/harry/curate-gpt/.venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/harry/curate-gpt/.venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/harry/curate-gpt/src/curate_gpt/cli.py", line 1250, in ask
    response = chatbot.chat(query, collection=collection, conversation=conversation)
  File "/home/harry/curate-gpt/src/curate_gpt/agents/chat_agent.py", line 143, in chat
    response_text = response.text()
  File "/home/harry/curate-gpt/.venv/lib/python3.10/site-packages/llm/models.py", line 112, in text
    self._force()
  File "/home/harry/curate-gpt/.venv/lib/python3.10/site-packages/llm/models.py", line 106, in _force
    list(self)
  File "/home/harry/curate-gpt/.venv/lib/python3.10/site-packages/llm/models.py", line 91, in __iter__
    for chunk in self.model.execute(
  File "/home/harry/curate-gpt/.venv/lib/python3.10/site-packages/llm/default_plugins/openai_models.py", line 292, in execute
    response.response_json = combine_chunks(chunks)
  File "/home/harry/curate-gpt/.venv/lib/python3.10/site-packages/llm/default_plugins/openai_models.py", line 413, in combine_chunks
    content += choice["delta"]["content"]
TypeError: can only concatenate str (not "NoneType") to str

Just need a fix to make that more obvious. Preferences on whether to put that in its own PR?

caufieldjh commented 6 months ago

I get this same issue with mistral-7B

caufieldjh commented 6 months ago

I think the ollama run command may not be necessary if the ollama server is already running though