Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Decentralized Inference for rig #171

Merged
merged 21 commits into from
Jan 13, 2025
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
591c739
feat: eternal ai
eternal-ai-org Dec 27, 2024
141a9d1
feat: eternal ai
eternal-ai-org Dec 27, 2024
bad6f4c
feat: eternal ai
eternal-ai-org Dec 27, 2024
ee21f41
feat: eternal ai
eternal-ai-org Dec 27, 2024
4e6f80c
feat: eternal ai
eternal-ai-org Dec 27, 2024
20c84be
feat: eternal ai
eternal-ai-org Dec 27, 2024
e9875c2
feat: eternal ai
eternal-ai-org Dec 27, 2024
7c85d9a
feat: eternal ai
eternal-ai-org Dec 27, 2024
a3cfeee
feat: eternal ai - update for reviewing of 0xMochan
eternal-ai-org Dec 30, 2024
98be8b5
feat: eternal ai - update for reviewing of 0xMochan
eternal-ai-org Dec 30, 2024
b9877f0
feat: eternal ai - update for reviewing of 0xMochan
eternal-ai-org Dec 30, 2024
dfbce76
feat: eternal ai - update for reviewing of 0xMochan
eternal-ai-org Dec 30, 2024
3529ff1
feat: eternal ai - update for reviewing of 0xMochan
eternal-ai-org Dec 30, 2024
413c264
feat: eternal ai - update for reviewing of 0xMochan
eternal-ai-org Dec 30, 2024
c39e160
feat: eternal ai - update for reviewing of 0xMochan
eternal-ai-org Dec 30, 2024
5bfed91
feat: eternal ai - update for reviewing of 0xMochan
eternal-ai-org Dec 30, 2024
f4120d2
Merge branch '0xPlaygrounds:main' into eternal-ai
eternal-ai-org Jan 11, 2025
11d250a
feat: eternal ai - update for reviewing of 0xMochan
eternal-ai-org Jan 13, 2025
8459152
feat: eternal ai - update for reviewing of 0xMochan
eternal-ai-org Jan 13, 2025
243673e
Merge remote-tracking branch 'origin/eternal-ai' into eternal-ai
eternal-ai-org Jan 13, 2025
82a9bd5
feat: eternal ai - update for reviewing of 0xMochan
eternal-ai-org Jan 13, 2025
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
Prev Previous commit
Next Next commit
feat: eternal ai - update for reviewing of 0xMochan
eternal-ai-org committed Dec 30, 2024
commit 413c2645719188969db7a5d624e4bf14e8f6ac16
60 changes: 2 additions & 58 deletions rig-core/examples/agent_with_eternalai.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use rig::agent::AgentBuilder;
use rig::completion::ToolDefinition;
use rig::loaders::FileLoader;
use rig::providers::eternalai::{CompletionModel, NOUS_RESEARCH_HERMES_3_LLAMA_3_1_70B_FP8};
use rig::tool::Tool;
use rig::{completion::Prompt, providers};
@@ -12,12 +11,6 @@ async fn main() -> Result<(), anyhow::Error> {
println!("Running basic agent with eternalai");
basic_eternalai().await?;

println!("\nRunning eternalai agent with tools");
tools_eternalai().await?;

println!("\nRunning eternalai agent with loaders");
loaders_eternalai().await?;

println!("\nRunning eternalai agent with context");
context_eternalai().await?;

@@ -50,60 +43,11 @@ async fn basic_eternalai() -> Result<(), anyhow::Error> {
Ok(())
}

async fn tools_eternalai() -> Result<(), anyhow::Error> {
// Create agent with a single context prompt and two tools
let calculator_agent = partial_agent_eternalai()
.preamble("You are a calculator here to help the user perform arithmetic operations. Use the tools provided to answer the user's question.")
.max_tokens(1024)
.tool(EternalAIAdder)
.tool(EternalAISubtract)
.build();

// Prompt the agent and print the response
println!("Calculate 2 - 5");
println!(
"Calculator Agent: {}",
calculator_agent.prompt("Calculate 2 - 5").await?
);

Ok(())
}

async fn loaders_eternalai() -> Result<(), anyhow::Error> {
let model = client().completion_model(
providers::eternalai::NOUS_RESEARCH_HERMES_3_LLAMA_3_1_70B_FP8,
// Option::from("45762"),
None,
);

// Load in all the rust examples
let examples = FileLoader::with_glob("rig-core/examples/*.rs")?
.read_with_path()
.ignore_errors()
.into_iter();

// Create an agent with multiple context documents
let agent = examples
.fold(AgentBuilder::new(model), |builder, (path, content)| {
builder.context(format!("Rust Example {:?}:\n{}", path, content).as_str())
})
.build();

// Prompt the agent and print the response
let response = agent
.prompt("Which rust example is best suited for the operation 1 + 2")
.await?;

println!("{}", response);

Ok(())
}

async fn context_eternalai() -> Result<(), anyhow::Error> {
let model = client().completion_model(
providers::eternalai::NOUS_RESEARCH_HERMES_3_LLAMA_3_1_70B_FP8,
// Option::from("45762"),
None,
Option::from("45762"),
// None,
);

// Create an agent with multiple context documents