Files
Anton_wireframe/app/services/__pycache__/querying.cpython-312.pyc
T

27 lines
5.2 KiB
Plaintext
Raw Normal View History

Ë
2025-09-25 17:00:38 +01:00
ÏRÕhŠãóèddlZddlmZddlmZmZddlmZddlm Z ddl
m Z ddl m
Z
ddlmZdd lmZdd
lmZmZdd lmZe j.d «Ze
j2e«ZGd
d«Zy)éN)ÚList)Ú DATABASE_URLÚget_db)Ú
InvestorTable)Úhub)ÚSQLDatabaseToolkit)Ú SQLDatabase)Ú
ChatOpenAI)Úcreate_react_agent)Ú InvestorDataÚ InvestorList)Ú selectinloadz$langchain-ai/sql-agent-system-promptcóNeZdZdZdedefdZdedeefdZ deedefdZ
y )
ÚQueryProcessorcóBttjd«ddd¬«|_t t
|j¬«|_tjdd¬ «d
zd zd zd
z}t|j|j j«|¬«|_ y)OPENROUTER_API_KEYzhttps://openrouter.ai/api/v1zopenai/gpt-5-nanog333333Ó?)Úapi_keyÚbase_urlÚmodelÚ temperature)ÚdbÚllmÚSQLiteé)ÚdialectÚtop_kz^
2025-09-25 17:00:38 +01:00
IMPORTANT: You must ONLY return the investor IDs (id field) that match the user's criteria. z<Do NOT return any other information, explanations, or data. z^Your response should be ONLY a comma-separated list of numbers representing the investor IDs. zExample format: 1, 5, 12, 23)rÚtoolsÚprompt) r
ÚosÚgetenvrrrÚtoolkitÚprompt_templateÚformatr Ú get_toolsÚagent)ÚselfÚsystem_message_updateds úN/home/oluwasanmi/Documents/Work/MKD/anton_wirefram_v2/app/services/querying.pyÚ__init__zQueryProcessor.__init__ÜÜ—I‘IÐô 
ˆŒô *¬R°T·X±XÔ>ˆŒ ô
× "¨8¸ 
qà
Mðoñ
oð
 ô—(‘(Ø—,‘,×
ˆ
óÚquestionÚreturncóÐ|jjdd|fgi«}|jd«r|ddjnd}|j |«}|j |«S)z7Process a query using the LLM and return investor data.ÚmessagesÚuseréÿÿÿÿÚ)r%ÚinvokeÚgetÚcontentÚ#_extract_investor_ids_from_responseÚ_fetch_investors_by_ids)r&r+ÚresponseÚ ai_responseÚ investor_idss r(Ú
process_queryzQueryProcessor.process_query*stð—::×