Abraxas-365 / Abraxas-365/langchain-rust

error: the package 'chat' does not contain this feature: ollama

Ouverte
#288 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Rust
Étoiles
1.3k
Forks
177
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I used a binary project named chat, my code is shown as below. When I run the command cargo run --features=ollama, an error occurs: "error: the package 'chat' does not contain this feature: ollama".

```rust
use futures::StreamExt;
use langchain_rust::{
chain::{Chain, LLMChainBuilder},
fmt_message, fmt_template,
message_formatter,
prompt::HumanMessagePromptTemplate,
prompt_args,
schemas::messages::Message,
template_fstring,
};

#[cfg(feature = "ollama")]
use langchain_rust::{llm::ollama::client::Ollama};

#[cfg(feature = "ollama")]
#[tokio::main]
async fn main() {
let open_ai = Ollama::default().with_model("llama3:8b");

let prompt = message_formatter![
fmt_message!(Message::new_system_message(
"You are world class technical documentation writer."
)),
fmt_template!(HumanMessagePromptTemplate::new(template_fstring!(
"{input}", "input"
)))
];

let chain = LLMChainBuilder::new()
.prompt(prompt)
.llm(open_ai.clone())
.build()
.unwrap();

let mut stream = chain
.stream(prompt_args! {
"input" => "Who is the writer of 20,000 Leagues Under the Sea?",
})
.await
.unwrap();

while let Some(result) = stream.next().await {
match result {
Ok(value) => value.to_stdout().unwrap(),
Err(e) => panic!("Error invoking LLMChain: {:?}", e),
}
}
}
```

```bash
rust version:
rustc 1.83.0 (90b35a623 2024-11-26)
```

my Cargo.tmol
```toml
[package]
name = "chat"
version = "0.1.0"
edition = "2021"

[dependencies]
langchain-rust = { version = "4.6.0", features = ["ollama"] }
serde_json = "1.0.138"
tokio = { version = "1.43.0", features = ["full"] }
```

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.