Consultas de stock
El uso de este flujo es actuar como un experto en finanzas para responder preguntas sobre los mercados. Utiliza un agente que, ante una solicitud de acciones, accede a datos de Yahoo Finance y luego usa esa información para generar una respuesta precisa.
+2
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
Prompt-sistq[<div><img src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Prompt]
style Prompt-sistq stroke:#a170ff
ChatInput-s9apd[<div><img src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Entrada de Usuario]
style ChatInput-s9apd stroke:#a170ff
Prompt-3ogxb[<div><img src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Prompt]
style Prompt-3ogxb stroke:#a170ff
OpenAIModel-kp0l0[<div><img src="/_astro/openAI.BhmuxEs3.svg" style="height: 20px !important;width: 20px !important"/></div>Analizador de Intención]
style OpenAIModel-kp0l0 stroke:#a170ff
OpenAIModel-712yx[<div><img src="/_astro/openAI.BhmuxEs3.svg" style="height: 20px !important;width: 20px !important"/></div>Generador de Respuesta]
style OpenAIModel-712yx stroke:#a170ff
Prompt-3y0vr[<div><img src="/_astro/square-terminal.BMOXc-nZ.svg" style="height: 20px !important;width: 20px !important"/></div>Constructor de Respuesta Final]
style Prompt-3y0vr stroke:#a170ff
ChatOutput-up1u4[<div><img src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Output]
style ChatOutput-up1u4 stroke:#a170ff
OpenAIModel-o282l[<div><img src="/_astro/openAI.BhmuxEs3.svg" style="height: 20px !important;width: 20px !important"/></div>OpenAI]
style OpenAIModel-o282l stroke:#a170ff
YFinanceToolComponent-zoqeh[<div><img src="/_astro/badge-euro.b_yZ5I36.svg" style="height: 20px !important;width: 20px !important"/></div>YFinance Tool]
style YFinanceToolComponent-zoqeh stroke:#a170ff
AdvancedAgent-n79by[Agent]
style AdvancedAgent-n79by stroke:#a170ff
OpenAIModel-712yx -.- ChatOutput-up1u4
linkStyle 0 stroke:#a170ff
Prompt-3y0vr -.- OpenAIModel-712yx
linkStyle 1 stroke:#a170ff
Prompt-sistq -.- OpenAIModel-kp0l0
linkStyle 2 stroke:#a170ff
ChatInput-s9apd -.- Prompt-sistq
linkStyle 3 stroke:#a170ff
ChatInput-s9apd -.- Prompt-3y0vr
linkStyle 4 stroke:#a170ff
OpenAIModel-kp0l0 -.- Prompt-3ogxb
linkStyle 5 stroke:#a170ff
AdvancedAgent-n79by -.- Prompt-3y0vr
linkStyle 6 stroke:#a170ff
Prompt-3ogxb -.- AdvancedAgent-n79by
linkStyle 7 stroke:#a170ff
YFinanceToolComponent-zoqeh -.- AdvancedAgent-n79by
linkStyle 8 stroke:#a170ff
OpenAIModel-o282l -.- AdvancedAgent-n79by
linkStyle 9 stroke:#a170ff
Consultas de stock
🧩 Overview
This workflow automates the process of answering user questions about stock market data. It functions as a specialized financial assistant by intelligently extracting stock tickers from a user's query, retrieving real-time financial information using a dedicated tool, and generating a comprehensive, data-driven response. The process streamlines financial research by combining automated data fetching with contextual AI analysis.
⚙️ Main Features
- Automatically identifies and extracts stock ticker symbols from a user's natural language query.
- Retrieves up-to-date financial data, such as news and market information, directly from Yahoo Finance.
- Employs an intelligent agent to analyze the user's request and decide how to use the financial data tool.
- Synthesizes the raw financial data with the original user question to produce a clear, informative, and final answer.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Chat Input | Captures the initial user question or request. | User's text message | User Message |
| Prompt (Ticker Extraction) | Constructs a specialized instruction to identify stock tickers within the user's message. | User Message | Ticker Extraction Prompt |
| OpenAI Model (Intention Analyzer) | Analyzes the prompt to extract and list the relevant stock ticker symbols mentioned by the user. | Ticker Extraction Prompt | List of Extracted Tickers |
| Prompt (Agent Specialist) | Builds the system instructions for a financial expert agent, incorporating the list of identified tickers. | List of Extracted Tickers | Agent Specialist Prompt |
| YFinance Tool | Provides the capability to fetch real-world financial data (e.g., news, prices) for a given stock symbol. | Stock Symbol, Information Type | Financial Data Tool |
| OpenAI Model (Agent LLM) | Serves as the core language model that powers the decision-making of the intelligent agent. | (Model Configuration) | Language Model Instance |
| Agent | The central coordinator that receives the user's financial question, decides to use the YFinance tool, and processes the retrieved data. | Agent Specialist Prompt, Language Model Instance, Financial Data Tool | Processed Financial Data |
| Prompt (Final Response Constructor) | Combines the original user task with the processed financial data to create a final, context-rich instruction for answer generation. | User Message, Processed Financial Data | Final Answer Prompt |
| OpenAI Model (Response Generator) | Generates the final, polished answer for the user based on the contextual prompt containing both the question and the financial data. | Final Answer Prompt | Generated Answer Text |
| Chat Output | Delivers the final generated answer back to the user interface. | Generated Answer Text | Displayed Message |
🧠 Notes
- The workflow is specifically designed for queries related to stock market symbols and relies on the Yahoo Finance API for data.
- The accuracy of the initial ticker extraction is crucial for the subsequent data retrieval steps.
- The agent component manages the interaction with the data tool, allowing for flexible handling of different types of financial queries.
- The final response is synthesized from both the original user intent and the factual data obtained, ensuring answers are relevant and informative.