0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-10 21:51:49 +08:00
discourse/plugins/discourse-ai/app/controllers
Evan Tobin fc49238104
FEATURE: add Google Vertex AI LLM provider (#41350)
## What does this change?

Adds Google Vertex AI as a supported LLM provider for `discourse-ai`.

This provider reuses the existing Gemini dialect, but sends requests to
Vertex AI's native
`generateContent` and `streamGenerateContent` endpoints. It supports
Google Cloud
environment credentials through the metadata server, so deployments
running on Google Cloud
do not need to store an API key in Discourse.

## Details

- Adds a `google_vertex_ai` provider.
- Adds a `GoogleVertexAi` endpoint.
- Reuses Gemini prompt translation and response handling.
- Adds Vertex provider params for `project_id` and `region`.
- Adds a Gemini Vertex preset.
- Supports `global` and regional Vertex AI endpoints.
- Accepts model names with a leading `google/` prefix and strips it for
native Vertex URLs.
- Moves provider-specific URL and credential requirements onto endpoint
capabilities:
  - `supports_environment_credentials?`
  - `requires_configured_url?`

## Tests

```bash
bin/rspec plugins/discourse-ai/spec/lib/completions/endpoints/google_vertex_ai_spec.rb \
  plugins/discourse-ai/spec/lib/completions/llm_presets_spec.rb \
  plugins/discourse-ai/spec/models/llm_model_spec.rb
```

18 examples, 0 failures

---------

Co-authored-by: Rafael Silva <xfalcox@gmail.com>
2026-07-16 15:13:22 -03:00
..
concerns DEV: Unify locale copy and use absolute date (#36443) 2025-12-04 13:48:38 -08:00
discourse_ai FEATURE: add Google Vertex AI LLM provider (#41350) 2026-07-16 15:13:22 -03:00