You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
API endpoint to handle user investment-related questions and return AI-generated insights.
51
99
"""
100
+
# Check if request is from a browser or format is explicitly set to html
101
+
accept_header=request.headers.get("accept", "")
102
+
if"text/html"inaccept_header:
103
+
current_year=datetime.datetime.now().year
104
+
example_response= {
105
+
"question": "What are good tech stocks to invest in?",
106
+
"answer": "Some popular tech stocks to consider include Apple (AAPL), Microsoft (MSFT), Google (GOOGL), and Amazon (AMZN). However, you should always do your own research and consider your investment goals and risk tolerance before investing."
107
+
}
108
+
109
+
returntemplates.TemplateResponse(
110
+
"route.html",
111
+
{
112
+
"request": request,
113
+
"route_path": "/chat",
114
+
"method": "GET",
115
+
"full_path": str(request.url).split("?")[0],
116
+
"description": "Chat endpoint that uses Groq's LLaMa model to answer investment questions.",
117
+
"parameters": [
118
+
{"name": "query", "type": "string", "description": "The investment question to ask"},
119
+
{"name": "format", "type": "string", "description": "Response format (html or json)"}
120
+
],
121
+
"example_query": "What are good tech stocks to invest in?",
API endpoint to handle user investment-related questions and return AI-generated insights.
73
148
"""
149
+
# Check if request is from a browser or format is explicitly set to html
150
+
accept_header=request.headers.get("accept", "")
151
+
if"text/html"inaccept_header:
152
+
current_year=datetime.datetime.now().year
153
+
example_response= {
154
+
"question": "Should I invest in index funds?",
155
+
"answer": "Index funds are often a good choice for passive investors looking for broad market exposure with low fees. They offer diversification and typically outperform actively managed funds in the long term. However, the suitability depends on your investment goals, time horizon, and risk tolerance."
156
+
}
157
+
158
+
returntemplates.TemplateResponse(
159
+
"route.html",
160
+
{
161
+
"request": request,
162
+
"route_path": "/agent",
163
+
"method": "GET",
164
+
"full_path": str(request.url).split("?")[0],
165
+
"description": "Agent endpoint that uses a multi-AI system to provide sophisticated investment advice.",
166
+
"parameters": [
167
+
{"name": "query", "type": "string", "description": "The investment question to ask"},
168
+
{"name": "format", "type": "string", "description": "Response format (html or json)"}
169
+
],
170
+
"example_query": "Should I invest in index funds?",
0 commit comments