Send me your questions/problems and I'll make a video answer

Hey folks, Dave Shap Automator back again after a hiatus. Suffice to say, a lot has changed since I’ve been back. My YouTube channel has blown up, thanks in no small part to ChatGPT.

With that said, I’ve done this before. Here’s the last time I did it: Send me your GPT problems, I'll solve them for free and make a YouTube video

I’m getting back in the ring for another round. Here are some advancements that have happened:

  1. Semantic search has really taken off. I’ve been using Pinecone and it’s great.
  2. ChatGPT is, of course, the shiny new thing. It’s such a powerful tool, and we’re still figuring out how to use it.
  3. The concept of cognitive architecture and autonomous AI is taking off.

With all that said, hit me up in this thread. Send me some challenges and I’ll see what I can do.

3 Likes

Would love a deep dive on creating long-term memory specifically for the ChatGPT API, maybe by storing/retrieving messages using Pinecone and other resources. (I know you did a video on chatbot memory a few weeks ago but that was before this API and still based on “prompting” over the current message calls.)

1 Like

Given how wildly popular my first video on the topic was, I was probably going to do just that. Great suggestion.

1 Like

Where is the video on prompting over the new message calls? I am having a lot of trouble making the switch from davinci-003 to turbo.

I am not very savvy in programming but I managed to stumble through it and made a functioning product with davinci-003 that works well. I tried switching to the turbo endpoint but it just won’t work. I’ve been trying for days. If I can somehow manage to make turbo work so I can test it then it would be nice to bring the cost down 10x, with would make my venture much more viable since I am not sure that the current cost of Davinci will even be sustainable with the ratio to revenue possibilities.

The way my prompt currently works is pretty straight forward and it works with the Davinci API endpoint with no issues and I am happy with it for the most part, this is how the prompt works:

const prompt: I enter the prompt instructions here, then add... You previously said "${previousOutputs.join(' ')}", and then the user said "${input}"\n;
const response = await fetch(https://api.openai.com/v1/engines/text-curie-001/completions, {
method: “POST”,
headers: {
“Content-Type”: “application/json”,
“Authorization”: Bearer sk-APIxxx
},
body: JSON.stringify({
prompt: prompt,
temperature: 0.6,
max_tokens: 1000,

That pulls the previous output, and combines it with the new user input in the input box, and sends it as once nice prompt (with instructions that I don’t need to explain here).

I have tried many, many different approaches. I feel like this should work but it doesn’t:

const prompt: I enter the prompt instructions here, then add... You previously said "${previousOutputs.join(' ')}", and then the user said "${input}"\n;
const response = await fetch(https://api.openai.com/v1/chat/completions, {
method: “POST”,
headers: {
“Content-Type”: “application/json”,
“Authorization”: Bearer APIxxx
},
body: JSON.stringify({
model: “gpt-3.5-turbo”,
messages: {“role”: “user”, “content”: prompt},
temperature: 0.6,
max_tokens: 1000,

I have tried putting the actual prompt in the content instead, and every variation of parenthesis, but it just doesn’t work. I have been to a point where I got the request to send to the API and a completion would happen (on the OpenAI admin side I saw it), but it caused other typetext errors and it wouldn’t post to the output, don’t ask me why, I couldn’t figure that out. I just find it strange that making a few small changes like the endpoint URL and switching the prompt to the messages would make such a huge difference and break it beyond repair.

I’m not sure I follow. Are you having prompt issues, API issues, or what? Is the API working, just not providing the output you expect?

I guess the problem is that you sending the ‘message’ as an object and not as an array of objects. Try wrapping it with an array instead.

Following is the example of sending requests through fetch


const fetchChat = async (param: string) => {
    let url = `https://api.openai.com/v1/chat/completions`;
    let prompt = `
    Identify the key take away ideas from the given passage:
    ---
    ${param}
    ---
    
    -.`;
    let bodyObj = {
        max_tokens: 500,
        model: "gpt-3.5-turbo",
        messages: [
            { "role": "system", "content": prompt },
        ],
        temperature: 1,
        top_p: 1,
        presence_penalty: 0.0,
        frequency_penalty: 0.0,
        n: 1,
        stop: ["---"],
    };
    try {
        const response = await fetch(url, {
            headers: {
                "Content-Type": "application/json",
                Authorization: `Bearer ${YOUR_API_KEY}`,
            },
            body: JSON.stringify(bodyObj),
            method: "POST",
        });
        const body = await response.json();
        const respondString = body.choices.map((str: { message: any }) => str.message.content);
        return respondString;
    } catch (error) {
        console.log(error);
    }
};

I appreciate the help, I couldn’t figure this out though. I believe what I did is already in an array, but I could be wrong. I sent you the actual code if you check your inbox, or if anyone else wants to see if they know why it won’t work this is the working code with davinci and the broken code with turbo. I can see that there are requests and completions being made in the OpenAI admin side of things with the new turbo code, but by using that endpoint the response won’t post to the chat output for some reason, it keeps screwing up the typetext function. It doesn’t happen with the davinci endpoint plugged in.

Working and Broken files are on this Google drive folder: turbo-API - Google Drive

I will send a digital $100 Amazon card to anyone that can help make it work for me!

@daveshapautomator - let me first thank you so much for what you do.

Adding to the memory retrieval, I think it would be of tremendous value is to deep dive a little more into chunking or even Vector DB construction. I think the chosen chunking method depends a lot on the use-case. Different use-cases could be:

  • fine-tuning
  • memory retrieval
  • Q&A from various corpus data (in particular, let’s say you have a source of truth corpus and then source material to source-of-truth corpus)
  • Q&A from a book

etcetera. I for one would be extremely interested in that!

Working on it

2 Likes