RUDRA_RECOMMENDATIONS_INSTRUCTIONS
import { RUDRA_RECOMMENDATIONS_INSTRUCTIONS } from '@rudra-js/a2ui/server';RUDRA_RECOMMENDATIONS_INSTRUCTIONS lets you tell your agent how to use the block. Pass it as the instructions of the catalog your agent is prompted with.
RUDRA_RECOMMENDATIONS_INSTRUCTIONS: stringReference
RUDRA_RECOMMENDATIONS_INSTRUCTIONS
Returns
A string. It tells the agent to place the block and say what the shopper is looking at. It says the shop picks the products and writes the heading. It asks the agent not to write product names, prices, ratings or offers around the block.
Caveats
- It's a request to the model. The agent's own components, such as a
Textbeside the block, show the agent's own words. Those can still state a price. - To add catalog instructions of your own, join them to it, such as
[yours, RUDRA_RECOMMENDATIONS_INSTRUCTIONS].join('\n\n').
Usage
Telling your agent how to use the block
Pass it in the options, the last argument to Catalog.
import { Catalog } from '@a2ui/web_core/v0_9';
import { basicCatalog } from '@a2ui/web_core/v0_9/basic_catalog';
import { RUDRA_RECOMMENDATIONS_INSTRUCTIONS, rudraRecommendationsApi } from '@rudra-js/a2ui/server';
export const agentCatalog = new Catalog(
'https://shop.example/a2ui/catalog.json',
'v0.9',
[...basicCatalog.components.values(), rudraRecommendationsApi],
[...basicCatalog.functions.values()],
{ instructions: RUDRA_RECOMMENDATIONS_INSTRUCTIONS },
);The catalog JSON carries it as instructions, so it reaches the agent with agentCatalog.toJson().