generator-begcode
Version:
Spring Boot + Angular/React/Vue in one handy generator
30 lines (29 loc) • 1.11 kB
JavaScript
import { ChatMessageBuilder } from '../agent-core/index.js';
import { LlmAgentFunctionBase } from './utils/index.js';
export class AnalyzeSoftwareRequirementsFunction extends LlmAgentFunctionBase {
constructor(llm, tokenizer) {
super(llm, tokenizer);
}
name = 'analyzeSoftwareRequirements';
description = 'Analyzes the software requirements of a user defined goal';
parameters = {
type: 'object',
properties: {
goal: {
type: 'string',
description: "The user's goal",
},
},
required: ['goal'],
additionalProperties: false,
};
buildExecutor({ context, }) {
return async (params, rawParams) => {
const resp = await this.askLlm(`Given the following user goal, please identify any software requirements:\n\`\`\`\n${params.goal}\n\`\`\``);
return {
outputs: [],
messages: [ChatMessageBuilder.functionCall(this.name, rawParams), ChatMessageBuilder.functionCallResult(this.name, resp)],
};
};
}
}