Skip to content

feat: add mistral API support

Allen Cook requested to merge acook/mistral_api_code_completion into main

What does this merge request do and why?

Adds support for Mistral API to AI Gateway for code completions, does support streaming

See https://gitlab.com/gitlab-org/gitlab/-/issues/470171

How to set up and validate locally

Send a valid request to the code completions endpoint requesting codestral-latest from mistral provider

Example URL - http://gdk.test:5052/v2/code/completions

Example Payload -

{
  "current_file": {
    "file_name": "main.go",
    "language_identifier": "go",
    "content_above_cursor": "func parseEnvFile(filename string) (map[string]string, error) {",
    "content_below_cursor": "}"
  },
  "model_provider": "mistral",
  "model_name": "codestral-latest",
  "telemetry": [],
  "stream": true,
  "prompt_version": 2,
  "prompt": "func parseEnvFile(filename string)"
}

Merge request checklist

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

Merge request reports