Draft: [Do not merge] Get file metadata using the Anthropic claude model
What does this merge request do and why?
This is an experimental MR created to benchmark the idea of getting file metadata by calling the Anthropic model with the code content.
How to set up and validate locally
- Set the
ANTHROPIC_API_KEY
env variable in your.env
file. - Start the service and go to
http://localhost:5052/docs
- The
code metadata experimental
section contains all supported endpoints to retrieve metadata from the code content.
Example 1:
Invoke the endpoint with a single input:
curl -X 'POST' \
'http://localhost:5052/experimental/code/metadata/invoke' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"input": {
"file_path": "app.py",
"code": "def hello_world():\n\tprint('\''hi'\'')"
},
"config": {},
"kwargs": {}
}'
Example 2:
Invoke the endpoint with a batch input:
curl -X 'POST' \
'http://localhost:5052/experimental/code/metadata/batch' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"inputs": [
{
"file_path": "app.py",
"code": "def hello_world():\n\tprint('\''hi'\'')"
},
{
"file_path": "app1.py",
"code": "def hello_world(s):\n\tprint(f'\''hi {s}'\'')"
}
],
"config": {},
"kwargs": {}
}'
Merge request checklist
-
Tests added for new functionality. If not, please raise an issue to follow up. -
Documentation added/updated, if needed.
cc @oregand