Skip to content

Commit

Permalink
fix(Tasks): add more log context (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewuu authored Jul 29, 2024
1 parent d06d25b commit 5553a75
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib/ai/chat/tools/get-search-for-tasks-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export function getSearchForTasksTool(params: GetSearchForTasksToolParams) {
answer_id: answerId,
organization: getOrganizationLogData(organization),
search_term: searchTerm,
include_completed_tasks: includeCompletedTasks,
type,
})

try {
Expand Down Expand Up @@ -96,6 +98,9 @@ export function getSearchForTasksTool(params: GetSearchForTasksToolParams) {
answer_id: answerId,
organization: getOrganizationLogData(organization),
search_term: searchTerm,
include_completed_tasks: includeCompletedTasks,
type,
filters: pineconeSearchFilters,
})

return 'No tasks found'
Expand All @@ -107,6 +112,9 @@ export function getSearchForTasksTool(params: GetSearchForTasksToolParams) {
organization: getOrganizationLogData(organization),
search_term: searchTerm,
matches,
include_completed_tasks: includeCompletedTasks,
type,
filters: pineconeSearchFilters,
})

const cohere = new CohereClient({
Expand Down Expand Up @@ -180,6 +188,9 @@ export function getSearchForTasksTool(params: GetSearchForTasksToolParams) {
),
search_relevance_threshold: searchRelevanceThreshold,
result: rankedDocuments,
include_completed_tasks: includeCompletedTasks,
type,
filters: pineconeSearchFilters,
})

return JSON.stringify(rankedDocuments)
Expand All @@ -193,6 +204,8 @@ export function getSearchForTasksTool(params: GetSearchForTasksToolParams) {
search_term: searchTerm,
error: error instanceof Error ? error.message : error,
stack_trace: error instanceof Error ? error.stack?.split('\n') : null,
include_completed_tasks: includeCompletedTasks,
type,
})

return 'FAILED'
Expand Down

0 comments on commit 5553a75

Please sign in to comment.