Crate docs_rs_kgs_test

Crate docs_rs_kgs_test 

Source
Expand description

§DOCS RS KGS TEST

This is a example

§Features

  • Option 01

  • Option 02

  • Parallel Node Execution: The ParallelNode struct enables parallel execution of multiple nodes, leveraging concurrency to improve overall chain performance.

§Getting Started

[dependencies]
anchor-chain = "0.1.0"
#[tokio::main]
async fn main() {
    use anchor_chain::{
        chain::ChainBuilder,
        models::openai::OpenAIModel,
    };

    let chain = ChainBuilder::new()
        .link(OpenAIModel::new_gpt3_5_turbo("You are a helpful assistant".to_string()).await)
        .build();

    let result = chain
        .process("Write a hello world program in Rust")
        .await
        .expect("Error processing chain");

    println!("Result: {}", result);
}

Prompts can be constructed using the Prompt struct. Prompt uses Tera templating to allow for dynamic input substitution. Tera’s syntax is based on Jinja2 and Django templates. Context variables are passed to the prompt using a HashMap.

fn main() {
   println!("Hello, world!");
}

For more examples please refer to the google.