How to force ChatGPT to display information from my system message

We have developed a chatbot based upon OpenAI. One of our features is the ability to dynamically reach out and fetch live data that we inject into the stream sent to OpenAI’s APIs, such as for instance query DuckDuckGo for the words “Steve Jobs”. This will result in a context such as the following;

DuckDuckGo the following QUERY

Below are the links I could find related to your QUERY using DuckDuckGo;

… long list of Markdown hyperlinks leading to DuckDuckGo …

However, regardless of how I prime GPT-4 using system messages, it refuses to return links from the above list of URLs. How can I force ChatGPT to ALWAYS use the above list of hyperlinks to answer my questions?

1 Like

The GPT model does not read hyperlink contents, it will just treat the hyper links as text, you must read the hyper links contents, extract the text and pass it to the AI for it to be able to read it

If you have not yet tried, I think using function calling will solve your problem. I tested it and got exactly what you expect.

Using simple function:

{
        name: "search_duckduckgo",
        description: "Search DuckDuckGo from user inquiry",
        parameters: {
            type: "object",
            properties: {
                inquiry: {
                    type: "string",
                    description: "User inquiry, e.g. Steve Jobs",
                }
            },
            required: ["inquiry"]
        }
    }

Using your prompt “Steve Jobs”, will return

{
  role: 'assistant',
  content: null,
  function_call: {
    name: 'search_duckduckgo',
    arguments: '{\n  "inquiry": "Steve Jobs"\n}'
  }
}

I made mocked result:

{
            results: [
                { name: 'link 1', url: 'example.com/link1' },
                { name: 'link 2', url: 'example.com/link2' },
                { name: 'link 3', url: 'example.com/link3' },
                { name: 'link 4', url: 'example.com/link4' },
                { name: 'link 5', url: 'example.com/link5' },
            ]
  }

Final, Chat completions result,

{
  role: 'assistant',
  content: 'Here are some search results for Steve Jobs:\n' +
    '\n' +
    '1. [link 1](example.com/link1)\n' +
    '2. [link 2](example.com/link2)\n' +
    '3. [link 3](example.com/link3)\n' +
    '4. [link 4](example.com/link4)\n' +
    '5. [link 5](example.com/link5)\n' +
    '\n' +
    'You can click on the links to learn more about Steve Jobs.'
}
2 Likes