diff --git a/package.json b/package.json index 64a8a32..ed42c29 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/ai-utils", - "version": "0.1.4", + "version": "0.1.5", "description": "AI Utility library", "author": "Zak Timson", "license": "MIT", diff --git a/src/llm.ts b/src/llm.ts index c3c70bc..4f1702b 100644 --- a/src/llm.ts +++ b/src/llm.ts @@ -138,9 +138,15 @@ export class LLM { return Math.ceil((text.length / 4) * 1.2); } - async json(message: string, options: LLMRequest) { + /** + * Ask a question with JSON response + * @param {string} message Question + * @param {LLMRequest} options Configuration options and chat history + * @returns {Promise<{} | {} | RegExpExecArray | null>} + */ + async json(message: string, options?: LLMRequest) { let resp = await this.ask(message, { - system: '', + system: 'Respond using a JSON blob', ...options }); if(!resp?.[0]?.content) return {};