Adding RAG tracing & eval cookbook using Parea (#390)

This commit is contained in:
Joschka Braun
2024-04-30 19:13:28 -04:00
committed by GitHub
parent ba67101f99
commit 5c5aba5900
3 changed files with 531 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ from concurrent.futures import ThreadPoolExecutor
from contextlib import contextmanager
from typing import Any, Callable, Dict, List, Optional, Union
import contextvars
import tqdm
from sglang.global_config import global_config
@@ -218,7 +219,10 @@ class StreamExecutor:
self.use_thread = use_thread
if self.use_thread:
self.queue = queue.Queue()
self.worker = threading.Thread(target=self._thread_worker_func)
def _run_worker_in_context():
self._thread_worker_func()
self.worker = threading.Thread(target=contextvars.copy_context().run, args=(_run_worker_in_context, ))
self.worker.start()
# For streaming