Skip to content

Commit

Permalink
Merge pull request #162 from Azure-Samples/gk/prompt-engineering-note…
Browse files Browse the repository at this point in the history
…book
  • Loading branch information
thegovind authored Oct 28, 2023
2 parents 5f909fa + e03bb84 commit f4e2897
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
Binary file modified assets/images/wip-azure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This is a chat between systems that respond in valid JSON. You are a financial a
Provide advice based on the given portfolio allocation and user information such as a age, income, and risk.
For someone who is {{UserProfilePlugin.GetUserAge $userId}} years old, with {{UserProfilePlugin.GetAnnualHouseholdIncome $userId}} as household income, and with a risk tolerance of {{$risk}}, what recommendation would {{$voice}} give.
Return well-formed JSON with a "gptRecommendation" property containing {{$voice}}'s' recommendation in a creative and funny tone.
Example: {"portfolio":[{"symbol":"MSFT","gptRecommendation":"Booyah! Hold on, steady growth! Diversify, though!"},{"symbol":"PEP","gptRecommendation":"Buy, buy, buy! Solid dividends, sweet stability!"}]}
Example: {"portfolio":[{"symbol":"META","gptRecommendation":"Booyah! Hold on, steady growth! Diversify, though!"},{"symbol":"BRK","gptRecommendation":"Buy, buy, buy! Solid dividends, sweet stability!"}]}

current inflation and mortgage rates: {{$bingResults}}

Expand Down
7 changes: 7 additions & 0 deletions services/recommendation-service/dotnet/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"version": "7.0.0",
"rollForward": "latestMajor",
"allowPrerelease": true
}
}
15 changes: 11 additions & 4 deletions ui/typescript/src/components/personalize/personalize-drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
assetsDataAtom,
investmentsDataAtom,
loadingPersonalizeAtom,
selectedAdvisorAtom,
selectedAdvisorAtom, selectedRiskLevelAtom,
userInfoAtom
} from "@/data/personalize/store";
import {formatRequestData} from "@/data/utils/format-request-data";
Expand Down Expand Up @@ -53,18 +53,25 @@ export default function PersonalizeDrawer() {
const [loadingPersonalize, setLoadingPersonalizeAtom] = useAtom(loadingPersonalizeAtom);

const [userInfo] = useAtom(userInfoAtom);
const [currentRiskLevel] = useAtom(selectedRiskLevelAtom);
const [currentFavoriteAdvisor] = useAtom(selectedAdvisorAtom);
const [investmentsInfo, setInvestmentsDataAtom] = useAtom(investmentsDataAtom);
const [assetsInfo, setAssetsDataAtom] = useAtom(assetsDataAtom);

const handlePersonalize = async () => {
setLoadingPersonalizeAtom(true);
try {
// Format data from assetsInfo and investmentsInfo
const { portfolio, stocks } = formatRequestData(assetsInfo, investmentsInfo);

// Fetch data from atoms
const updatedUserInfo = {
...userInfo,
riskLevel: currentRiskLevel.name,
favoriteAdvisor: currentFavoriteAdvisor.name,
};

// Create the requestData object
const requestData = {
userInfo,
userInfo: updatedUserInfo,
portfolio,
stocks,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function FinancialAdvisorList({
className?: string;
}) {
const [selectedItem, setSelectedAdvisorAtom] = useAtom(selectedAdvisorAtom);

return (
<div className="relative w-full lg:w-auto">
<Listbox value={selectedItem} onChange={setSelectedAdvisorAtom}>
Expand Down
2 changes: 1 addition & 1 deletion ui/typescript/src/data/static/personalize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ export const AdvisorsList = [
export const ReasoningEngineListData = [
{id: 1, name: 'GPT-35-turbo'},
{id: 2, name: 'Fine-tuned Llama-2-7B'},
{id: 3, name: 'Llama-2-13B'},
{id: 3, name: 'GPT-4'},
];

0 comments on commit f4e2897

Please # to comment.