Skip to content

Commit 0a1baf2

Browse files
chore(pinecone-assistant): optionally return metadata on file search (#1298)
1 parent 6f4c3b5 commit 0a1baf2

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

pinecone-assistant/actions/search.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@ export interface Props {
1515
* @description The number of context snippets to retrieve. Defaults to 15.
1616
*/
1717
topK?: number;
18+
19+
/**
20+
* @description Whether to include metadata in the response. Defaults to false.
21+
*/
22+
includeMetadata?: boolean;
1823
}
1924

2025
interface QueryResult {
2126
content: {
2227
type: string;
2328
text: string;
29+
metadata?: Record<string, string>;
2430
}[];
2531
}
2632

@@ -58,6 +64,9 @@ const action = async (
5864
return {
5965
type: "text",
6066
text,
67+
metadata: props.includeMetadata
68+
? snippet.reference.file.metadata ?? {}
69+
: undefined,
6170
};
6271
}),
6372
};

0 commit comments

Comments
 (0)