Skip to content

Commit

Permalink
new: unified crates
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Dec 3, 2024
1 parent 4ee33b2 commit 84c1651
Show file tree
Hide file tree
Showing 170 changed files with 1,137 additions and 7,396 deletions.
628 changes: 59 additions & 569 deletions Cargo.lock

Large diffs are not rendered by default.

55 changes: 49 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
[workspace]
resolver = "2"
members = ["nerve-core", "nerve-cli"]

[workspace.package]
[package]
name = "nerve-ai"
version = "0.4.1"
edition = "2021"
description = "Nerve is a tool that allows creating stateful agents with any LLM of your choice - without writing a single line of code. The tool provides to the model a framework of functionalities for planning, saving or recalling memories, etc by dynamically adapting the prompt and making it stateful over multiple inferences. The model will be able to access and use these functionalities in order to accomplish the task you provided."
Expand All @@ -13,8 +10,54 @@ readme = "README.md"
repository = "https://github.com/evilsocket/nerve"
homepage = "https://github.com/evilsocket/nerve"

[[bin]]
name = "nerve"
path = "src/main.rs"

[dependencies]
anyhow = "1.0.86"
async-trait = "0.1.80"
chrono = { version = "0.4.38", features = ["serde"] }
colored = "2.1.0"
indexmap = "2.2.6"
itertools = "0.13.0"
lazy_static = "1.4.0"
libc = "0.2.155"
regex = "1.10.5"
serde = { version = "1.0.203", features = ["derive", "serde_derive"] }
serde_trim = "1.1.0"
serde_yaml = "0.9.34"
simple-home-dir = "0.4.0"
tokio = { version = "1.38.0", features = ["full"] }
xml-rs = "0.8.20"
duration-string = { version = "0.4.0" }
rayon = "1.10.0"
glob = "0.3.1"
human_bytes = "0.4.3"
sha256 = "1.5.0"
bitcode = { version = "0.6.0", features = ["serde"] }
intertrait = "0.2.2"
mini-rag = "0.2.3"
log = "0.4.22"
reqwest = { version = "0.12.8", default-features = false, features = [
"json",
"rustls-tls",
] }
url = "2.5.2"
reqwest_cookie_store = "0.8.0"
serde_json = "1.0.120"
clap = { version = "4.5.6", features = ["derive"] }
tera = { version = "1.20.0", default-features = false }
clust = { version = "0.9.0" }
ureq = { version = "2.11.0", features = ["json"] }
mime = "0.3.17"
rand = "0.8.5"
reqwest-eventsource = "0.6.0"
futures = "0.3.31"
env_logger = "0.11.3"

[profile.release]
lto = true # Enable link-time optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations
panic = 'abort' # Abort on panic
strip = true # Strip symbols from binary*
strip = true # Strip symbols from binary*
99 changes: 45 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<p align="center">
<a href="https://github.com/evilsocket/nerve/releases/latest"><img alt="Release" src="https://img.shields.io/github/release/evilsocket/nerve.svg?style=flat-square"></a>
<a href="https://crates.io/crates/nerve-ai"><img alt="Crate" src="https://img.shields.io/crates/v/nerve-ai.svg"></a>
<a href="https://hub.docker.com/r/evilsocket/nerve"><img alt="Docker Hub" src="https://img.shields.io/docker/v/evilsocket/nerve?logo=docker"></a>
<a href="https://rust-reportcard.xuri.me/report/github.com/evilsocket/nerve"><img alt="Rust Report" src="https://rust-reportcard.xuri.me/badge/github.com/evilsocket/nerve"></a>
<a href="#"><img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/evilsocket/nerve/test.yml"></a>
Expand All @@ -21,6 +22,50 @@

The project's main goal and core difference with other tools is to allow the user to instrument smart agents without writing code (unless required for custom functionalities).

## Installing with Cargo

```sh
cargo install nerve-ai
```

## Installing from DockerHub

A Docker image is available on [Docker Hub](https://hub.docker.com/r/evilsocket/nerve):

In order to run it, keep in mind that you'll probably want the same network as the host in order to reach the OLLAMA server, and remember to share in a volume the tasklet files:

```sh
docker run -it --network=host -v ./examples:/root/.nerve/tasklets evilsocket/nerve -h
```

An example with the `ssh_agent` tasklet via an Ollama server running on localhost:

```sh
docker run -it --network=host \
-v ./examples:/root/.nerve/tasklets \
evilsocket/nerve -G "ollama://llama3@localhost:11434" -T ssh_agent -P'find which process is consuming more ram'
```

## Building from sources

To build from source:

```sh
cargo build --release
```

Run a tasklet with a given OLLAMA server:

```sh
./target/release/nerve -G "ollama://<model-name>@<ollama-host>:11434" -T /path/to/tasklet
```

## Building with Docker

```sh
docker build . -t nerve
```

## 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/), [Anthropic](https://www.anthropic.com/), [Fireworks](https://fireworks.ai/), [Huggingface](https://huggingface.co/blog/tgi-messages-api#using-inference-endpoints-with-openai-client-libraries), [Nvidia NIM](https://www.nvidia.com/en-us/ai/) and [NovitaAI](https://novita.ai/model-api/product/llm-api) APIs.
Expand Down Expand Up @@ -176,60 +221,6 @@ nerve -G "openai://gpt-4o" \
-R "localhost:8000/cybersecurity/reverse-engineering"
```

### How does it work?

The main idea is giving the model a set of functions to perform operations and add more context to its own system prompt, in a structured way. Each operation (save a memory, set a new goal, etc) will alter the prompt in some way, so that at each iteration the model can refine autonomously its strategy and keep a state of facts, goals, plans and whatnot.

If you want to observe this (basically the debug mode of Nerve), run your tasklet by adding the following additional argument:

```sh
nerve -G ... -T whatever-tasklet --save-to state.txt
```

The agent save to disk its internal state at each iteration for you to observe.

## About Crates.io

Since v0.2.0 **Nerve is not on crates.io anymore** due to the [lack of support of local crates](https://users.rust-lang.org/t/is-it-possible-to-publish-crates-with-path-specified/91497).

## Installing from DockerHub

A Docker image is available on [Docker Hub](https://hub.docker.com/r/evilsocket/nerve):

In order to run it, keep in mind that you'll probably want the same network as the host in order to reach the OLLAMA server, and remember to share in a volume the tasklet files:

```sh
docker run -it --network=host -v ./examples:/root/.nerve/tasklets evilsocket/nerve -h
```

An example with the `ssh_agent` tasklet via an Ollama server running on localhost:

```sh
docker run -it --network=host \
-v ./examples:/root/.nerve/tasklets \
evilsocket/nerve -G "ollama://llama3@localhost:11434" -T ssh_agent -P'find which process is consuming more ram'
```

## Building from sources

To build from source:

```sh
cargo build --release
```

Run a tasklet with a given OLLAMA server:

```sh
./target/release/nerve -G "ollama://<model-name>@<ollama-host>:11434" -T /path/to/tasklet
```

## Building with Docker

```sh
docker build . -t nerve
```

## License

Nerve is released under the GPL 3 license. To see the licenses of the project dependencies, install cargo license with `cargo install cargo-license` and then run `cargo license`.
Expand Down
69 changes: 0 additions & 69 deletions crates/groq-api-rs/.github/workflows/publish.yml

This file was deleted.

5 changes: 0 additions & 5 deletions crates/groq-api-rs/.gitignore

This file was deleted.

Loading

0 comments on commit 84c1651

Please sign in to comment.