Skip to content

jeantessier/langchain-ruby-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LangChain Ruby Example

A sample Ruby script that uses LangChain to talk to LLMs.

You’ll need an API key for each LLM. So just follow the instructions linked below to obtain your API keys.

Save the keys to the app/src/main/resources/.env file as the corresponding ..._API_KEY environment variable. You can use app/src/main/resources/.env.template as a guide to structure your .env file.

Install packages, if you haven't already.

bundle

To Run

To run against OpenAI's ChatGPT:

bundle exec ruby hello.rb --model openai

To run against Anthropic's Claude:

bundle exec ruby hello.rb --model anthropic

To run against Google's Gemini:

bundle exec ruby hello.rb --model google

If you don't specify --model, it will default to openai and use ChatGPT.

About

An example of using LangChain in Ruby with Langchain.rb

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages