OpenAI Lab: How I help OpenAI Community Members Here

Hi Everyone!

First, I want to thank those who have contacted me here and on LinkedIn with all the kind words about how I help and assist members and users here!

It’s very gratifying to be held in such high regard by so many developers here. THANK YOU. LinkedIn is the best place to contact me, as I have disabled direct messages here temporarily (except to a hand full off long time members, staff and regulars).

So, what I have been doing with my current OpenAI project?

Lately, I have been creating my “user support” OpenAI API Lab, which only runs (at this time) on my desktop. it’s a Rails app, and it is still a work-in-progress, as I add more features and functions weekly. When I am happy with it, I may push it out to the web so developers can use it directly, no plans at time.

The code is all in Ruby (and Rails) and I have modules for each of the main functions, as follows from a screen shot in Visual Studio Code.

So far there is the main screen, which is just a big menu:

Main Screen

Here are the main functions so far:

Moderation (models selectable)

Moderation Example (results stored in a DB)

Embeddings (will add more models later as they are released)

Embeddings Results (stored in a DB)

Completions New (many options, results stored in a DB)

Completions Results

Fine Tuning (needs a few more params later)

List Fine Tuned Models (needs a few more params later)

  • Can delete also, but did not commit yet.
  • Can select models, but have not committed yet.

Search (can compare search types, methods as well)

  • All text and vectors in a DB

Results (Ranked)

User Login

Todo

My next plan is to finalize selecting my fine-tuned models for completions.

Mostly, when I see folks having problems here in the OpenAI community, I think about how I can write some code to test a member’s problem, or validate something, so I can confidently reply and help someone when they have a pressing problem or question.

For example, the fine-tuned function has a JSONL validator (regex based) and an OpenAI API format validator (also regex based), so I plan to break that out to it’s on direct menu item.

Please contact me on LinkedIn if you have any features who would like me to add, or post back here in this topic.

Well, that’s about it for this project today !

Now, you know how I test completions, params, etc so fast.

If you read this far down, wow! Thanks!!

:slight_smile:

5 Likes

Kudos @ruby_coder

That’s a very well done project. How do you plan on releasing it?

1 Like

Thank you @sps, you are too kind :slight_smile:

No plans so far. I’m still adding functions and features as I see folks here running into problems and brick walls.

I have really enjoyed coding this and of course, we learn at lot as well, coding the API up into a kind ‘test lab’ for all the API features.

Then, there is the ChatGPT API on the horizon, and that may be a game changer, so I am very interested to see this new API released soon so I can add the ChatGPT API to the lab.

2 Likes

this is SO COOL!! very excited to see where it goes

1 Like

Thank you @arimendelow ! Yeah, it’s a lot of fun and I use this test lab daily, especially to help our fine members here when then have issues.

So far, I have 8 main menu items, but it’s all draft and have not been coding a lot for the past few days; catching up at the gym :slight_smile:

Current Draft Menu Items

Any ideas @arimendelow on the next function to add, which might help you in your dev tasks :question:

Thanks

:slight_smile:

1 Like

maybe some spots for new users to get started? i’ve just starting really playing with fine tuning today and was surprised by the lack of real resources for generating your first datasets, etc - just simple things like helping you to generate very simple JSONL files. i’ve been working on my own python-based toolkit for this and it’s nothing worth sharing yet but that’s a space i’d love to help fill!

Hi @arimendelow

Actually, you must be reading my mind, hahaha :joy:

I was thinking to create a function where I could input only a prompt and a completion (and fields for the separator and the stop in a form and select an existing JSONL file or create new one and the format the data per JSONL and OpenAI specs.

That’s actually pretty easy to do and has been bouncing around in the back of my mind for a few weeks now as we see so many new OpenAI API users struggle with getting the JSON file correctly formatted.

Actually, it’s all easy coding, just need to stay motivated… my wife wants me to refinish our teakwood floor under a heavy refrigerator. :construction_worker_man:

:jack_o_lantern:

Thanks @arimendelow

:slight_smile:

1 Like

yeah! that’s exactly what i was struggling with. it’s actually pretty easy, for example in my case the completion is a short JSON object, so here’s my script:

import jsonlines

def prompt_for_input(prompt, completion_keys):
    completion = {}
    for key in completion_keys:
        value = input(f'{key}: ')
        if value.isnumeric():
            # If the value is a number, cast it to an int
            completion[key] = int(value)
        else:
            try:
                # Try to cast the value to a float
                completion[key] = float(value)
            except ValueError:
                # If the value cannot be cast to a number, store it as a string
                completion[key] = value
    return {'prompt': prompt, 'completion': completion}


file_path = 'ingredient_input_training/input_prepared/ingredient_input_training.jsonl'
completion_keys = ['quantity', 'unitName', 'ingredientName']

try:
    with jsonlines.open(file_path, mode='a') as writer:
        while True:
            prompt = input('\nprompt? ')
            data = prompt_for_input(prompt, completion_keys)
            writer.write(data)
except KeyboardInterrupt:
    print("Interrupted by user, closing file...")

Your code sample does not appear to format the values per OpenAI specs.

oh, you take the output of that and then run it through the openai fine-tune data prep tool. you could format it fully but that seemed redundant

but that’s not a bad idea, let me see if i can get it to give less suggestions on the output

EDIT: updated code that the data prep tool approves of:

import jsonlines

file_path = 'ingredient_input_training/input_prepared/ingredient_input_training.jsonl'
completion_keys = ['quantity', 'unitName', 'ingredientName']

prompt_completion_separator = ' ->'
completion_suffix = "####"

def prompt_for_input(prompt, completion_keys):
    completion = {}
    for key in completion_keys:
        value = input(f'{key}: ')
        if value.isnumeric():
            # If the value is a number, cast it to an int
            completion[key] = int(value)
        else:
            try:
                # Try to cast the value to a float
                completion[key] = float(value)
            except ValueError:
                # If the value cannot be cast to a number, store it as a string
                completion[key] = value
    return {'prompt':f'{prompt}{prompt_completion_separator}','completion':f' {completion}{completion_suffix}'}

try:
    with jsonlines.open(file_path, mode='a') as writer:
        while True:
            prompt = input('\nprompt? ')
            data = prompt_for_input(prompt, completion_keys)
            writer.write(data)
except KeyboardInterrupt:
    print("Interrupted by user, closing file...")

Update

Updated this project today with some simple functionality so we can do quick similarity / distance checks between two embedding vectors using five different methods, useful when working on fine-tunings and other aspects of OpenAI projects:

Simple Example

Simple Example Results

3 Likes

Beautiful @ruby_coder !

Congratulations on the initiative and on the humanitarian spirit of doing good, I share the same intentions and perspectives and would like to make myself available to help if possible. Just as you also help people on a daily basis in various channels here and in virtual environments in Brazil, the Brazilian community is lacking in hundreds of things and this greatly hinders the growth of the use of tools/solutions such as GPT-3.

Hugs

2 Likes

Thank you @joseicarobc

Yesterday when I had some spare time I added a few function to retrieve the fine-tuning job details.

First, List the Fine-Tuned Models

Then Click on the FTM ID in the List Above:

Current Functions

Note

Have not added a full chat-bot function because I’m waiting for the OpenAI ChatGPT API and don’t want to waste a half a day writing code which will more-than-likely be OBE by the “coming soon” ChatGPT API.

1 Like

Update:

Added a number of functions to my “help out the users” lab including (1) listing models, (2) generating Dall-E images, and (3) listing files.

Added DB tables to store all the image data so soon will create a list and gallery of images:

Example Image Generation

Image Generator

Current Menu of Functions

TODO

  • Edit images
  • Image Gallery
  • Guided image prompts

So far, have implemented almost all of the OpenAI API methods and params, and have a number of add-ons like JSONL validation, DB storage, DB search to test vectors, etc

Still have not written a chatbot with state management because I’m waiting on the ChatGPT API to release to “great fanfare” soon. I wrote an A.L.I.C.E. chatbot for a forum two decades ago, so have already “been there, done that… blah blah” but if the ChatGPT API is not released soon, I’ll write a chatbot with state / dialog management using the DB for fun.

:slight_smile:

One more, for fun…

Post impressionism intergalactic landscape painting littered with ruined spaceships damaged from an epic space battle in a gravitational interstellar wormhole in the style of Monet’s haystack series.

What a great tool ! Amazing - i wish it could be available for use :slight_smile:

1 Like

Hi @sourabhsardesai40

Thanks for your comment.

Yeah, it now implements almost all OpenAI API methods, 95% I guess.

Waiting for the ChatGPT API to be released … hopefully soon!

:slight_smile:

3 Likes