quickadd icon indicating copy to clipboard operation
quickadd copied to clipboard

[BUG] Model 'undefined' not found in any provider

Open Zebartin opened this issue 1 year ago • 2 comments

Describe the bug When testing example given in document about API of AI module, code throws an error reading as follows:

QuickAdd: (ERROR) Could not create file with template: 
Model 'undefined' not found in any provider

I have tried different values from api.ai.getModels() for model, but all end up with the same error.

To Reproduce Steps to reproduce the behavior:

  1. Create an template file with content:
```js quickadd
const promptText = "What is the capital of France?";
const model = "gpt-4";

const settings = {
    variableName: "capital",
    shouldAssignVariables: true,
    modelOptions: {
        temperature: 0.6,
        max_tokens: 60,
        frequency_penalty: 0.5,
        presence_penalty: 0.5
    },
    showAssistantMessages: true,
    systemPrompt: "Please provide the answer"
};

const response = await this.quickAddApi.ai.prompt(promptText, model, settings);
console.log(response);
```
  1. Set up QuickAdd for the template above
  2. Run the template with QuickAdd
  3. See error

Expected behavior No error is shown and new file is created

Screenshots image

Desktop (please complete the following information):

  • OS: Windows 10

Additional context QuickAdd version: 1.8.1

Zebartin avatar Apr 20 '24 14:04 Zebartin

It works after setting model to {name: "xxxxx"}

It seems that the example shown in document is not correct according to the source code: https://github.com/chhoumann/quickadd/blob/5b0e20be3213a2cb894ae6fb2d4216e5f9a25129/src/quickAddApi.ts#L138

Zebartin avatar Apr 20 '24 14:04 Zebartin

It works after setting model to {name: "xxxxx"}

It seems that the example shown in document is not correct according to the source code:

https://github.com/chhoumann/quickadd/blob/5b0e20be3213a2cb894ae6fb2d4216e5f9a25129/src/quickAddApi.ts#L138

worked for me!

erauner12 avatar May 01 '24 00:05 erauner12