Skip to content

Issue and solution with Ollama provider #5

Description

@benjaminpillot

Hi there,
thank you very much for that awesome package !
For your information, regarding the Ollama provider, when performing title/abstract review, an issue raises with most of the models I have tested (llama3.1, mistral, llama3.2-vision, etc. ), returning a KeyError due to an empty json output. Actually, it seems response_format is given to system prompt in both the _build_system_prompt method (line 98) of the BasicReviewer class and in the get_json_response method of the OllamaProvider class (line 98 to 104), causing some kind of conflict, which results in the model returning schema_str itself rather than a response complying with it.

By commenting the previous lines in get_json_response of the OllamaProvider class (where the system message is actually updated to request JSON object), it eventually works perfectly (the model returns a dict with both reasoning and evaluation score)

I'm not sure why the response format was defined twice in the first place. The JSON format is already given through cleaned_kwargs in get_json_response (line 108) and used as it by the underlying chat method of the AsyncClient class in the _fetch_response protected method. I think the definition is redundant, but do not really see why it would make some of the ollama models (and not all of them --> llama3.2) return schema_str or an empty json object.

System characteristics : Ubuntu 22.04, Python 3.12, CPU/GPU

I hope this feedback will help.

Benjamin

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