Skip to content

Latest commit

 

History

History
 
 

040-embeddings-rag-nodejs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Embeddings and RAG

Introduction

This examples demonstrates the core principles of the Retrieval Augmented Generation (RAG) pattern. You learn how to call OpenAI's embeddings endpoint and how to use the RAG model to generate text based on a given prompt.

The sample covers the following topics:

  • Calling the embeddings endpoint
  • Use the dot product to calculate the similarity between two vectors
  • Use the RAG model to generate text based on a given prompt

Exercises

  • Make yourself familiar with the code in src.
  • Try the prompts offered by the app (part of main.ts).
  • Come up with additional queries about the product models.
  • Think about an application of function calling that would be relevant to your business or personal life.

Advanced Exercises

  • Combine the RAG model for product search with function calling (e.g. to retrieve pricing information for a product).