Skip to main content

4 posts tagged with "llm-chain"

View All Tags

· 2 min read
will rudenmalm

We're excited to announce the release of llm-chain v0.8.0, a significant update to our LLM library. This release introduces a host of improvements and new features, including a completely revamped Prompt system and more streamlined handling of Parameters. Let's dive into the details!

Revamped Prompt System

Our new Prompt system has been redesigned from the ground up to provide greater flexibility and efficiency in working with language models. In llm-chain v0.8.0, we've introduced new structs and enums to better represent chat messages and their roles, such as ChatMessage, ChatMessageCollection, and ChatRole. The Data enum has also been introduced to represent either a collection of chat messages or a single text, making it easier to work with different types of data.

Furthermore, we've created a more powerful PromptTemplate system that allows you to format prompts with a set of parameters. This enables you to dynamically generate prompts for your language models without the need for cumbersome string manipulation.

Executors No Longer Handle Parameters

With the release of llm-chain v0.8.0, we've shifted the responsibility of handling Parameters from the executors to the main llm-chain crate. This change simplifies the process of working with executors, allowing developers to focus more on the core functionality of their language models.

What's Next?

This release marks a significant step forward in the evolution. However, we're not stopping here! We'll continue to refine and expand the capabilities of llm-chain, making it even more powerful and user-friendly.

We encourage you to check out llm-chain v0.8.0 and experience the benefits of the improved Prompt system and streamlined handling of Parameters. As always, we appreciate your feedback and contributions to help make llm-chain the best language model library out there.

Upgrade to llm-chain v0.8.0 today and take your language models to the next level!

· 2 min read
will rudenmalm

We are thrilled to announce the release of llm-chain v0.6.0, which introduces significant enhancements to our library. This update focuses on making the llm-chain more robust and versatile, allowing developers to build even more advanced applications with ease.

Major updates

1. The switch to the tera template language

One of the most significant changes in this release is the introduction of the tera template language. This powerful and flexible templating system enables developers to create dynamic and complex templates for their projects. The tera language allows for more advanced control structures and filters, making it a substantial upgrade from the previous templating system.

2. Improved prompt system

Another notable update is the revamped prompt system. With llm-chain v0.6.0, the prompt system now supports both Chat and completion-style models. This improvement means developers no longer need to worry about whether they are using a completion or chat model when crafting prompts. This unified approach simplifies the development process and makes it easier to work with various types of language models.

3. Updated LLaMA.cpp

The latest version of LLaMA.cpp has been integrated into this release, ensuring better performance and stability for your projects.

Other improvements

1. Safer error handling

In addition to the major updates, llm-chain v0.6.0 also brings improvements to error handling. Templates now return Result rather than panicking on errors, making it more convenient to handle any issues that may arise during development. Similarly, Executors also return Result instead of panicking on errors, providing a more consistent and safer API.

Time to move on from the old templating system

With the introduction of the tera template language, we strongly recommend moving away from the old templating system. This update provides a solid foundation for building even more advanced applications using the llm-chain library.

We hope you're as excited about these enhancements as we are! As always, we appreciate your feedback and support. If you have any questions or need help, please don't hesitate to reach out on Discord !

Happy coding! 🚀

· 2 min read
will rudenmalm

In this blog post, we'll explore how to use ChatGPT in Rust with the help of the llm-chain library. We will walk through a simple example that demonstrates how to generate responses using OpenAI's ChatGPT model.

Getting Started

First, let's start by installing the necessary packages using cargo add. You will need the llm-chain and llm-chain-openai libraries:

cargo add llm-chain llm-chain-openai

Now, let's dive into the code:


use llm_chain::{traits::StepExt, Parameters};
use llm_chain_openai::chatgpt::{Executor, Model, Role, Step};

#[tokio::main(flavor = "current_thread")]
async fn main() {
let exec = Executor::new_default();
let chain = Step::new(
Model::ChatGPT3_5Turbo,
[
(
Role::System,
"You are a helpful assistant",
),
(Role::User, "Tell me about the Rust programming language"),
],
)
.to_chain();
let res = chain.run(Parameters::new(), &exec).await.unwrap();
println!("{:?}", res);
}

In the code snippet above, we begin by importing the necessary modules and functions from the llm-chain and llm-chain-openai libraries. We then define a simple main function that uses the Executor and Step structs to create a conversational chain.

The Model::ChatGPT3_5Turbo model is used as the language model in this example. We also define two steps in the conversation: the first one sets the role of the assistant and the second one asks a question about the Rust programming language.

Finally, we execute the conversation chain using the run method and print the generated response.

Wrapping Up

As you can see, using ChatGPT in Rust with llm-chain is a straightforward and efficient process. The library makes it easy to build and manage conversational agents in Rust, allowing developers to focus on creating more powerful and interactive applications.

To continue learning about ChatGPT in Rust and how to make the most of the llm-chain library, try our tutorial .

· 2 min read
will rudenmalm

We're excited to announce the release of LLM-chain, a Rust library designed to help developers work with Large Language Models (LLMs) more effectively. Our primary focus is on providing robust support for prompt templates and chaining together prompts in multi-step chains, enabling complex tasks that LLMs can't handle in a single step. This includes, but is not limited to, summarizing lengthy texts or performing advanced data processing tasks.

Features of LLM-chain

LLM-chain comes with a variety of features that make it easier to work with LLMs, including:

  • Prompt templates: Create reusable and easily customizable prompt templates for consistent and structured interactions with LLMs.
  • Chains: Build powerful chains of prompts that allow you to execute more complex tasks, step by step, leveraging the full potential of LLMs.
  • ChatGPT support: Currently supports ChatGPT models, with plans to add support for more LLMs in the future, such as LLaMa and Stanford's Alpaca models.
  • Tools: Enhance your AI agents' capabilities by giving them access to various tools, such as running Bash commands, executing Python scripts, or performing web searches, enabling more complex and powerful interactions.
  • Extensibility: Designed with extensibility in mind, making it easy to integrate additional LLMs as the ecosystem grows and new models are developed.
  • Community-driven: We welcome and encourage contributions from the community to help improve and expand the capabilities of LLM-chain.

Connect with Us

If you have any questions, suggestions, or feedback, feel free to join our Discord community. We're always excited to hear from our users and learn about your experiences with LLM-chain.

Getting Started with LLM-chain

Check out our Github repository or the documentation to get started.