add: worksop entry & end date for events/workshops & summary change
This commit is contained in:
19
agent.py
19
agent.py
@@ -4,9 +4,9 @@ from pydantic_ai.providers.ollama import OllamaProvider
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
import json
|
||||
from prompts import OPPORTUNITY_PROMPT, EVENT_PROMPT
|
||||
from prompts import OPPORTUNITY_PROMPT, EVENT_PROMPT, WORKSHOP_PROMPT
|
||||
|
||||
load_dotenv()
|
||||
load_dotenv(override=True)
|
||||
|
||||
ollama_url = os.getenv("OLLAMA_BASE_URL")
|
||||
|
||||
@@ -34,6 +34,14 @@ event_agent = Agent(
|
||||
retries=5
|
||||
)
|
||||
|
||||
# --- WORKSHOP AGENT ---
|
||||
workshop_agent = Agent(
|
||||
model,
|
||||
output_type=str,
|
||||
system_prompt=WORKSHOP_PROMPT,
|
||||
retries=5
|
||||
)
|
||||
|
||||
async def parse_page(content: str, entry_type: str = "opportunity"):
|
||||
"""
|
||||
Parse content and extract entry data based on type.
|
||||
@@ -43,7 +51,12 @@ async def parse_page(content: str, entry_type: str = "opportunity"):
|
||||
entry_type: Either 'opportunity' or 'event'
|
||||
"""
|
||||
# Select the appropriate agent
|
||||
agent = opportunity_agent if entry_type == "opportunity" else event_agent
|
||||
if entry_type == "opportunity":
|
||||
agent = opportunity_agent
|
||||
elif entry_type == "event":
|
||||
agent = event_agent
|
||||
else:
|
||||
agent = workshop_agent
|
||||
|
||||
# 1. Run the agent (which returns a string)
|
||||
print(f"[DEBUG] Generating {entry_type}...")
|
||||
|
||||
Reference in New Issue
Block a user