Skip to content

Commit

Permalink
make message content for demoSearchRunnable
Browse files Browse the repository at this point in the history
  • Loading branch information
berkingurcan committed Jul 3, 2024
1 parent 102d93c commit 092c20a
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions lib/tools/demoSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ async function formatResults(matches: ScoredPineconeRecord[]) {
return results.join('\n')
}

async function runTool(args: { query: string }): Promise<string> {
const runTool = (message_content:string) => async (args: { }): Promise<string>=> {
try {
const embeddings = await getEmbeddings(args.query)
const embeddings = await getEmbeddings(message_content)
const matches = await getMatchesFromEmbeddings(embeddings, 15, VECTOR_TYPE)

return formatResults(matches)
Expand All @@ -96,23 +96,18 @@ export const demoSearchTool: Tool = {
callable: runTool
}

export const demoSearchToolRunnable: RunnableToolFunction<{ query: string }> = {
export const demoSearchToolRunnable =(message: string): RunnableToolFunction<{ query: string }> => ({
type: 'function',
function: {
name: functionDescription.name,
function: runTool,
function: runTool(message),
parse: JSON.parse,
description:
'Search for context in discord threads',
parameters: {
type: 'object',
properties: {
query: {
type: 'string',
description:
'The query to search for. 1-3 sentences or words are enough. English only.'
}
}
}
}
}
})

0 comments on commit 092c20a

Please sign in to comment.