#What is the API call that ChatGPT uses? I'm having trouble replicating its results in the API

26 messages · Page 1 of 1 (latest)

glacial linden
#

What I mean is like this part in particular, the payload that I'm sending to the chat completions API, I'm wondering what is the format and content that ChatGPT is using:

messages=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": prompt },
      ]
covert parcel
glacial linden
glacial linden
# covert parcel Show me your call
result = openai.ChatCompletion.create(
    model="gpt-3.5-turbo",
    messages=[
          {"role": "system", "content": "You are ChatGPT, a large language model trained by OpenAI, based on the GPT-3.5 architecture. Knowledge cutoff: 2021-09. Current date: 2023-05-21."},
          {"role": "user", "content": FINAL_PROMPT},
      ]
  )

where FINAL_PROMPT is the same thing I send in the web UI

covert parcel
#

So you aren't using any options specified in the api docs

glacial linden
#

You mean like temperature?

covert parcel
#

Try setting temperature to 0.7

#

I don't rightly know what the "default" is but 0.7 is the favored value.

#

What variation between the API and ChatGPT are you referring to?

glacial linden
#

I'll try it now

covert parcel
#

It's not 1. 1 is too high.

glacial linden
#

In particular I'm having the API do some progressive summarization, and the web UI is much better at keeping details whereas the API calls are unnecessarily terse and removing information

covert parcel
#

Oh, actually you're right

#

It does default to 1

#

Yeah definitely try 0.7

glacial linden
#

Yeah! I'm reading it now the API defaults to 1 but ChatGPT defaults to 0.7

covert parcel
#

The API doesn't remember conversations so unless you're feeding prior messages to it in each call, it treats everything as if it's a totally new discussion.

glacial linden
covert parcel
#

If you ask it a question and then ask it a second question that needs the context of the first, without adding both of those to the new prompt the model will behave erratically.

glacial linden
# covert parcel Right but what I mean is, if you're sending it multiple messages as in a normal ...

No for each completion I just send the one message, it looks like this:

User
Progressively summarize the relationship of the two characters based on the conversations provided, adding or modifying the previous summary returning a new summary. [and other stuff]

EXAMPLE
Current summary:
The human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good.

Next of conversation:
Human: Why do you think artificial intelligence is a force for good?
AI: Because artificial intelligence will help humans reach their full potential.

New summary:
The human has been chatting with an AI. The human is curious about the AI's views of artificial intelligence. The AI seems to feel positively about artificial intelligence and feels it will help humans achieve more. The AI tends to answer directly to the point.
END OF EXAMPLE

Current summary:

I have been chatting with my friend.

Next conversation:

A: Hi friend!
B: Hello!

New summary:

And I update the current summary and next conversation sections for each call

#

Anyway I think it's working, with the 0.7 temperature! Thank you!