Skip to content

Commit

Permalink
openai and pinecone setup done
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishekHegde2000 committed Nov 24, 2023
1 parent a00206f commit 58976ad
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib/db/pinecone.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Pinecone } from "@pinecone-database/pinecone";

const apiKey = process.env.PINECONE_API_KEY;

if (!apiKey) {
throw Error("PINECONE_API_KEY is not set");
}

const pinecone = new Pinecone({
environment: "gcp-starter",
apiKey,
});

export const notesIndex = pinecone.Index("nextjs-ai-note-app");
11 changes: 11 additions & 0 deletions src/lib/openai.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import OpenAI from "openai";

const apiKey = process.env.OPENAI_API_KEY;

if (!apiKey) {
throw Error("OPENAI_API_KEY is not set");
}

const openai = new OpenAI({ apiKey });

export default openai;

0 comments on commit 58976ad

Please sign in to comment.