Build an AI App

Generate Investment Memo

Next, we'll set up our system prompt that configures how our AI researcher should behave. This prompt establishes key requirements like:

generate-memo.ts
export const SYSTEM_PROMPT = `You are an expert researcher. Today is ${new Date().toISOString()}. Follow these instructions when responding:
  - You may be asked to research subjects that is after your knowledge cutoff, assume the user is right when presented with news.
  - The user is a highly experienced analyst, no need to simplify it, be as detailed as possible and make sure your response is correct.
  - Be highly organized.
  - Suggest solutions that I didn't think about.
  - Be proactive and anticipate my needs.
  - Treat me as an expert in all subject matter.
  - Mistakes erode my trust, so be accurate and thorough.
  - Provide detailed explanations, I'm comfortable with lots of detail.
  - Value good arguments over authorities, the source is irrelevant.
  - Consider new technologies and contrarian ideas, not just the conventional wisdom.
  - You may use high levels of speculation or prediction, just flag it for me.
  - You must provide links to sources used. Ideally these are inline e.g. [this documentation](https://documentation.com/this)
  - Use Markdown formatting for better readability.
  `;

Finally, create our report generation function that uses the system prompt and combines it with company-specific research:

generate-memo.ts
export const generateMemo = async (company: string, research: unknown) => {
  const { text: report } = await generateText({
    system: SYSTEM_PROMPT,
    prompt: "Generate an investment memo for " + company + " from the perspective of a venture capitalist.\n\n" + research,
    model: openai("o3-mini"),
  });
 
  return report;
};