-
Notifications
You must be signed in to change notification settings - Fork 55
LCORE-285: Add LLM check in readines endpoint #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/app/endpoints/health.py
Outdated
| return False | ||
|
|
||
| logger.debug("LLM connection verified - found %d LLM models", len(llm_models)) | ||
| return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this should call the LLM provider's client.providers.retrieve function to actually test the LLM.
This simply returns True if some LLM models have been registered; not that they actually work.
src/app/endpoints/health.py
Outdated
| return False | ||
|
|
||
|
|
||
| def index_is_ready() -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do a similar check for (RAG) index too.
We, Ansible Lightspeed, were planning on contributing our code soon.
src/app/endpoints/health.py
Outdated
| get the list of available models from the configured LlamaStack client. | ||
| """ | ||
| try: | ||
| from client import get_llama_stack_client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not to import at top?
src/app/endpoints/health.py
Outdated
| client = get_llama_stack_client(llama_stack_config) | ||
|
|
||
| # Try to list models to verify LLM connection | ||
| models = client.models.list() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this just list the models, not doing any connection check. It works even when I turned off my WiFi (and the model is remote).
src/app/endpoints/health.py
Outdated
| logger.warning("No LLM models found in available models") | ||
| return False | ||
|
|
||
| logger.debug("LLM connection verified - found %d LLM models", len(llm_models)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You haven't verified a connection only that there are more than zero LLMs registered.
src/app/endpoints/health.py
Outdated
| try: | ||
| llama_stack_config = configuration.llama_stack_configuration | ||
|
|
||
| # TODO: this seems to be an expensive operation (takes 1-2 seconds) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #122
| args = parser.parse_args() | ||
|
|
||
| configuration.load_configuration("lightspeed-stack.yaml") | ||
| configuration.load_configuration(args.config_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay. Finally I won't need to tweak the code 😘
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that should be a separate PR. Let me raise it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already did :D. I'll just rebase here.
manstis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@tisnik can have the final say.
|
@tisnik fixed linting |
tisnik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
Description
Add LLM check in readiness endpoint
Type of change
Related Tickets & Documents
Checklist before requesting a review
Testing