|
1 | 1 | import chainlit as cl
|
2 | 2 |
|
3 |
| -query_stock_price_def = { |
4 |
| - "name": "query_stock_price", |
5 |
| - "description": "Queries the latest stock price information for a given stock symbol.", |
| 3 | +give_feedback_on_answer_def = { |
| 4 | + "name": "give_feedback_on_answer", |
| 5 | + "description": "As a Y Combinator partner, provide a short feedback on the answer the user gave to your question. This function shoudl be called after the user has answered a question.", |
6 | 6 | "parameters": {
|
7 | 7 | "type": "object",
|
8 | 8 | "properties": {
|
9 |
| - "symbol": { |
| 9 | + "feedback": { |
10 | 10 | "type": "string",
|
11 |
| - "description": "The stock symbol to query (e.g., 'AAPL' for Apple Inc.)", |
12 |
| - }, |
13 |
| - "period": { |
14 |
| - "type": "string", |
15 |
| - "description": "The time period for which to retrieve stock data (e.g., '1d' for one day, '1mo' for one month)", |
16 |
| - }, |
17 |
| - }, |
18 |
| - "required": ["symbol", "period"], |
19 |
| - }, |
20 |
| -} |
21 |
| - |
22 |
| - |
23 |
| -async def query_stock_price_handler(symbol, period): |
24 |
| - """ |
25 |
| - Queries the latest stock price information for a given stock symbol. |
26 |
| - """ |
27 |
| - try: |
28 |
| - return None |
29 |
| - |
30 |
| - except Exception as e: |
31 |
| - return {"error": str(e)} |
32 |
| - |
33 |
| - |
34 |
| -query_stock_price = (query_stock_price_def, query_stock_price_handler) |
35 |
| - |
36 |
| -draw_plotly_chart_def = { |
37 |
| - "name": "draw_plotly_chart", |
38 |
| - "description": "Draws a Plotly chart based on the provided JSON figure and displays it with an accompanying message.", |
39 |
| - "parameters": { |
40 |
| - "type": "object", |
41 |
| - "properties": { |
42 |
| - "message": { |
43 |
| - "type": "string", |
44 |
| - "description": "The message to display alongside the chart", |
45 |
| - }, |
46 |
| - "plotly_json_fig": { |
47 |
| - "type": "string", |
48 |
| - "description": "A JSON string representing the Plotly figure to be drawn", |
| 11 | + "description": "The feedback to provide to the user", |
49 | 12 | },
|
50 | 13 | },
|
51 |
| - "required": ["message", "plotly_json_fig"], |
| 14 | + "required": ["feedback"], |
52 | 15 | },
|
53 | 16 | }
|
54 | 17 |
|
55 | 18 |
|
56 |
| -async def draw_plotly_chart_handler(message: str, plotly_json_fig): |
57 |
| - fig = None |
58 |
| - elements = [] |
59 |
| - |
60 |
| - await cl.Message(content=message, elements=elements).send() |
61 |
| - |
| 19 | +async def give_feedback_on_answer_handler(feedback): |
| 20 | + print("feedback handler") |
| 21 | + print(feedback) |
| 22 | + await cl.Message(content=feedback).send() |
62 | 23 |
|
63 |
| -draw_plotly_chart = (draw_plotly_chart_def, draw_plotly_chart_handler) |
64 | 24 |
|
| 25 | +give_feedback_on_answer = (give_feedback_on_answer_def, give_feedback_on_answer_handler) |
65 | 26 |
|
66 |
| -# tools = [query_stock_price, draw_plotly_chart] |
67 |
| -# No tools for now |
68 |
| -tools = [] |
| 27 | +tools = [give_feedback_on_answer] |
0 commit comments