mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2025-12-26 06:28:56 +08:00
feat: add num urls
This commit is contained in:
parent
c9a51bb403
commit
f742478d15
@ -238,7 +238,8 @@ export async function getResponse(question?: string,
|
||||
tokenBudget: number = 1_000_000,
|
||||
maxBadAttempts: number = 3,
|
||||
existingContext?: Partial<TrackerContext>,
|
||||
messages?: Array<CoreMessage>
|
||||
messages?: Array<CoreMessage>,
|
||||
numReturnedURLs: number = 100
|
||||
): Promise<{ result: StepAction; context: TrackerContext; visitedURLs: string[], readURLs: string[], allURLs: string[] }> {
|
||||
|
||||
let step = 0;
|
||||
@ -845,7 +846,7 @@ But unfortunately, you failed to solve the issue. You need to think out of the b
|
||||
}, totalStep);
|
||||
|
||||
// max return 300 urls
|
||||
const returnedURLs = weightedURLs.slice(0, 50).map(r => r.url);
|
||||
const returnedURLs = weightedURLs.slice(0, numReturnedURLs).map(r => r.url);
|
||||
return {
|
||||
result: thisStep,
|
||||
context,
|
||||
|
||||
@ -548,7 +548,7 @@ app.post('/v1/chat/completions', (async (req: Request, res: Response) => {
|
||||
visitedURLs,
|
||||
readURLs,
|
||||
allURLs
|
||||
} = await getResponse(undefined, tokenBudget, maxBadAttempts, context, body.messages)
|
||||
} = await getResponse(undefined, tokenBudget, maxBadAttempts, context, body.messages, body.numReturnedURLs)
|
||||
let finalAnswer = (finalStep as AnswerAction).mdAnswer;
|
||||
|
||||
const annotations = (finalStep as AnswerAction).references?.map(ref => ({
|
||||
|
||||
@ -215,6 +215,7 @@ export interface ChatCompletionRequest {
|
||||
max_attempts?: number;
|
||||
|
||||
response_format?: ResponseFormat;
|
||||
numReturnedURLs?: number;
|
||||
}
|
||||
|
||||
export interface URLAnnotation {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user