# Open AI Chat completion Action

**URL:** <https://community.weweb.io/t/open-ai-chat-completion-action/5794>\
**Category:** How do I?\
**Created:** [December 7, 2023, 1:25pm UTC](https://community.weweb.io/t/open-ai-chat-completion-action/5794 "2023-12-07T13:25:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vi56](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/vi56/32/11392_2.png) [@Vi56](https://community.weweb.io/u/Vi56)\
**Post date:** [December 7, 2023, 1:25pm UTC](https://community.weweb.io/t/open-ai-chat-completion-action/5794/1 "2023-12-07T13:25:36Z")

</div>

Hello everyone,

Several questions about the **Chat completion** action of the Open AI Plugin:  
If I create two arrays:

- {Role: User; Content: user\_prompt; …}
- and one {Role: Assistant; Content: assistant\_response; …},

does this mean that the assistant will take these old messages into account when generating its next response (like to simulate a conversation history)? Will the assistant then reply to the user’s last message (the one positioned lowest)? Or is it a completely different usage?

It is also possible to select “ **System** ” for the prompt. Does this mean that the **Secured prompt** I selected in the “ **System content** ” field is not my **system prompt**?

 ![chatcompletion](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/a/a26f9056c988939b549e05e26a0c941ded55437d.png)

Thank you !

---

<div class="post-metadata">

**Author:** ![raelyn](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raelyn/32/2803_2.png) [@raelyn](https://community.weweb.io/u/raelyn)\
**Post date:** [December 7, 2023, 3:33pm UTC](https://community.weweb.io/t/open-ai-chat-completion-action/5794/2 "2023-12-07T15:33:18Z")

</div>

It’s a completely new convo. You have to refeed the old messages if you want the ai to remember them…

---

<div class="post-metadata">

**Author:** ![Vi56](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/vi56/32/11392_2.png) [@Vi56](https://community.weweb.io/u/Vi56)\
**Post date:** [December 7, 2023, 7:33pm UTC](https://community.weweb.io/t/open-ai-chat-completion-action/5794/3 "2023-12-07T19:33:44Z")

</div>

Thank you @raelyn, so what is the purpose of the messages that can be added to the request? What are the use cases?

---

<div class="post-metadata">

**Author:** ![Zacharyb](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/zacharyb/32/3567_2.png) [@Zacharyb](https://community.weweb.io/u/Zacharyb)\
**Post date:** [December 7, 2023, 8:50pm UTC](https://community.weweb.io/t/open-ai-chat-completion-action/5794/4 "2023-12-07T20:50:12Z")

</div>

Checkout the template with xano + weweb and the video too as well as the xano snippet for a better understanding

Basically allowing message history retrieval based on a back end tables , that can be used for individual user based on their userid and if wanted based on the session id ( or a specific conversation basically )

---

<div class="post-metadata">

**Author:** ![Vi56](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/vi56/32/11392_2.png) [@Vi56](https://community.weweb.io/u/Vi56)\
**Post date:** [December 8, 2023, 8:45am UTC](https://community.weweb.io/t/open-ai-chat-completion-action/5794/5 "2023-12-08T08:45:50Z")

</div>

Thanks @Zacharyb ! I I must have lost my focus when Quentin dealt with it… So it’s definitely a solution for simulating conversation history. Awesome.  
I still feel like the system prompt appears twice but nethermind 🤔

---

<div class="post-metadata">

**Author:** ![Zacharyb](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/zacharyb/32/3567_2.png) [@Zacharyb](https://community.weweb.io/u/Zacharyb)\
**Post date:** [December 9, 2023, 8:11am UTC](https://community.weweb.io/t/open-ai-chat-completion-action/5794/6 "2023-12-09T08:11:42Z")

</div>

Yeah checkout also what LiteLLM has to offer or even Cloudflare LLM functions  
Don’t know if your app is only OpenAi vanilla focus but yeah the plugin is not mandatory to make a proper llm app  
Can be useful if you use it as a request sent to a chunking \> embedding \> store \> retrieval if needed \> return response
