mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:10:45 +00:00
feat(github-copilot): add embedding provider for memory search (#61718)
Merged via squash.
Prepared head SHA: 05a78ce7f2
Co-authored-by: feiskyer <676637+feiskyer@users.noreply.github.com>
Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com>
Reviewed-by: @vincentkoc
This commit is contained in:
@@ -15,8 +15,9 @@ chunks and searching them using embeddings, keywords, or both.
|
||||
|
||||
## Quick start
|
||||
|
||||
If you have an OpenAI, Gemini, Voyage, or Mistral API key configured, memory
|
||||
search works automatically. To set a provider explicitly:
|
||||
If you have a GitHub Copilot subscription, OpenAI, Gemini, Voyage, or Mistral
|
||||
API key configured, memory search works automatically. To set a provider
|
||||
explicitly:
|
||||
|
||||
```json5
|
||||
{
|
||||
@@ -35,15 +36,16 @@ node-llama-cpp).
|
||||
|
||||
## Supported providers
|
||||
|
||||
| Provider | ID | Needs API key | Notes |
|
||||
| -------- | --------- | ------------- | ---------------------------------------------------- |
|
||||
| OpenAI | `openai` | Yes | Auto-detected, fast |
|
||||
| Gemini | `gemini` | Yes | Supports image/audio indexing |
|
||||
| Voyage | `voyage` | Yes | Auto-detected |
|
||||
| Mistral | `mistral` | Yes | Auto-detected |
|
||||
| Bedrock | `bedrock` | No | Auto-detected when the AWS credential chain resolves |
|
||||
| Ollama | `ollama` | No | Local, must set explicitly |
|
||||
| Local | `local` | No | GGUF model, ~0.6 GB download |
|
||||
| Provider | ID | Needs API key | Notes |
|
||||
| -------------- | ---------------- | ------------- | ---------------------------------------------------- |
|
||||
| Bedrock | `bedrock` | No | Auto-detected when the AWS credential chain resolves |
|
||||
| Gemini | `gemini` | Yes | Supports image/audio indexing |
|
||||
| GitHub Copilot | `github-copilot` | No | Auto-detected, uses Copilot subscription |
|
||||
| Local | `local` | No | GGUF model, ~0.6 GB download |
|
||||
| Mistral | `mistral` | Yes | Auto-detected |
|
||||
| Ollama | `ollama` | No | Local, must set explicitly |
|
||||
| OpenAI | `openai` | Yes | Auto-detected, fast |
|
||||
| Voyage | `voyage` | Yes | Auto-detected |
|
||||
|
||||
## How search works
|
||||
|
||||
|
||||
@@ -119,6 +119,46 @@ Requires an interactive TTY. Run the login command directly in a terminal, not
|
||||
inside a headless script or CI job.
|
||||
</Warning>
|
||||
|
||||
## Memory search embeddings
|
||||
|
||||
GitHub Copilot can also serve as an embedding provider for
|
||||
[memory search](/concepts/memory-search). If you have a Copilot subscription and
|
||||
have logged in, OpenClaw can use it for embeddings without a separate API key.
|
||||
|
||||
### Auto-detection
|
||||
|
||||
When `memorySearch.provider` is `"auto"` (the default), GitHub Copilot is tried
|
||||
at priority 15 -- after local embeddings but before OpenAI and other paid
|
||||
providers. If a GitHub token is available, OpenClaw discovers available
|
||||
embedding models from the Copilot API and picks the best one automatically.
|
||||
|
||||
### Explicit config
|
||||
|
||||
```json5
|
||||
{
|
||||
agents: {
|
||||
defaults: {
|
||||
memorySearch: {
|
||||
provider: "github-copilot",
|
||||
// Optional: override the auto-discovered model
|
||||
model: "text-embedding-3-small",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
### How it works
|
||||
|
||||
1. OpenClaw resolves your GitHub token (from env vars or auth profile).
|
||||
2. Exchanges it for a short-lived Copilot API token.
|
||||
3. Queries the Copilot `/models` endpoint to discover available embedding models.
|
||||
4. Picks the best model (prefers `text-embedding-3-small`).
|
||||
5. Sends embedding requests to the Copilot `/embeddings` endpoint.
|
||||
|
||||
Model availability depends on your GitHub plan. If no embedding models are
|
||||
available, OpenClaw skips Copilot and tries the next provider.
|
||||
|
||||
## Related
|
||||
|
||||
<CardGroup cols={2}>
|
||||
|
||||
@@ -37,23 +37,24 @@ plugin-owned config, transcript persistence, and safe rollout pattern.
|
||||
|
||||
## Provider selection
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
| ---------- | --------- | ---------------- | ------------------------------------------------------------------------------------------- |
|
||||
| `provider` | `string` | auto-detected | Embedding adapter ID: `openai`, `gemini`, `voyage`, `mistral`, `bedrock`, `ollama`, `local` |
|
||||
| `model` | `string` | provider default | Embedding model name |
|
||||
| `fallback` | `string` | `"none"` | Fallback adapter ID when the primary fails |
|
||||
| `enabled` | `boolean` | `true` | Enable or disable memory search |
|
||||
| Key | Type | Default | Description |
|
||||
| ---------- | --------- | ---------------- | ------------------------------------------------------------------------------------------------------------- |
|
||||
| `provider` | `string` | auto-detected | Embedding adapter ID: `bedrock`, `gemini`, `github-copilot`, `local`, `mistral`, `ollama`, `openai`, `voyage` |
|
||||
| `model` | `string` | provider default | Embedding model name |
|
||||
| `fallback` | `string` | `"none"` | Fallback adapter ID when the primary fails |
|
||||
| `enabled` | `boolean` | `true` | Enable or disable memory search |
|
||||
|
||||
### Auto-detection order
|
||||
|
||||
When `provider` is not set, OpenClaw selects the first available:
|
||||
|
||||
1. `local` -- if `memorySearch.local.modelPath` is configured and the file exists.
|
||||
2. `openai` -- if an OpenAI key can be resolved.
|
||||
3. `gemini` -- if a Gemini key can be resolved.
|
||||
4. `voyage` -- if a Voyage key can be resolved.
|
||||
5. `mistral` -- if a Mistral key can be resolved.
|
||||
6. `bedrock` -- if the AWS SDK credential chain resolves (instance role, access keys, profile, SSO, web identity, or shared config).
|
||||
2. `github-copilot` -- if a GitHub Copilot token can be resolved (env var or auth profile).
|
||||
3. `openai` -- if an OpenAI key can be resolved.
|
||||
4. `gemini` -- if a Gemini key can be resolved.
|
||||
5. `voyage` -- if a Voyage key can be resolved.
|
||||
6. `mistral` -- if a Mistral key can be resolved.
|
||||
7. `bedrock` -- if the AWS SDK credential chain resolves (instance role, access keys, profile, SSO, web identity, or shared config).
|
||||
|
||||
`ollama` is supported but not auto-detected (set it explicitly).
|
||||
|
||||
@@ -62,14 +63,15 @@ When `provider` is not set, OpenClaw selects the first available:
|
||||
Remote embeddings require an API key. Bedrock uses the AWS SDK default
|
||||
credential chain instead (instance roles, SSO, access keys).
|
||||
|
||||
| Provider | Env var | Config key |
|
||||
| -------- | ------------------------------ | --------------------------------- |
|
||||
| OpenAI | `OPENAI_API_KEY` | `models.providers.openai.apiKey` |
|
||||
| Gemini | `GEMINI_API_KEY` | `models.providers.google.apiKey` |
|
||||
| Voyage | `VOYAGE_API_KEY` | `models.providers.voyage.apiKey` |
|
||||
| Mistral | `MISTRAL_API_KEY` | `models.providers.mistral.apiKey` |
|
||||
| Bedrock | AWS credential chain | No API key needed |
|
||||
| Ollama | `OLLAMA_API_KEY` (placeholder) | -- |
|
||||
| Provider | Env var | Config key |
|
||||
| -------------- | -------------------------------------------------- | --------------------------------- |
|
||||
| Bedrock | AWS credential chain | No API key needed |
|
||||
| Gemini | `GEMINI_API_KEY` | `models.providers.google.apiKey` |
|
||||
| GitHub Copilot | `COPILOT_GITHUB_TOKEN`, `GH_TOKEN`, `GITHUB_TOKEN` | Auth profile via device login |
|
||||
| Mistral | `MISTRAL_API_KEY` | `models.providers.mistral.apiKey` |
|
||||
| Ollama | `OLLAMA_API_KEY` (placeholder) | -- |
|
||||
| OpenAI | `OPENAI_API_KEY` | `models.providers.openai.apiKey` |
|
||||
| Voyage | `VOYAGE_API_KEY` | `models.providers.voyage.apiKey` |
|
||||
|
||||
Codex OAuth covers chat/completions only and does not satisfy embedding
|
||||
requests.
|
||||
|
||||
Reference in New Issue
Block a user