mirror of
https://github.com/block/goose.git
synced 2026-06-01 22:11:07 +02:00
create goose-providers
This commit is contained in:
+7
-7
@@ -45,7 +45,7 @@ goose's architecture is designed for extensibility. Organizations can create "re
|
||||
| What You Want | Where to Look | Complexity |
|
||||
|---------------|---------------|------------|
|
||||
| Preconfigure a model/provider | `config.yaml`, `init-config.yaml`, environment variables | Low |
|
||||
| Add custom AI providers | `crates/goose/src/providers/declarative/` | Low |
|
||||
| Add custom AI providers | `crates/goose-providers/src/providers/declarative/` | Low |
|
||||
| Bundle custom MCP extensions | `config.yaml` extensions section, `ui/desktop/src/built-in-extensions.json`, `ui/desktop/src/components/settings/extensions/bundled-extensions.json` | Medium |
|
||||
| Modify system prompts | `crates/goose/src/prompts/` | Low |
|
||||
| Customize desktop branding | `ui/desktop/` (icons, names, colors) | Medium |
|
||||
@@ -132,7 +132,7 @@ export OLLAMA_HOST=http://localhost:11434 # Or your hosted instance
|
||||
### Technical Details
|
||||
|
||||
- Provider configuration: `crates/goose/src/config/base.rs`
|
||||
- Ollama provider implementation: `crates/goose/src/providers/ollama.rs`
|
||||
- Ollama provider implementation: `crates/goose-providers/src/providers/ollama.rs`
|
||||
- Config precedence: Environment variables → config.yaml → defaults
|
||||
|
||||
---
|
||||
@@ -510,16 +510,16 @@ Supported engines: `openai`, `anthropic`, `ollama`
|
||||
|
||||
For providers with unique APIs, implement the Provider trait:
|
||||
|
||||
1. Create a new file in `crates/goose/src/providers/`
|
||||
1. Create a new file in `crates/goose-providers/src/providers/`
|
||||
2. Implement the `Provider` trait from `base.rs`
|
||||
3. Register in `crates/goose/src/providers/factory.rs`
|
||||
3. Register in `crates/goose-providers/src/providers/init.rs`
|
||||
|
||||
### Technical Details
|
||||
|
||||
- Declarative providers: `crates/goose/src/config/declarative_providers.rs`
|
||||
- Provider trait: `crates/goose/src/providers/base.rs`
|
||||
- Provider registration: `crates/goose/src/providers/factory.rs`
|
||||
- Example providers: `crates/goose/src/providers/declarative/*.json`
|
||||
- Provider trait: `crates/goose-providers/src/providers/base.rs`
|
||||
- Provider registration: `crates/goose-providers/src/providers/init.rs`
|
||||
- Example providers: `crates/goose-providers/src/providers/declarative/*.json`
|
||||
|
||||
---
|
||||
|
||||
|
||||
Generated
+14
@@ -4669,6 +4669,20 @@ dependencies = [
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "goose-providers"
|
||||
version = "1.36.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"clap",
|
||||
"goose",
|
||||
"reqwest 0.13.4",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "goose-sdk"
|
||||
version = "1.36.0"
|
||||
|
||||
@@ -318,7 +318,7 @@ bump-version version:
|
||||
|
||||
# rebuild canonical model registry and mapping report from models.dev
|
||||
build-canonical-models:
|
||||
@cargo run --bin build_canonical_models
|
||||
@cargo run -p goose-providers --features rustls-tls --bin build_canonical_models
|
||||
|
||||
# bump version, rebuild canonical models, and commit
|
||||
prepare-release version:
|
||||
@@ -330,8 +330,8 @@ prepare-release version:
|
||||
ui/desktop/package.json \
|
||||
ui/pnpm-lock.yaml \
|
||||
ui/desktop/openapi.json \
|
||||
crates/goose/src/providers/canonical/data/canonical_models.json \
|
||||
crates/goose/src/providers/canonical/data/provider_metadata.json
|
||||
crates/goose-providers/src/providers/canonical/data/canonical_models.json \
|
||||
crates/goose-providers/src/providers/canonical/data/provider_metadata.json
|
||||
@git commit --message "chore(release): release version {{ version }}"
|
||||
|
||||
set-openapi-version version:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! Providers for the scenario tests. Keep in sync with
|
||||
//! goose/crates/goose/src/providers/factory.rs
|
||||
//! goose/crates/goose-providers/src/providers/init.rs
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
[package]
|
||||
name = "goose-providers"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
authors.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
description = "Provider implementations for Goose"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[features]
|
||||
default = []
|
||||
code-mode = ["goose/code-mode"]
|
||||
local-inference = ["goose/local-inference"]
|
||||
aws-providers = ["goose/aws-providers"]
|
||||
cuda = ["goose/cuda", "local-inference"]
|
||||
vulkan = ["goose/vulkan", "local-inference"]
|
||||
telemetry = ["goose/telemetry"]
|
||||
nostr = ["goose/nostr"]
|
||||
otel = ["goose/otel"]
|
||||
system-keyring = ["goose/system-keyring"]
|
||||
portable-default = ["goose/portable-default"]
|
||||
rustls-tls = ["goose/rustls-tls", "reqwest/rustls"]
|
||||
native-tls = ["goose/native-tls", "reqwest/native-tls"]
|
||||
|
||||
[dependencies]
|
||||
goose = { path = "../goose", default-features = false }
|
||||
anyhow = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
clap = { workspace = true }
|
||||
reqwest = { workspace = true, features = ["json"] }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
|
||||
|
||||
[[bin]]
|
||||
name = "build_canonical_models"
|
||||
path = "src/providers/canonical/build_canonical_models.rs"
|
||||
@@ -0,0 +1,7 @@
|
||||
//! Provider implementations for Goose.
|
||||
//!
|
||||
//! The implementation files live in this crate and are compiled into the main
|
||||
//! `goose` crate to preserve the existing `goose::providers` public API.
|
||||
|
||||
pub use goose::providers;
|
||||
pub use goose::providers::*;
|
||||
+2
-2
@@ -7,8 +7,8 @@ to canonical IDs (e.g., `anthropic/claude-3.5-sonnet`).
|
||||
## Build Canonical Models
|
||||
Fetches latest model metadata from OpenRouter and validates provider mappings:
|
||||
```bash
|
||||
cargo run --bin build_canonical_models # Build and check (default)
|
||||
cargo run --bin build_canonical_models --no-check # Build only, skip checker
|
||||
cargo run -p goose-providers --features rustls-tls --bin build_canonical_models # Build and check (default)
|
||||
cargo run -p goose-providers --features rustls-tls --bin build_canonical_models --no-check # Build only, skip checker
|
||||
```
|
||||
|
||||
This script performs two operations by default:
|
||||
+4
-4
@@ -4,15 +4,15 @@
|
||||
/// By default, it also checks which models from top providers are properly mapped.
|
||||
///
|
||||
/// Usage:
|
||||
/// cargo run --bin build_canonical_models # Build and check (default)
|
||||
/// cargo run --bin build_canonical_models --no-check # Build only, skip checker
|
||||
/// cargo run -p goose-providers --features rustls-tls --bin build_canonical_models # Build and check (default)
|
||||
/// cargo run -p goose-providers --features rustls-tls --bin build_canonical_models --no-check # Build only, skip checker
|
||||
///
|
||||
use anyhow::{Context, Result};
|
||||
use clap::Parser;
|
||||
use goose::providers::canonical::{
|
||||
use goose_providers::canonical::{
|
||||
canonical_name, CanonicalModel, CanonicalModelRegistry, Limit, Modalities, Modality, Pricing,
|
||||
};
|
||||
use goose::providers::{canonical::ModelMapping, create_with_named_model};
|
||||
use goose_providers::{canonical::ModelMapping, create_with_named_model};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use std::collections::{BTreeMap, BTreeSet, HashMap};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user