Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeantessier/langchain-ruby-example
An example of using LangChain in Ruby with Langchain.rb
https://github.com/jeantessier/langchain-ruby-example
Last synced: about 8 hours ago
JSON representation
An example of using LangChain in Ruby with Langchain.rb
- Host: GitHub
- URL: https://github.com/jeantessier/langchain-ruby-example
- Owner: jeantessier
- Created: 2024-12-13T22:06:28.000Z (9 days ago)
- Default Branch: main
- Last Pushed: 2024-12-19T21:31:48.000Z (3 days ago)
- Last Synced: 2024-12-19T22:38:25.692Z (3 days ago)
- Language: Ruby
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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.- [OpenAI ChatGPT](https://platform.openai.com/api-keys)
- [Anthropic Claude](https://console.anthropic.com/settings/keys)
- [Google Gemini](https://aistudio.google.com/app/apikey)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.
```bash
bundle
```## To Run
To run against OpenAI's ChatGPT:
```bash
bundle exec ruby hello.rb --model openai
```To run against Anthropic's Claude:
```bash
bundle exec ruby hello.rb --model anthropic
```To run against Google's Gemini:
```bash
bundle exec ruby hello.rb --model google
```If you don't specify `--model`, it will default to `openai` and use ChatGPT.