# GPT Elixir Code Evaluator

**URL:** <https://forum.elixirforum.com/t/gpt-elixir-code-evaluator/59650>\
**Category:** Discussions\
**Tags:** ai, demo, chatgpt\
**Created:** [November 11, 2023, 11:52am UTC](https://forum.elixirforum.com/t/gpt-elixir-code-evaluator/59650 "2023-11-11T11:52:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![baruh](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/baruh/32/6092_2.png) [@baruh](https://forum.elixirforum.com/u/baruh)\
**Post date:** [November 11, 2023, 11:52am UTC](https://forum.elixirforum.com/t/gpt-elixir-code-evaluator/59650/1 "2023-11-11T11:52:17Z")

</div>

I made an **Elixir code evaluator** with **GPT**. It’s an API to run Elixir code snippets. You can test it here:

> **[ChatGPT - Elixir Code Evaluator](https://chatgpt.com/g/g-w9uPdNv9W-elixir-code-evaluator)**
>
> Evaluates self-contained Elixir code

The source code is here:

[https://github.com/isavita/code\_eval](https://github.com/isavita/code_eval)

Short demo video is here:

[![](https://i.ytimg.com/vi/nLJa5Qvwx6g/hqdefault.jpg "Elixir Code Evaluator GPT") ](https://www.youtube.com/watch?v=nLJa5Qvwx6g)

This is a proof of concept and not secure or reliable. It has a 5s timeout and returns the result or error.

I welcome your feedback and suggestions on how to improve it.

---

<div class="post-metadata">

**Author:** ![bobek](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bobek/32/17136_2.png) [@bobek](https://forum.elixirforum.com/u/bobek)\
**Post date:** [November 13, 2023, 8:09am UTC](https://forum.elixirforum.com/t/gpt-elixir-code-evaluator/59650/2 "2023-11-13T08:09:50Z")

</div>

Would you mind sharing the configuration prompt? I am curious if OpenAI is doing filtering themselves, as your evaluator service would happily execute `File.read/1`.

 ![image](https://forum.elixirforum.com/uploads/default/original/3X/e/4/e49885803795d69f3e1831a6b373bbfd16ca5f6a.png)

---

<div class="post-metadata">

**Author:** ![baruh](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/baruh/32/6092_2.png) [@baruh](https://forum.elixirforum.com/u/baruh)\
**Post date:** [November 13, 2023, 11:17am UTC](https://forum.elixirforum.com/t/gpt-elixir-code-evaluator/59650/3 "2023-11-13T11:17:39Z")

</div>

It is my prompt. This part

```elixir
#SECURITY CONSIDERATIONS
You SHOULD CHECK ALL the user code input and do not send any malicious code to the server.
If the user try to send malicious code, you should return a 400 error code and DO NOT send the request to the server.
If the user try to send code that tries to exaust the server resources, you should return a 429 error code and DO NOT send the request to the server.
The user could use HTTPoison to send requests to third party servers, you should allow this only if it is reasonable number of requests and the user is not trying to exaust the server resources.
If there is some molicious code that you can't detect, you should return a 500 error code and DO NOT send the request to the server.

```

You can do this (IT IS ONLY TO TEST THE GPT)

 ![Screenshot 2023-11-13 at 11.23.37](https://forum.elixirforum.com/uploads/default/original/3X/a/1/a1368fe6f34a3be260ffafbdd774f8327702938f.jpeg)
