Skip to content

Commit 7e7a3c6

Browse files
Added specific table format to get response
1 parent db8941e commit 7e7a3c6

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

ClientAdvisor/AzureFunction/function_app.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,21 @@ async def stream_openai_text(req: Request) -> StreamingResponse:
259259
settings.max_tokens = 800
260260
settings.temperature = 0
261261

262+
# Read the HTML file
263+
with open("table.html", "r") as file:
264+
html_content = file.read()
265+
262266
system_message = '''you are a helpful assistant to a wealth advisor.
263267
Do not answer any questions not related to wealth advisors queries.
264268
If the client name and client id do not match, only return - Please only ask questions about the selected client or select another client to inquire about their details. do not return any other information.
265269
Only use the client name returned from database in the response.
266270
If you cannot answer the question, always return - I cannot answer this question from the data available. Please rephrase or add more details.
267271
** Remove any client identifiers or ids or numbers or ClientId in the final response.
272+
For any questions requiring a table, always render the table using the following HTML format:
268273
'''
274+
275+
# Make sure you have the system prompt always at the end to append the html content.
276+
system_message += html_content
269277

270278
user_query = query.replace('?',' ')
271279

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Include the table here -->
2+
<table style="border: 1px solid #C8C6C4; width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 1em; font-family: Segoe UI">
3+
<tr>
4+
<th style="background-color: #F3F2F1; padding: 12px 15px; border: 1px solid #ddd; text-align: left;">Header 1</th>
5+
<th style="background-color: #F3F2F1; padding: 12px 15px; border: 1px solid #ddd; text-align: left;">Header 2</th>
6+
</tr>
7+
<tr>
8+
<td style="padding: 12px 15px; border: 1px solid #ddd; text-align: left; color:#797775;">Data 1</td>
9+
<td style="padding: 12px 15px; border: 1px solid #ddd; text-align: left; color:#797775;">Data 2</td>
10+
</tr>
11+
</table>

0 commit comments

Comments
 (0)