File tree 4 files changed +6
-3
lines changed
4 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { PineconeClient } from '@pinecone-database/pinecone'
3
3
import {
4
4
queryPineconeVectorStoreAndQueryLLM ,
5
5
} from '../../../utils'
6
+ import { indexName } from '../../../config'
6
7
7
8
export async function POST ( req : NextRequest ) {
8
9
const body = await req . json ( )
@@ -12,7 +13,6 @@ export async function POST(req: NextRequest) {
12
13
environment : process . env . PINECONE_ENVIRONMENT || ''
13
14
} )
14
15
15
- const indexName = 'my-test-index-2'
16
16
const text = await queryPineconeVectorStoreAndQueryLLM ( client , indexName , body )
17
17
18
18
return NextResponse . json ( {
Original file line number Diff line number Diff line change 6
6
createPineconeIndex ,
7
7
updatePinecone
8
8
} from '../../../utils'
9
+ import { indexName } from '../../../config'
9
10
10
11
export async function POST ( ) {
11
12
const loader = new DirectoryLoader ( './documents' , {
@@ -14,7 +15,6 @@ export async function POST() {
14
15
} )
15
16
16
17
const docs = await loader . load ( )
17
- const indexName = 'my-test-index-2'
18
18
const vectorDimensions = 1536
19
19
20
20
const client = new PineconeClient ( )
Original file line number Diff line number Diff line change
1
+ export const indexName = 'my-test-pinecone-index'
2
+ export const timeout = 180000
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { RecursiveCharacterTextSplitter } from 'langchain/text_splitter'
3
3
import { OpenAI } from 'langchain/llms/openai'
4
4
import { loadQAStuffChain } from 'langchain/chains'
5
5
import { Document } from 'langchain/document'
6
+ import { timeout } from './config'
6
7
7
8
export const queryPineconeVectorStoreAndQueryLLM = async (
8
9
client ,
@@ -73,7 +74,7 @@ export const createPineconeIndex = async (
73
74
// 6. Log successful creation
74
75
console . log ( `Creating index.... please wait for it to finish initializing.` ) ;
75
76
// 7. Wait 60 seconds for index initialization
76
- await new Promise ( ( resolve ) => setTimeout ( resolve , 180000 ) ) ;
77
+ await new Promise ( ( resolve ) => setTimeout ( resolve , timeout ) ) ;
77
78
} else {
78
79
// 8. Log if index already exists
79
80
console . log ( `"${ indexName } " already exists.` ) ;
You can’t perform that action at this time.
0 commit comments