From 30cc26d6a29c70a89830077dd25c4f289623b08b Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 01:35:57 +0000 Subject: [PATCH] fix: update remaining schema types Co-Authored-By: Han Xiao --- src/agent.ts | 28 ++++++++++++++-------------- src/tools/dedup.ts | 2 +- src/tools/error-analyzer.ts | 2 +- src/tools/evaluator.ts | 2 +- src/tools/query-rewriter.ts | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/agent.ts b/src/agent.ts index 4fd4a8a..c290eab 100644 --- a/src/agent.ts +++ b/src/agent.ts @@ -7,10 +7,10 @@ import {rewriteQuery} from "./tools/query-rewriter"; import {dedupQueries} from "./tools/dedup"; import {evaluateAnswer} from "./tools/evaluator"; import {analyzeSteps} from "./tools/error-analyzer"; -import {GEMINI_API_KEY, SEARCH_PROVIDER, STEP_SLEEP, modelConfigs} from "./config"; +import {SEARCH_PROVIDER, STEP_SLEEP, modelConfigs} from "./config"; import {TokenTracker} from "./utils/token-tracker"; import {ActionTracker} from "./utils/action-tracker"; -import {StepAction, SchemaProperty, ResponseSchema, AnswerAction} from "./types"; +import {StepAction, ResponseSchema, AnswerAction} from "./types"; import {TrackerContext} from "./types"; import {jinaSearch} from "./tools/jinaSearch"; @@ -24,12 +24,12 @@ function getSchema(allowReflect: boolean, allowRead: boolean, allowAnswer: boole const actions: string[] = []; const properties: Record = { action: { - type: 'STRING', + type: SchemaType.STRING, enum: actions, description: "Must match exactly one action type" }, think: { - type: 'STRING', + type: SchemaType.STRING, description: "Explain why choose this action, what's the thought process behind choosing this action" } }; @@ -37,7 +37,7 @@ function getSchema(allowReflect: boolean, allowRead: boolean, allowAnswer: boole if (allowSearch) { actions.push("search"); properties.searchQuery = { - type: 'STRING', + type: SchemaType.STRING, description: "Only required when choosing 'search' action, must be a short, keyword-based query that BM25, tf-idf based search engines can understand." }; } @@ -45,20 +45,20 @@ function getSchema(allowReflect: boolean, allowRead: boolean, allowAnswer: boole if (allowAnswer) { actions.push("answer"); properties.answer = { - type: 'STRING', + type: SchemaType.STRING, description: "Only required when choosing 'answer' action, must be the final answer in natural language" }; properties.references = { - type: 'ARRAY', + type: SchemaType.ARRAY, items: { - type: 'OBJECT', + type: SchemaType.OBJECT, properties: { exactQuote: { - type: 'STRING', + type: SchemaType.STRING, description: "Exact relevant quote from the document" }, url: { - type: 'STRING', + type: SchemaType.STRING, description: "URL of the document; must be directly from the context" } }, @@ -71,9 +71,9 @@ function getSchema(allowReflect: boolean, allowRead: boolean, allowAnswer: boole if (allowReflect) { actions.push("reflect"); properties.questionsToAnswer = { - type: 'ARRAY', + type: SchemaType.ARRAY, items: { - type: 'STRING', + type: SchemaType.STRING, description: "each question must be a single line, concise and clear. not composite or compound, less than 20 words." }, description: "List of most important questions to fill the knowledge gaps of finding the answer to the original question", @@ -84,9 +84,9 @@ function getSchema(allowReflect: boolean, allowRead: boolean, allowAnswer: boole if (allowRead) { actions.push("visit"); properties.URLTargets = { - type: 'ARRAY', + type: SchemaType.ARRAY, items: { - type: 'STRING' + type: SchemaType.STRING }, maxItems: 2, description: "Must be an array of URLs, choose up the most relevant 2 URLs to visit" diff --git a/src/tools/dedup.ts b/src/tools/dedup.ts index 772caa7..6b72ba2 100644 --- a/src/tools/dedup.ts +++ b/src/tools/dedup.ts @@ -1,4 +1,4 @@ -import { GoogleGenerativeAI, SchemaType, ResponseSchema } from '@google/generative-ai'; +import { GoogleGenerativeAI, SchemaType } from '@google/generative-ai'; import { modelConfigs } from "../config"; import { TokenTracker } from "../utils/token-tracker"; diff --git a/src/tools/error-analyzer.ts b/src/tools/error-analyzer.ts index 9297a30..6c1f001 100644 --- a/src/tools/error-analyzer.ts +++ b/src/tools/error-analyzer.ts @@ -1,4 +1,4 @@ -import { GoogleGenerativeAI, SchemaType, ResponseSchema } from '@google/generative-ai'; +import { GoogleGenerativeAI, SchemaType } from '@google/generative-ai'; import { modelConfigs } from "../config"; import { TokenTracker } from "../utils/token-tracker"; diff --git a/src/tools/evaluator.ts b/src/tools/evaluator.ts index 0dc5a7c..b6e8c5e 100644 --- a/src/tools/evaluator.ts +++ b/src/tools/evaluator.ts @@ -1,4 +1,4 @@ -import { GoogleGenerativeAI, SchemaType, ResponseSchema } from '@google/generative-ai'; +import { GoogleGenerativeAI, SchemaType } from '@google/generative-ai'; import { modelConfigs } from "../config"; import { TokenTracker } from "../utils/token-tracker"; diff --git a/src/tools/query-rewriter.ts b/src/tools/query-rewriter.ts index c551a5a..893240e 100644 --- a/src/tools/query-rewriter.ts +++ b/src/tools/query-rewriter.ts @@ -1,4 +1,4 @@ -import { GoogleGenerativeAI, SchemaType, ResponseSchema } from '@google/generative-ai'; +import { GoogleGenerativeAI, SchemaType } from '@google/generative-ai'; import { modelConfigs } from "../config"; import { TokenTracker } from "../utils/token-tracker";