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

Closed
wants to merge 1 commit into 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)

Copy link

@RahulVadisetty91 RahulVadisetty91 left a comment

Choose a reason for hiding this comment

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

i2

You could wrap these calls in try-except blocks to ensure that errors are properly logged and don't crash the app.

try:
success = await orca.run()
except Exception as e:
log.error(f"Error running orchestrator: {str(e)}")
success = False

@CLAassistant
Copy link

CLAassistant commented Oct 25, 2024

CLA assistant check
All committers have signed the CLA.

@fscheu
Copy link
Author

fscheu commented Oct 29, 2024

i2

You could wrap these calls in try-except blocks to ensure that errors are properly logged and don't crash the app.

try: success = await orca.run() except Exception as e: log.error(f"Error running orchestrator: {str(e)}") success = False

Hi @RahulVadisetty91
I'm new to making pull requests, so I wanted to know if I need to apply your comment to advance with the approval.

Regards,
Fede.-

@fscheu fscheu closed this by deleting the head repository Oct 29, 2024
@fscheu
Copy link
Author

fscheu commented Oct 29, 2024

I've seen that the code has been fully rewritten so this PR no longer sense.

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.

3 participants