langchainrb

ruby
ai
code
llm
Author

geeknees

Published

July 15, 2023

https://github.com/andreibondarev/langchainrb

p ENV['RUBYINSPECT']
"1"
"1"
require 'bundler/setup'
require 'langchain'

llm = Langchain::LLM::OpenAI.new(ENV["OPENAI_API_KEY"])
llm.chat([{"user", "What is the meaning of life?"}]).completion
"The meaning of life is a deeply philosophical question that has been debated by scholars, theologians, and individuals for centuries. Different people and cultures have different beliefs and interpretations of the meaning of life. Some believe that the meaning of life is to seek happiness and fulfillment, others believe it is to fulfill a higher purpose or destiny, while others believe that life has no inherent meaning and it is up to each individual to create their own meaning. Ultimately, the meaning of life is a deeply personal and subjective question that each person must grapple with and find their own answer to."