`openai_ex`: updated elixir client with latest APIs

I have updated openai_ex, an elixir OpenAI API wrapper / client, with the new features and APIs.

v0.4.2 has supports the Assistants API Beta, DALL-E-3, Text-To-Speech and tool calls in chat completions were added.

It already had full support for streaming chat completions.

The elixir wrapper was written from the get-go to work with livebook (the elixir take on jupyter notebooks). The user guide and all the code samples are livebooks.

  1. Code - GitHub - restlessronin/openai_ex: Community maintained OpenAI API Elixir client for Livebook
  2. Docs - OpenaiEx User Guide — openai_ex v0.4.2
  3. Announcements - Openai_ex - OpenAI API client library - Libraries - Elixir Programming Language Forum

I have just released a point version (0.4.1) with documentation for the new API calls, support for DALL-E-3 in the Image endpoint, and a change to the FQN of some modules.

1 Like

Still catching up with the new features. I just published v0.4.2

  1. Added the Text-To-Speech endpoint
  2. Changed the FQN of the Audio and Image functions to match the equivalent Python functions (and yet, I left the major and minor versions unchanged :frowning: )
  3. Updated the docs.
1 Like

@restlessronin random side question:

Do you know the answer to this:

If I do a GET request for a Thread or Message, how can I know which Assistant the Thread or Message is a part of?

@fra_ab If you look at the API reference for the message object, the field assistant_id has the assistant information.

In contrast, the Thread object does not have a corresponding Assistant object.

What’s the sequence of calls you should be making to get the assistants/threads use case working? Do you have a recommendation for it’s design? It’s not linear anymore as it requires you to periodically check if a run is complete; also check the results of function calls. Do you suggest using a GenServer for every thread that keeps track of all this state and acts as a bridge between UI ↔ My App (Phoenix) ↔ OpenAI?

@subbu It’s early days yet, and I don’t have firm opinions on the answers to your questions. You might want to ask on the openai api discussion / announcement thread (or start a fresh thread) on elixir forum, where other devs can chime in with their 2 cents.

But it only has the assistant_id if the assistant is the one that generated that message, if the user did then assistant_id is null

Check out this: How to know which Thread/Message belongs to which Assistant? - #8 by fra_ab

Also @subbu check this out: GitHub - dvcrn/chatgpt-ui: ChatGPT UI with auth, targeted towards business-ey usecases, written in Elixir + LiveView

1 Like