Need better prompting for graphql code

I am trying to query through my companies graphql using the OpenAI API and gave it specific instructions on how to do so. The api displays the correct numbers while running but when it gives the output it makes it own numbers up. I have been trying every prompt I can think of but it still seems to make up its own value. Any suggestions would help

This is my prompt right now “Given the GraphQL schema provided, dynamically generate a GraphQL query based on the user’s request. Specify the type of information you want to retrieve (e.g., buyers, practices, valuations). Identify the relevant query and fields for the requested information. Ensure the query format follows the pattern ‘query AllData { getData { /* requested fields */ } }’. Execute the query and return the data from the ‘data’ field in the response. Avoid adding any unnecessary details. Stick strictly to the user’s query and requested outputs”

1 Like

So the schema is attached as a file? Why not add it in the prompt as well - and you might have to be more specific on the exact mapping ‘buyers, practices, valuations’ to GraphQL fields. And wether the API specifies required fields vs how it would need to get those - or what default values to use. This seems like a very short prompt to me.

1 Like