How to Use Exa with TypeScript
1. Create an account and grab an API key
First, generate and grab an API key for Exa:Get API Key
Follow this link to get your API key
2. Install the SDK
Install the Exa TypeScript SDK using npm:Bash
3. Instantiate the client
Create a new TypeScript file (e.g.,exa-example.ts) and instantiate the Exa client:
TypeScript
EXA_API_KEY environment variable with your API key.
4. Make a search using the searchAndContents method
Here’s an example of how to use the searchAndContents method:
TypeScript
5. Set up OpenAI and pass the Exa query results to perform RAG
First, install the OpenAI library:Bash
TypeScript
OPENAI_API_KEY environment variable with your OpenAI API key.
This completes the guide, demonstrating how to set up Exa and OpenAI, use Exa’s search capabilities, and then use OpenAI to summarize the results in a RAG system. The combination of Exa’s powerful search capabilities with OpenAI’s language model allows for the creation of a system that can retrieve relevant, up-to-date information and generate insightful summaries based on that information.
