Spaces:
Runtime error
Runtime error
abtsousa commited on
Commit ·
1a1f4af
1
Parent(s): 685c55c
Add agent module with configuration and state management
Browse files- agent/__init__.py +11 -0
- agent/config.py +17 -0
- agent/state.py +6 -0
agent/__init__.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .agent import get_agent
|
| 2 |
+
from .config import create_agent_config
|
| 3 |
+
from .prompts import (
|
| 4 |
+
DEFAULT_PROMPT
|
| 5 |
+
)
|
| 6 |
+
|
| 7 |
+
__all__ = [
|
| 8 |
+
"get_agent",
|
| 9 |
+
"create_agent_config",
|
| 10 |
+
"DEFAULT_PROMPT"
|
| 11 |
+
]
|
agent/config.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Literal
|
| 2 |
+
|
| 3 |
+
def create_agent_config(app_name: str) -> dict:
|
| 4 |
+
"""
|
| 5 |
+
Create configuration for the agent.
|
| 6 |
+
|
| 7 |
+
Args:
|
| 8 |
+
app_name: Name of the application
|
| 9 |
+
|
| 10 |
+
Returns:
|
| 11 |
+
Configuration dictionary for the agent
|
| 12 |
+
"""
|
| 13 |
+
return {
|
| 14 |
+
"configurable": {
|
| 15 |
+
"app_name": app_name
|
| 16 |
+
}
|
| 17 |
+
}
|
agent/state.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Literal, TypedDict, Sequence, Annotated
|
| 2 |
+
from langgraph.graph import add_messages
|
| 3 |
+
from langchain_core.messages import BaseMessage
|
| 4 |
+
|
| 5 |
+
class State(TypedDict):
|
| 6 |
+
messages: Annotated[Sequence[BaseMessage], add_messages]
|