Skip to content

Commit fd9e9b7

Browse files
author
Sim Pi Agent
committed
Pi: Fix Pinecone vector-search output options.
The Pinecone block expose...
1 parent 9edf892 commit fd9e9b7

3 files changed

Lines changed: 35 additions & 2 deletions

File tree

apps/sim/blocks/blocks/pinecone.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,15 @@ export const PineconeBlock: BlockConfig<PineconeResponse> = {
514514
if (params.deleteAll != null && params.deleteAll !== '') {
515515
result.deleteAll = params.deleteAll === true || params.deleteAll === 'true'
516516
}
517+
if (params.options != null && params.options !== '') {
518+
const options = Array.isArray(params.options)
519+
? params.options
520+
: typeof params.options === 'string'
521+
? JSON.parse(params.options)
522+
: []
523+
result.includeValues = options.includes('includeValues')
524+
result.includeMetadata = options.includes('includeMetadata')
525+
}
517526
return result
518527
},
519528
},
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* @vitest-environment node
3+
*/
4+
import { describe, expect, it } from 'vitest'
5+
import { searchVectorTool } from '@/tools/pinecone/search_vector'
6+
7+
const baseParams = {
8+
apiKey: 'test-key',
9+
indexHost: 'https://example.pinecone.io',
10+
vector: [0.1, 0.2],
11+
}
12+
13+
describe('Pinecone vector search output options', () => {
14+
it.each([
15+
[{}, false, false],
16+
[{ includeValues: true }, true, false],
17+
[{ includeMetadata: true }, false, true],
18+
[{ includeValues: true, includeMetadata: true }, true, true],
19+
])('sends the selected options (%j)', (options, includeValues, includeMetadata) => {
20+
const body = searchVectorTool.request.body?.({ ...baseParams, ...options })
21+
22+
expect(body).toMatchObject({ includeValues, includeMetadata })
23+
})
24+
})

apps/sim/tools/pinecone/search_vector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ export const searchVectorTool: ToolConfig<PineconeSearchVectorParams, PineconeRe
7676
? JSON.parse(params.filter)
7777
: params.filter
7878
: undefined,
79-
includeValues: true, //TODO: Make this dynamic
80-
includeMetadata: true, //TODO: Make this dynamic
79+
includeValues: params.includeValues ?? false,
80+
includeMetadata: params.includeMetadata ?? false
8181
}),
8282
},
8383

0 commit comments

Comments
 (0)