Skip to content

Log errors attributes on blocked Vertex response

Tan Le requested to merge 313-track-vertex-blocked-errors into main

What does this merge request do and why?

Code completion model, i.e. code-gecko@latest sometime can suggest output that is blocked due to errors. We would like to log this information to better distinguish with blocked requests due to content filter.

How to set up and validate locally

  1. Check out to this merge request's branch.
  2. Ensure a local Docker image built successfully.
    docker buildx build --platform linux/amd64 -t ai-gateway:test .
  3. Run a local service on Docker.
    docker run --platform linux/amd64 --rm \
      -p 5052:5052 \
      -e AUTH_BYPASS_EXTERNAL=true \
      -v $PWD:/app -it ai-gateway:test
  4. Send a cURL request to the /v2/completions endpoint
    $ curl --request POST \
      --url http://codesuggestions.gdk.test:5052/v2/completions \
      --header 'Content-Type: application/json' \
      --header 'X-Gitlab-Authentication-Type: oidc' \
      --header 'authorization: Bearer jwt \
      --data '{
      "prompt_version": 1,
      "project_path": "gitlab-org/gitlab",
      "project_id": 278964,
      "current_file": {
        "file_name": "main.php",
        "content_above_cursor": "<?php\n\nuse Laravel\\Sanctum\\Sanctum;\n\nreturn [\n\n    /*\n    |-------------------------------------------",
        "content_below_cursor": ""
      }
    }'
  5. Observe a log entry with errors attribute (formatted for legibility)
    {
      ...
      "blocked": true,
      "error_codes": [230],
      ...
    }

Merge request checklist

  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.

Relates to #313 (closed)

Edited by Tan Le

Merge request reports