Single chat completion request, multiple answers

I’m very new at all of this. I am building an application that runs on a fine tuned ChatGPT model. This model should return 2 answers from a single request: an answer to my request + the most important keyword. Why? I want the application user be able to click on the keyword to create a new ChatGPT request.

For example:

  • Request: Tell me about Antoni Gaudi
  • Answer 1: Gaudi is one of the key figures in Catalan modernism
  • Answer2: Modernism

Would this JSONL work?
{“messages”: [
{“role”:“system”,“content”:“You are a guide”},
{“role”: “user”, “content”: “Tell me about Anthoni Gaudi”},
{“role”: “assistant”, “content”: “Gaudi is one of the key figures in Catalan modernism”}
{“role”: “assistant”, “content”: “Modernism”}]}

Hey there and welcome to the community!

Are you prepared to hard-link a keyword yourself? Because the APIs specifically do not have such a feature built in. You may be better off creating your own tool for this, if that’s what you want.

The schema you presented shows a simple example. You could use the name param to something like “example” to show the model the appropriate response style. However, you would need to make sure to pass this in alongside the rest of the actual query, and it won’t produce 2 responses without two API calls. If you wanted a keyword in one response, perhaps an example like:

would help it. However, this won’t solve the link problem; you would need your own method to do such a thing.

What has it produced so far?

Hi Macha!

Thanks for taking the time to answer, really appreciate it!! :smiley:

Haven’t really built it yet, so it was all still in my head.

I like your idea of having it in the same answer as well but can’t find my way around making the keywords clickable. At least not right now.

Initially - since a single api call can return multiple ‘choices’ - I was hoping the to return a first choice with the answer to the user prompt and a second choice with the keyword the system used. However, I guess the choices are directly related to the user prompt, and not to the answer coming from the assistant. So the solution would be to create a second api call with the assistant’s answer and a question to identify the main keywords.

That, or I give the application user the possibility to write the keyword.

For example:

  • User: tell me about Anthoni Gaudi
  • Assistant: Gaudi is one of the key figures in Catalan modernism
  • User: tell me more about Modernism in relation to Antoni Gaudi
  • Assistant: Modernism is …

It is hard to get the AI to write links to nowhere in its text. This is because it can’t “see” the word before it actually produces it.

Your first idea is relatively easy, with just some parsing code to extract your keywords you want to make as new “starters”.

You are a helpful chatbot AI that is used for information research, answering from your vast training on world knowledge.

// Output format
1. Produce the normal response to the user
2. Produce two keywords related to the topic and category, each contained within triple square brackets.

// Example output
"""
In the Python programming language, the use of decorators can assign new behaviors directly to functions.

[[[Python]]] [[[decorators]]]
"""

This idea seemed like it could work, but then the AI, realizing that it hadn’t produced any of that in the body, just added an extra sentence at the end, and used the understanding of three asterisks as being markdown’s bold italics, and wrapped the words. It could be expanded on more in prompting, but would remain fragile even to GPT-4 non-turbo.

// Output format
While producing responses, you also have a goal of finding at least two words that represent the category or topic of the response. These words will be immediately followed by *** (three asterisks) which makes them clickable, to learn more.