Compare commits
No commits in common. "7d30ce7100c4eb2a5ce6700c85afc66860db2f74" and "5918411a40387babe55cbb43611963374e499480" have entirely different histories.
7d30ce7100
...
5918411a40
4 changed files with 0 additions and 83 deletions
|
|
@ -1,26 +0,0 @@
|
|||
"""Central, environment-driven configuration for the agent."""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
OLLAMA_MODEL = os.getenv("OLLAMA_MODEL", "llama3.2:3b")
|
||||
OLLAMA_BASE_URL = os.getenv("OLLAMA_BASE_URL", "http://localhost:11434")
|
||||
|
||||
EMBEDDING_MODEL = os.getenv("EMBEDDING_MODEL", "sentence-transformers/all-MiniLM-L6-v2")
|
||||
|
||||
POLICY_DOCS_DIR = Path(os.getenv("POLICY_DOCS_DIR", PROJECT_ROOT / "app" / "data" / "policies"))
|
||||
INDEX_DIR = Path(os.getenv("INDEX_DIR", PROJECT_ROOT / "app" / "data" / "index"))
|
||||
TICKETS_DB_PATH = Path(os.getenv("TICKETS_DB_PATH", PROJECT_ROOT / "app" / "data" / "tickets.db"))
|
||||
|
||||
RAG_TOP_K = int(os.getenv("RAG_TOP_K", "4"))
|
||||
RAG_MAX_REWRITES = int(os.getenv("RAG_MAX_REWRITES", "2"))
|
||||
|
||||
CHUNK_SIZE = int(os.getenv("CHUNK_SIZE", "500"))
|
||||
CHUNK_OVERLAP = int(os.getenv("CHUNK_OVERLAP", "50"))
|
||||
48
app/state.py
48
app/state.py
|
|
@ -1,48 +0,0 @@
|
|||
"""Shared state schemas for the main agent graph and the RAG subgraph."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Optional, TypedDict
|
||||
|
||||
|
||||
class TraceStep(TypedDict):
|
||||
node: str
|
||||
detail: str
|
||||
duration_ms: float
|
||||
|
||||
|
||||
class AgentState(TypedDict, total=False):
|
||||
# Input
|
||||
user_query: str
|
||||
|
||||
# Planning / decomposition (filled by classify_intent)
|
||||
pending_tasks: list[str] # ordered queue of task types still to execute
|
||||
rag_query: str # query to send into the RAG subgraph
|
||||
calc_args: dict[str, Any] # extracted args for leave_balance_calculator
|
||||
ticket_args: dict[str, Any] # extracted args for create_support_ticket
|
||||
is_out_of_scope: bool
|
||||
|
||||
# Intermediate results, keyed by task type
|
||||
results: dict[str, Any]
|
||||
|
||||
# Autonomous escalation flag, set by rag_answer on low-confidence RAG result
|
||||
escalate: bool
|
||||
escalate_reason: str
|
||||
|
||||
# Observability
|
||||
trace: list[TraceStep]
|
||||
|
||||
# Output
|
||||
final_answer: str
|
||||
|
||||
|
||||
class RagState(TypedDict, total=False):
|
||||
query: str
|
||||
original_query: str
|
||||
retries: int
|
||||
max_retries: int
|
||||
docs: list[dict[str, Any]] # [{"content": ..., "source": ..., "score": ...}]
|
||||
relevant: bool
|
||||
answer: str
|
||||
confidence: str # "high" | "low"
|
||||
sources: list[str]
|
||||
trace: list[TraceStep]
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
"""Tiny shared helper for building trace entries used by both graphs and the Streamlit UI."""
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
|
||||
|
||||
def trace_step(state: dict, node: str, detail: str, start: float) -> dict:
|
||||
step = {"node": node, "detail": detail, "duration_ms": round((time.time() - start) * 1000, 1)}
|
||||
return {"trace": state.get("trace", []) + [step]}
|
||||
Loading…
Add table
Reference in a new issue