# 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="/files/opEUiNz6aeiUFTDU2Yqj" 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.memejob.fun/memejob/introducing-ai-agents/memejob-agent-setup-guide/creating-a-strategy/llm-assisted-strategy-builder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
