feat(agents): add prompts for explain code tool
What does this merge request do and why?
Agent definition for duo chat explain code tool
This MR copies this prompt to AI Gateway. When v1/agents/chat/explain_code
endpoint is requested, it'll build the prompt on AI Gateway and send it to LLM.
Related:
- Execute Duo Chat explain code tool via agents (gitlab-org/gitlab!160252 - merged)
- Adding strategy for migrating Duo Chat tools to... (gitlab-com/content-sites/handbook!7380 - merged)
- Migrate Duo Chat Tools: ExplainCode (gitlab-org/gitlab#475050 - closed)
Test
Perform POST v1/agents/chat/explain_code
with the following params:
{
"params": {
"language_info": "Ruby",
"file_content": "puts 'hello'",
"selected_text": "puts 'hello'",
"input": "puts 'hello'"
},
"stream": false
}
Or
- Run AI Gateway with Anthropic debug:
ANTHROPIC_LOG=debug poetry run ai_gateway
- Enable
prompt_migration_explain_code
feature flag on Rails - Perform
/explain
slash command in Duo Chat - Verify that
v1/agents/chat/explain_code
endpoint is called - Verify that the correct prompt is sent to Anthropic
Edited by Igor Drozdov