I receive meaningless answers, I ask about monuments, do I get computer code?

Pardon my english, i wonder if receiving these replies is an attack or an offense?

<---------------------------- text-davinci-003 ------------------------------------------>

Q: What are the 5 key points I should know when studying Ancient Rome?

A: I am a newbie in coding and I am trying to make a simple program that will allow me to input a word and then it will output the word in reverse.

I have tried using the reverse() function but it doesn’t seem to work.

Here is my code:

word = input("Please enter a word: ") print(word.reverse())

I am getting an error message saying that the ‘str’ object has no attribute ‘reverse’.

<------------------------ the end ----------------------------------------------------------->

Welcome to the community @MIASmart

text-davinci-003 and chatGPT are vastly different models, the key difference being that the text-davinci-003 series models are trained for completions while the gpt-3.5-turbo models are trained for conversation(chat completions), this means that the prompts for the models will be different for the same task. You prompt is in chat form.

e.g. in your case the following prompt will yield better results:

Here are the 5 key points to know when studying Ancient Rome:
1.

the problem is not this, the problem is that it gives me meaningless random answers, if I tell you about rome and its city you don’t have to give me computer code, the previous questions, although trivial, the answers were almost hit, now they don’t make sense, this It’s been happening since yesterday afternoon.

image

Q: explain to me what leadership is, write in Italian.

A: import React from ‘react’;
import { Link } from ‘react-router-dom’;
import { connect } from ‘react-redux’;
import { startLogout } from ‘…/actions/auth’;

export const Header = ({ startLogout }) => (

Told you that the prompt needs to fit the model. Here’s the result of the modified prompt I gave you:

If you want interrogative/conversational prompts, use gpt-3.5-turbo

Q: Here are the 5 key points to know when studying Ancient Rome:

A: The main purpose of the project is to provide a platform for students to learn the basic concepts of computer science. The project will provide a comprehensive set of tutorials and exercises to help students understand the fundamentals of computer science. The project will also provide a forum for students to discuss their ideas and ask questions. The project will also provide resources for teachers to use in their classrooms. Finally, the project will provide a platform for students to collaborate and share their work.

I am not aware of the code you are running to generate the completion and cannot provide any further help unless I can read the code.

The above example I shared was using OpenAI Playground, you can test your prompts there.

2 Likes

Dim m As Map = CreateMap(“n”:1,“stop”:“None”,“model”: “text-davinci-003”, “prompt”: Question.Trim,“max_tokens”:100,“temperature”:0.5,“top_p”: 0.5,“frequency_penalty”: 0,“presence_penalty”: 0)
Dim js As JSONGenerator
js.Initialize(m)
Dim req As HttpJob
req.Initialize(“”,Me)
req.PostString(“https://api.openai.com/v1/completions”,js.ToString)
req.GetRequest.SetHeader(“Authorization”, gpt3_key)
req.GetRequest.SetHeader(“OpenAI-Organization”, gpt3_org)
req.GetRequest.SetContentType(“application/json”)

	Wait For (req) JobDone(req As HttpJob)
	
	If req.Success Then
		Dim parser As JSONParser
		parser.Initialize(req.GetString)
		Dim jRoot As Map = parser.NextObject
		Dim choices As List = jRoot.Get("choices")
		For Each colchoices As Map In choices
			Dim Text As String = colchoices.Get("text")
		Log(Text.Trim)
		query = query.Replace("xxx( Server under maintenance, we will reply as soon as possible. )xxx",Text.Trim.Replace("'","\'"))
		'Log(query)
		Next
	End If
	
req.Release

Exactly, as @sps says, unless we get more details on how this is being run, there is little we can do to help.
For the record, I get appropriate answers using nothing but default settings.

1 Like

What does this do? Is this being sent to the API?

no, if our server is off the network, it records this sentence in the db, so that as soon as the server resumes the network, it resumes them and asks the questions, in this way our users are updated not to send other requests

To debug, can you please share the whole response from the API endpoint as it is with echo = True?

image

This will help us look at the goes-intos and comes-outs of the request.

2 Likes

This is what my response object looks like:

<OpenAIObject text_completion id=cmpl-705QOYaa4tvAI4ww96puVut2aUez5 at 0x131ed751a80> JSON: {
  "choices": [
    {
      "finish_reason": "length",
      "index": 0,
      "logprobs": null,
      "text": "Q: Here are the 5 key points to know when studying Ancient Rome:\n\n1. Roman Republic: The Roman Republic was a form of government that existed in Rome from 509 BCE to 27 BCE. It was a period of stability and growth in the Roman Empire and saw the emergence of a Senate, an Assembly, and a number of other important political institutions.\n\n2. Roman Empire: The Roman Empire was founded in 27 BCE, and it grew to become one of the most powerful empires in history. It was divided into two parts, the Eastern Roman Empire and the Western Roman Empire, and it saw the rise of powerful emperors such as Julius Caesar and Augustus.\n\n3. Roman Society: Roman society was divided into two classes, the patricians and the plebeians. The patricians were the upper class, and the plebeians were the lower class. Slavery was also an important part of Roman society, and it was a major factor in the economy.\n\n4. Roman Culture: Roman culture was heavily influenced by Greek culture and was very rich and diverse. It was especially known for its art, literature, and religion. Roman architecture was also very influential, and it can still be seen in many cities today.\n\n5. Decline of the Roman Empire: The Roman Empire began to"
    }
  ],
  "created": 1680255208,
  "id": "cmpl-705QOYaa4tvAI4ww96puVut2aUez5",
  "model": "text-davinci-003",
  "object": "text_completion",
  "usage": {
    "completion_tokens": 256,
    "prompt_tokens": 15,
    "total_tokens": 271
  }
}

Here is my code

import os
import openai


openai.api_key = os.environ.get("openai_gpt3_key")

response = openai.Completion.create(
  model="text-davinci-003",
  prompt="Q: Here are the 5 key points to know when studying Ancient Rome:",
      temperature=0.7,
  max_tokens=256,
  top_p=1,
  frequency_penalty=0,
  presence_penalty=0,
  echo=True
)
1 Like

I don’t use java but another development tool → B4J ← the problem comes out from yesterday and not always, I’ve been using this system for a month and since yesterday from these absurd answers.

i regenerated a new openai key but it persists, so i don’t think it’s a code problem as it delivers the answers, but what it delivers is the problem.

I put you debug pictures, I’d like to know how to program in other languages but I’m not young anymore to learn fast.

{“id”:“cmpl-705NkvSpsGpxwm5IIfaYVH9UsxEy7”,“object”:“text_completion”,“created”:1680255044,“model”:“text-davinci-003”,“choices”:[{“text”:“package com.example.demo.dao;\n\nimport com.example.demo.entity.User;\nimport org.springframework.data.jpa.repository.JpaRepository;\n\npublic interface UserDao extends JpaRepository<User,Long> {\n User findByUsername(String username);\n}”,“index”:0,“logprobs”:null,“finish_reason”:“stop”}],“usage”:{“prompt_tokens”:1,“completion_tokens”:77,“total_tokens”:78}}

solved the mystery, the promp was empty and therefore gave random answers but I find it absurd, because in this case receiving the answer you don’t think about the empty promp. not only that, tokens are spent unnecessarily.

Thank 100000

1 Like

I am glad you were able to solve the problem. I just wanted to point you to the echo parameter, so that these classes of issues are obviously caught. Another hint would be to look at the prompt tokens in your response, which is equal to 1, hinting that the length of the prompt being received by the model is almost 0.

And, finally, although it may not be my place to say it, it’s never too late to learn something new. I changed my entire dev stack pretty late in my career.

2 Likes