Skip to content

Adding candidateCount to parameters for vertex_text code models

Jeff Park requested to merge 474-add-candidatecount-to-code-completions-api into main

What does this merge request do and why?

Adds candidateCount to the code completion API so that clients can consume it to generate code suggestions

Adding candidateCount to parameters for vertex_text code models

Adds candidateCount to parameters for vertex code models to open up ability to cycle through code suggestions.

issue feature issue

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Check out this MR branch
  2. Run ai_gateway using the following instructions
  3. run the following command in the /docs or in your terminal
curl -X 'POST' \
  'http://localhost:5052/v2/code/completions' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "project_path": "string",
  "project_id": 0,
  "current_file": {
    "file_name": "main.py",
    "language_identifier": "python",
    "content_above_cursor": "print(",
    "content_below_cursor": ""
  },
  "model_provider": "vertex-ai",
  "model_endpoint": "https://us-central1-aiplatform.googleapis.com/v1/projects/ai-enablement-dev-69497ba7/locations/us-central1/publishers/google/models/code-gecko@002:predict",
  "model_name": "code-gecko@002",
  "telemetry": [],
  "stream": false,
  "options_count": 2,
  "prompt_version": 1 
}’

Merge request checklist

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

Closes #474 (closed)

Edited by Jeff Park

Merge request reports