tyro configurable
This commit is contained in:
@@ -9,12 +9,17 @@ import time
|
|||||||
import json
|
import json
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
import tyro
|
||||||
|
|
||||||
# Ensure we can import from project root
|
# Ensure we can import from project root
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
from lang_agent.pipeline import Pipeline, PipelineConfig
|
from lang_agent.pipeline import Pipeline, PipelineConfig
|
||||||
|
|
||||||
|
# Initialize Pipeline once
|
||||||
|
pipeline_config = tyro.cli(PipelineConfig)
|
||||||
|
pipeline:Pipeline = pipeline_config.setup()
|
||||||
|
|
||||||
|
|
||||||
class DSMessage(BaseModel):
|
class DSMessage(BaseModel):
|
||||||
role: str
|
role: str
|
||||||
@@ -43,11 +48,6 @@ app.add_middleware(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Initialize Pipeline once
|
|
||||||
pipeline_config = PipelineConfig()
|
|
||||||
pipeline:Pipeline = pipeline_config.setup()
|
|
||||||
|
|
||||||
|
|
||||||
def sse_chunks_from_text(full_text: str, response_id: str, model: str = "qwen-flash", chunk_size: int = 1000):
|
def sse_chunks_from_text(full_text: str, response_id: str, model: str = "qwen-flash", chunk_size: int = 1000):
|
||||||
created_time = int(time.time())
|
created_time = int(time.time())
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,17 @@ import time
|
|||||||
import json
|
import json
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
import tyro
|
||||||
|
|
||||||
# Ensure we can import from project root
|
# Ensure we can import from project root
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
from lang_agent.pipeline import Pipeline, PipelineConfig
|
from lang_agent.pipeline import Pipeline, PipelineConfig
|
||||||
|
|
||||||
|
# Initialize Pipeline once
|
||||||
|
pipeline_config = tyro.cli(PipelineConfig)
|
||||||
|
pipeline:Pipeline = pipeline_config.setup()
|
||||||
|
|
||||||
|
|
||||||
class DSMessage(BaseModel):
|
class DSMessage(BaseModel):
|
||||||
role: str
|
role: str
|
||||||
@@ -43,11 +48,6 @@ app.add_middleware(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Initialize Pipeline once
|
|
||||||
pipeline_config = PipelineConfig()
|
|
||||||
pipeline:Pipeline = pipeline_config.setup()
|
|
||||||
|
|
||||||
|
|
||||||
def sse_chunks_from_stream(chunk_generator, response_id: str, model: str = "qwen-flash"):
|
def sse_chunks_from_stream(chunk_generator, response_id: str, model: str = "qwen-flash"):
|
||||||
"""
|
"""
|
||||||
Stream chunks from pipeline and format as SSE.
|
Stream chunks from pipeline and format as SSE.
|
||||||
|
|||||||
Reference in New Issue
Block a user