Design and implement LLM execution strategy and error handling
Currently, our simulation executes conversations sequentially and processes intent extraction one by one, which is inefficient. More importantly, we need to establish project-wide standards for LLM interactions.
Current Issues
- Sequential execution limits throughput
- No standardized approach to LLM error handling
- No strategy for rate limit management
- No retry policies for failed LLM calls
- Intent extraction processed individually
Key Decisions Needed
-
Execution Strategy: How should we handle concurrent LLM calls?
- Conversation-level parallelism
- Batch processing for intent extraction and other similar cases. In those cases we can leverage langchain's batch methods. Should we use them, or use a general solution for conversation-level parallelism and simple LLM calls batches
-
Error Handling: How should we handle LLM failures?
- Graceful degradation strategies
- Error classification and response
- Max retries
-
Rate Limiting: How should we manage API rate limits?
- Is there a built in way in Langchain?
- Backoff strategies - simple exponential, or more sophisticated strategy of taking into account the delay recommended in the error message
@leonidb what's left to do here, after our last talk?
@danarmak I'd like to make the outcome detection and intent extraction also parallel. We can add a batch method to it, like in AdverserialTester, and use langchain abatch.
In general I'd like to use the same parameter for parallelism between conversation runner and all batch operations. I mean if we allow 10 parallel executions, then have outcome detection/intent extraction/adverserial test also use the same level of parallelism.
What do you think?
That makes sense!