Skip to content

Commit

Permalink
new: implemented native + wrapped functions calling
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Jul 26, 2024
1 parent bb1f2ef commit 1ce20b7
Show file tree
Hide file tree
Showing 104 changed files with 11,702 additions and 149 deletions.
41 changes: 31 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@ name = "nerve"
path = "src/main.rs"

[dependencies]
ollama-rs = { version = "0.1.9", features = [
ollama-rs = { path = "./crates/ollama-rs", features = [
"rustls",
"tokio",
"chat-history",
], default-features = false, optional = true }
openai_api_rust = { path = "./crates/openai_api_rust", optional = true }
groq-api-rs = { path = "./crates/groq-api-rs", optional = true }

anyhow = "1.0.86"
async-trait = "0.1.80"
chrono = "0.4.38"
clap = { version = "4.5.6", features = ["derive"] }
colored = "2.1.0"
groq-api-rs = { version = "0.1.0", optional = true }
indexmap = "2.2.6"
itertools = "0.13.0"
lazy_static = "1.4.0"
libc = "0.2.155"
openai_api_rust = { version = "0.1.9", optional = true }
regex = "1.10.5"
serde = { version = "1.0.203", features = ["derive", "serde_derive"] }
serde_trim = "1.1.0"
Expand All @@ -54,6 +55,7 @@ reqwest = { version = "0.12.5", default-features = false, features = [
] }
url = "2.5.2"
reqwest_cookie_store = "0.8.0"
serde_json = "1.0.120"

[features]
default = ["ollama", "groq", "openai", "fireworks"]
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ While Nerve was inspired by other projects such as Autogen and Rigging, its main

## LLM Support

Nerve features integrations for any model accessible via the [ollama](https://github.com/ollama/ollama), [groq](https://groq.com), [OpenAI](https://openai.com/index/openai-api/) and [Fireworks](https://fireworks.ai/) APIs. You can specify which provider and which model to use via the `-G` (or `--generator`) argument:
Nerve features integrations for any model accessible via the [ollama](https://github.com/ollama/ollama), [groq](https://groq.com), [OpenAI](https://openai.com/index/openai-api/) and [Fireworks](https://fireworks.ai/) APIs.

**The tool will automatically detect if the selected model natively supports function calling. If not, it will provide a compatibility layer that empowers older models to perform function calling anyway.**

You can specify which provider and which model to use via the `-G` (or `--generator`) argument:

For **Ollama**:

Expand Down
69 changes: 69 additions & 0 deletions crates/groq-api-rs/.github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Publish

on:
push:
tags:
- '*'

env:
CARGO_TERM_COLOR: always

jobs:
build_and_test_crate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run tests
run: GROQ_API_KEY=${{ secrets.GROQ_API_TOKEN}} cargo test --verbose

# reference : https://github.com/azriel91/peace/blob/main/.github/workflows/publish.yml
crates_io_publish:
name: Publish (crates.io)
needs:
- build_and_test_crate

runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: cargo-release Cache
id: cargo_release_cache
uses: actions/cache@v3
with:
path: ~/.cargo/bin/cargo-release
key: ${{ runner.os }}-cargo-release

- run: cargo install cargo-release
if: steps.cargo_release_cache.outputs.cache-hit != 'true'

- name: cargo login
run: cargo login ${{ secrets.CRATES_IO_API_TOKEN }}

# allow-branch HEAD is because GitHub actions switches
# to the tag while building, which is a detached head

# Publishing is currently messy, because:
#
# * `peace_rt_model_core` exports `NativeError` or `WebError` depending on the target.
# * `peace_rt_model_web` fails to build when publishing the workspace for a native target.
# * `peace_rt_model_web` still needs its dependencies to be published before it can be
# published.
# * `peace_rt_model_hack` needs `peace_rt_model_web` to be published before it can be
# published.
#
# We *could* pass through `--no-verify` so `cargo` doesn't build the crate before publishing,
# which is reasonable, since this job only runs after the Linux, Windows, and WASM builds
# have passed.
- name: "cargo release publish"
run: |-
cargo release \
publish \
--workspace \
--all-features \
--allow-branch HEAD \
--no-confirm \
--execute
5 changes: 5 additions & 0 deletions crates/groq-api-rs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/target
**/.env
**/.env.**
**/.cargo
**/.DS_Store
Loading

0 comments on commit 1ce20b7

Please sign in to comment.