You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
804 B

import bootstrap
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field
from arango_client import arango
from _llm import LLM
from scripts.build_embeddings import get_all_dates
class AnswerFormat(BaseModel):
summary: str = Field(..., description="Concise summary of the talk")
tags: List[str] = Field(..., description="List of relevant tags or keywords")
def summarize_talk(doc: dict, llm: LLM) -> AnswerFormat:
text = doc.get("anforandetext", "")
dates = get_all_dates()
for date in dates:
arango_docs = arango.db.aql.execute(
"""
FOR talk IN talks
FILTER talk.debate == @date
RETURN {'_key': talk._key, 'anforandetext': talk.anforandetext, 'debate': talk.debate}
""", bind_vars={"date": date}
)