# LLM-assisted strategy builder

Add your openAI API key([find your API key](https://platform.openai.com/api-keys)) in the strategy "Config":

<figure><img src="https://897900350-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKhUXaImWWcKZlCYaNw6T%2Fuploads%2FSQPBYtSqupXNVIXaQLrB%2Fimage.png?alt=media&#x26;token=875f409c-4ae9-4122-8aed-b8b5063adde4" alt=""><figcaption></figcaption></figure>

The API key is used only during strategy authoring to generate or refine code. It is not used during strategy execution or backtesting.&#x20;

and allow ChatGPT to build the strategy for you inside the memejob strategy builder:

#### `complete(prompt)`

The complete() function is an authoring-time utility for generating text and code suggestions based on prompts. It uses a Spring AI ChatModel to assist with strategy construction, analysis, and experimentation.

#### Parameters:

* prompt [string](https://www.lua.org/manual/5.3/manual.html#6.4) The prompt to send to the AI model

#### Returns:

1. [string](https://www.lua.org/manual/5.3/manual.html#6.4) Generated completion text from the AI model

#### Usage:

```lua
local analysis = complete("build me a strategy for buying the golden cross")
```

or

```lua
local analysis = complete("Analyze the current price action and volume")
local signal   = complete("Should I buy or sell based on current indicators?")
print("AI says: " .. analysis)
```

Outputs generated via complete() are text responses and must be interpreted or translated into deterministic strategy logic before being used as signals.

Note: while feeding the memejob LUA documentation, you may use any external LLM to support you in your strategy building endeavours. HF!

{% hint style="info" %}
Once a strategy is generated or refined, it must conform to the supported syntax, execution model, and primitives described in the following reference section.
{% endhint %}
