mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 12:49:06 +00:00
feat: llm retries (#739)
* llm retries no-mistakes * self-review (no-mistakes) * self-review (no-mistakes) * bigger retry intervals by default * tests and dry * restore to main state * parse retries * json retries (no-mistakes) * json retries (no-mistakes) * json retries (no-mistakes) * json retries (no-mistakes) self-review * additional network retry test * more lindt --------- Co-authored-by: Igor Loskutov <igor.loskutoff@gmail.com>
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
import asyncio
|
||||
import functools
|
||||
from uuid import uuid4
|
||||
|
||||
from celery import current_task
|
||||
|
||||
from reflector.db import get_database
|
||||
from reflector.llm import llm_session_id
|
||||
|
||||
|
||||
def asynctask(f):
|
||||
@functools.wraps(f)
|
||||
def wrapper(*args, **kwargs):
|
||||
async def run_with_db():
|
||||
task_id = current_task.request.id if current_task else None
|
||||
llm_session_id.set(task_id or f"random-{uuid4().hex}")
|
||||
database = get_database()
|
||||
await database.connect()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user