Skip to content

Test ollama service with model tags instead of a query#61

Merged
srijanpatel merged 1 commit intoPySpur-Dev:mainfrom
simonwu53:ollama-test
Dec 24, 2024
Merged

Test ollama service with model tags instead of a query#61
srijanpatel merged 1 commit intoPySpur-Dev:mainfrom
simonwu53:ollama-test

Conversation

@simonwu53
Copy link
Copy Markdown
Contributor

@simonwu53 simonwu53 commented Dec 24, 2024

The original script initiate a chat completion query to ollama every time when the backend entry point starts and $OLLAMA_BASE_URL has been set. This is not efficient and has two major drawbacks. First, some users do not use "llama2" because it's relatively weak and obsolete, so ollama has to download the model first and then complete the query, which needs additional disk space for just testing the connection. Second, even with this simple query, ollama has to load the model to memory, initialize the model, then run the query, which cost both time and power.

My modification is simple. In order to test the connection, we could just query available models from ollama. This query can be instantly finished without generating any chat response, thus expediting the launching speed.


Important

Modify test_ollama.sh to test Ollama connection by fetching model list instead of initiating a chat query.

  • Behavior:
    • Changes connection test in test_ollama.sh from initiating a chat completion query to fetching the model list from Ollama.
    • Avoids downloading and loading the "llama2" model, saving disk space and resources.
  • Efficiency:
    • Expedites launch speed by eliminating the need to generate a chat response.
    • Reduces time and power consumption by not loading models into memory.

This description was created by Ellipsis for 254073b. It will automatically update as commits are pushed.

Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 254073b in 9 seconds

More details
  • Looked at 23 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. backend/test_ollama.sh:26
  • Draft comment:
    Consider adding an else block to handle the case where OLLAMA_BASE_URL is not set, providing feedback to the user.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The current implementation does not handle the case where OLLAMA_BASE_URL is not set. It should provide feedback to the user in such cases.

Workflow ID: wflow_8oNXOe49tIV8vl7S


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@srijanpatel
Copy link
Copy Markdown
Collaborator

Nice catch! Thanks for the PR @simonwu53
Merging it now.

@srijanpatel srijanpatel merged commit 2b85f73 into PySpur-Dev:main Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants