Skip to content

Allow passing timeout to LLM services (for FAILING, not for retry) #3481

@trycatchal

Description

@trycatchal

Problem Statement

Use Case

We just noticed the new'ish LLMSwitcher and started to use it - awesome addition! So we wanted to have timeouts (~2s or so) trigger an error that we could handle in our code to call upon the LLM Switcher to do its thing, but then we noticed that the only way to do this was to either:

  1. Make changes to the private _client member of the LLM processor
  2. Add a bunch of code to monitor and actively interrupt the LLM if it takes too long

Request

We'd like to be able to pass the timeout to the LLM service constructor.

Thanks!
-Al

Proposed Solution

We only use OpenAI-like LLMs so I'm not sure how hard this is to do across all LLM services.

But for OpenAI-like's, we also noticed the timeout can have more granular settings because of the underlying HTTPX timeout settings - bonus points if we can even specify those too!

But honestly, even being able to pass a single timeout that will make it fail at any point in the response if there's >timeout seconds of inactivity would be great.

Alternative Solutions

If it's too tricky to make this work for all LLM Services in a standard way, just exposing the underlying client on a per-llm-service basis

Additional Context

No response

Would you be willing to help implement this feature?

  • Yes, I'd like to contribute
  • No, I'm just suggesting

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