Skip to content
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

Adding llm provider to set when is checked to not repeat the same check #1082

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fscheu
Copy link

@fscheu fscheu commented Aug 11, 2024

The function llm_api_check inside core\cli\main.py checks if the configured LLMs are reachable.
As some LLM could be repeated in the configuration, there is a set variable to check if the LLM was already checked, but inside the for loop, the code never add the LLM to the set when is checked.
The last line is what I'm adding in this PR

    checked_llms: set[LLMProvider] = set()
    for llm_config in config.all_llms():
        if llm_config.provider in checked_llms:
            continue

        client_class = BaseLLMClient.for_provider(llm_config.provider)
        llm_client = client_class(llm_config, stream_handler=handler, error_handler=handler)
        try:
            resp = await llm_client.api_check()
            if not resp:
                success = False
                log.warning(f"API check for {llm_config.provider.value} failed.")
            else:
                log.info(f"API check for {llm_config.provider.value} succeeded.")
                checked_llms.add(llm_config.provider)

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.

1 participant