I’m trying to create an assistant that converts natural text/instructions to complete a GraphQL API variables.
I have 3x contextual files uploaded to help it assist me:
- schema.graphql.txt (can’t have graphql file extension)
- brands.json (contains a JSON of Brand names and their IDs)
- games.json (contains a JSON of Game names and their IDs)
It MOSTLY seems to consistently understand the graphql structure (other times it just guesses a random structure), but it doesn’t use the correct brandIds or gameIds that are in the JSON files and will generate something like this:
{
"brandIds": ["NintendoExample"],
"gameIds": ["SuperMarioGalaxyExample", "SuperMetroidPrimeExample"],
"minBet": 0.1,
"endAt": "2024-10-28"
}
I can correct it afterwards in conversation like: the brandIds are wrong… the gameIds are wrong… and then at that point it seems to try a little harder and search my JSON files for the IDs.
Those JSON files look like this:
brands.json:
[{ "brandId": "nintendo", "name": "Nintendo" }, { ... }]
games.json:
[{ "gameId": "super-mario-galaxy", "name": "Super Mario Galaxy" }, { ... }]
In my system text I’ve tried adding some extra instructions, but it doesn’t force it to look:
You can resolve brandIds from brands.json and gameIds from games.json
Is there a way I can consistently hint at it to look inside the JSON files I’ve provided?
Example of prompt:
I would like you to respond with only JSON and no explanation or markdown. For example if you must provide a userId of 1 you would respond with { "userId": 1 }.
Given this GraphQL Input:CreateTournamentInput
.
I want to create a public tournament for the Nintendo brand, active for the rest of this month with the following games: Super Mario Galaxy, Super Metroid Prime. The winners will be determined by amount descending and the users will be paid out automatically. Users need to bet a minimum of 0.1 EUR.
System instructions:
Create a JSON structure that contains the necessary variables for a GraphQL API call against the schema file. You can find brandIds for brands by name and Game data is searchable also.
Steps
- Identify the variables needed for the GraphQL API call. This will vary based on the specific query or mutation you want to execute.
- Structure these variables in a JSON format, using proper syntax and nesting as required.
Output Format
The output should be a JSON object containing key-value pairs, where the keys are the variable names and the values are the corresponding data you wish to pass to the GraphQL API.
Examples
Input Example:
Variables needed:userId
,limit
Output Example:
{ "userId": "12345", "limit": 10 }
Notes
- Ensure all variable names match those expected by the GraphQL schema already provided.
- Consider data types expected (e.g., strings, numbers, booleans, enums) and ensure values are formatted correctly.