feat(backend): add office router and agent runtime services
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
37
backend/app/services/agent_runtime/base.py
Normal file
37
backend/app/services/agent_runtime/base.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, AsyncGenerator, Protocol
|
||||
|
||||
from app.models.conversation import Conversation, Message
|
||||
from app.models.user import User
|
||||
|
||||
|
||||
RuntimeName = str
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class RuntimePreparedContext:
|
||||
user: User
|
||||
conversation: Conversation
|
||||
user_message: Message
|
||||
assistant_message: Message
|
||||
raw_message: str
|
||||
full_message: str
|
||||
file_ids: list[str]
|
||||
model_name: str | None
|
||||
memory_context: str | None
|
||||
|
||||
|
||||
class ChatRuntime(Protocol):
|
||||
name: RuntimeName
|
||||
|
||||
async def chat_stream(
|
||||
self,
|
||||
prepared: RuntimePreparedContext,
|
||||
) -> AsyncGenerator[dict[str, Any], None]: ...
|
||||
|
||||
async def chat_once(
|
||||
self,
|
||||
prepared: RuntimePreparedContext,
|
||||
) -> tuple[str, str | None]: ...
|
||||
Reference in New Issue
Block a user