Skip to main content

agent-prompts

Documentation / agents/agent-prompts

Generate​

extractJSONFromLanguageReply()​

function extractJSONFromLanguageReply(text: string, key?: string): any[];

Defined in: packages/ai-research-agent/src/agents/agent-prompts.js:331

Extracts and cleans content between XML-style tags and returns a JSON object.

Parameters​

ParameterTypeDefault valueDescription

text

string

undefined

Input text to parse

key?

string

null

Tag name to look for

Returns​

any[]

Array of objects containing cleaned content items


AGENT_PROMPTS​

const AGENT_PROMPTS: (
| {
name: string;
template: string;
before: (prompt: any, params: any) => any;
after: any;
}
| {
name: string;
template: string;
after: (content: any, options: object) => any[];
before?: undefined;
})[];

Defined in: packages/ai-research-agent/src/agents/agent-prompts.js:12

Agent prompt templates which have in brackets the needed variables and reformat the response in json with a callback.