Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ jobs:
# the login password doesn't matter, but the keyring must be unlocked for the tests to work
run: gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar'

- name: Install UV
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Run download_tokenizer_files.py
run: uv run download_tokenizer_files.py

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/desktop-app-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ jobs:
restore-keys: |
${{ runner.os }}-cargo-build-

# Install UV and download tokenizer files
- name: Install UV
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Run download_tokenizer_files.py
run: uv run download_tokenizer_files.py

# Build Rust Binary
- name: Build Release Binary
run: cargo build --release
Expand All @@ -68,7 +60,7 @@ jobs:
working-directory: ui/desktop
env:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}

- name: Set up Node.js
uses: actions/setup-node@v2
Expand All @@ -91,4 +83,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: Goose.zip
path: ui/desktop/out/Goose-darwin-arm64/Goose.zip
path: ui/desktop/out/Goose-darwin-arm64/Goose.zip
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ Cargo.lock
# UI
./ui/desktop/node_modules
./ui/desktop/out

# Hermit
/.hermit/
/bin/
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ This is the branch for goose 1.0 WIP: which is a port over from python to rust +
## Building

```sh
./download_tokenizer_files.sh
cargo build
```

Expand Down
10 changes: 9 additions & 1 deletion crates/goose/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ license.workspace = true
repository.workspace = true
description.workspace = true

[build-dependencies]
tokio = { version = "1.36", features = ["full"] }
reqwest = { version = "0.11", features = ["json"] }

[dependencies]
mcp-core = { path = "../mcp-core" }
dirs = "5.0.1"
Expand Down Expand Up @@ -44,7 +48,11 @@ libc = "=0.2.167"
lazy_static = "1.5"
kill_tree = "0.2.4"

keyring = { version = "3.6.1", features = ["apple-native", "windows-native", "sync-secret-service"] }
keyring = { version = "3.6.1", features = [
"apple-native",
"windows-native",
"sync-secret-service",
] }
shellexpand = "3.1.0"
rust_decimal = "1.36.0"
rust_decimal_macros = "1.36.0"
Expand Down
58 changes: 58 additions & 0 deletions crates/goose/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
use std::error::Error;
use std::fs;
use std::path::Path;

const BASE_DIR: &str = "../../tokenizer_files";
const MODELS: &[&str] = &[
"Xenova/claude-tokenizer",
"Xenova/gemma-2-tokenizer",
"Xenova/gpt-4o",
"Qwen/Qwen2.5-Coder-32B-Instruct",
];

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
// Create base directory
fs::create_dir_all(BASE_DIR)?;
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed={}", BASE_DIR);

for model in MODELS {
download_tokenizer(model).await?;
}

Ok(())
}

async fn download_tokenizer(repo_id: &str) -> Result<(), Box<dyn Error>> {
let dir_name = repo_id.replace('/', "--");
let download_dir = format!("{}/{}", BASE_DIR, dir_name);
let file_url = format!(
"https://huggingface.co/{}/resolve/main/tokenizer.json",
repo_id
);
let file_path = format!("{}/tokenizer.json", download_dir);

// Create directory if it doesn't exist
fs::create_dir_all(&download_dir)?;

// Check if file already exists
if Path::new(&file_path).exists() {
println!("Tokenizer for {} already exists, skipping...", repo_id);
return Ok(());
}

println!("Downloading tokenizer for {}...", repo_id);

// Download the file
let response = reqwest::get(&file_url).await?;
if !response.status().is_success() {
return Err(format!("Failed to download tokenizer for {}", repo_id).into());
}

let content = response.bytes().await?;
fs::write(&file_path, content)?;

println!("Downloaded {} to {}", repo_id, file_path);
Ok(())
}
23 changes: 0 additions & 23 deletions download_tokenizer_files.py

This file was deleted.

35 changes: 0 additions & 35 deletions download_tokenizers.sh

This file was deleted.

3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "stable"
profile = "default"
Loading