promptulate icon indicating copy to clipboard operation
promptulate copied to clipboard

Add retry for LLMFactory or BaseLLM

Open Undertone0809 opened this issue 1 month ago • 0 comments

🚀 Feature Request

Add the retry mechanism to increase the robustness of the system because LLM output is unstable and sometimes not output in the specified format if formatted.

import promptulate as pne

model = pne.LLMFactory.build(model_name="gpt-4-turbo", model_config={...}, max_retry=5)
model("hello")

The model must run five times before it finally throws an exception.

Undertone0809 avatar May 07 '24 16:05 Undertone0809