Cantareus
Cantareus t1_je6vn79 wrote
Reply to comment by Im_Unlucky in [D] The best way to train an LLM on company data by jaxolingo
>shove data into vector db
>
>embed incoming query
>
>return topk matches from vector db
Can these steps be done through the openai API?
You only reply using JSON. Write 5 queries that will return useful data to aid you in answering the users questions "What was Apple’s return compared to it’s sector last month" return in JSON array with no explanations. Each query must run independently. Use the return format [{"Reason":"Why the query is useful","query":"The sql query"}] The schema is:
(Imagine a valid schema is here)
GPT-4 Response:
[
{
"Reason": "Retrieve Apple's stock return last month",
"query": "SELECT stock_return FROM stocks WHERE company = 'Apple' AND date >= DATEADD(month, -1, GETDATE()) AND date < GETDATE();"
},
{
"Reason": "Retrieve sector for Apple",
"query": "SELECT sector FROM companies WHERE company_name = 'Apple';"
},
{
"Reason": "Retrieve companies in Apple's sector",
"query": "SELECT company_name FROM companies WHERE sector = (SELECT sector FROM companies WHERE company_name = 'Apple');"
},
{
"Reason": "Calculate average return for Apple's sector last month",
"query": "SELECT AVG(stock_return) as sector_return FROM stocks WHERE company IN (SELECT company_name FROM companies WHERE sector = (SELECT sector FROM companies WHERE company_name = 'Apple')) AND date >= DATEADD(month, -1, GETDATE()) AND date < GETDATE();"
},
{
"Reason": "Compare Apple's return to the average return of its sector last month",
"query": "SELECT (SELECT stock_return FROM stocks WHERE company = 'Apple' AND date >= DATEADD(month, -1, GETDATE()) AND date < GETDATE()) - (SELECT AVG(stock_return) as sector_return FROM stocks WHERE company IN (SELECT company_name FROM companies WHERE sector = (SELECT sector FROM companies WHERE company_name = 'Apple')) AND date >= DATEADD(month, -1, GETDATE()) AND date < GETDATE()) as comparison;"
}
]
Cantareus t1_je8pk04 wrote
Reply to comment by yaosio in [Discussion] IsItBS: asking GPT to reflect x times will create a feedback loop that causes it to scrutinize itself x times? by RedditPolluter
There's no self-reflecting happening when the request to self-reflect is in the prompt. The improvement happens because the expected output after asking it to self-reflect is a more thought out response. You can get a type of reflecting by pasting the output back into the prompt with your own feedback.