Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix outdated dependencies #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/pinecone.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const PINECONE_INDEX_NAME = 'langchainjsfundamentals';
const PINECONE_INDEX_NAME = 'notion-index';

const PINECONE_NAME_SPACE = 'notion-chatgpt-langchain'; //namespace is optional for your vectors

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"ingest": "tsx -r dotenv/config scripts/ingest-data.ts"
},
"dependencies": {
"@pinecone-database/pinecone": "0.0.8",
"@pinecone-database/pinecone": "0.0.10",
"@types/glob": "^8.1.0",
"dotenv": "^16.0.3",
"glob": "^9.2.1",
"langchain": "^0.0.22",
"langchain": "^0.0.38",
"next": "13.2.3",
"react": "18.2.0",
"react-dom": "18.2.0"
Expand Down
15 changes: 12 additions & 3 deletions pages/api/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import { PineconeStore } from 'langchain/vectorstores';
import { openai } from '@/utils/openai-client';
import { pinecone } from '@/utils/pinecone-client';
import { PINECONE_INDEX_NAME, PINECONE_NAME_SPACE } from '@/config/pinecone';
import type { VectorOperationsApi } from "@pinecone-database/pinecone/dist/pinecone-generated-ts-fetch";

interface PineconeLibArgs {
pineconeIndex: VectorOperationsApi;
textKey?: string;
namespace?: string;
}

export default async function handler(
req: NextApiRequest,
Expand All @@ -21,12 +28,14 @@ export default async function handler(
const sanitizedQuestion = question.trim().replaceAll('\n', ' ');

const index = pinecone.Index(PINECONE_INDEX_NAME);
let dbConfig:PineconeLibArgs = {
pineconeIndex: pinecone.Index(PINECONE_INDEX_NAME),
namespace: PINECONE_NAME_SPACE,
};
/* create vectorstore*/
const vectorStore = await PineconeStore.fromExistingIndex(
index,
new OpenAIEmbeddings({}),
'text',
PINECONE_NAME_SPACE, //optional
dbConfig
);

const model = openai;
Expand Down
Loading