mirror of
https://github.com/vxcontrol/langchaingo.git
synced 2026-07-21 00:45:22 -04:00
450c02a722
chore: update all examples to use v0.1.14-pre.4 - Remove replace directives from 5 examples that had local path references - Update all 75 example go.mod files to use the latest pre-release version - Ensures examples work correctly for users who clone the repository
🦜 Maritaca Chat Example
Hello there! 👋 This fun little Go program demonstrates how to use the Maritaca AI language model to answer questions. Let's break it down!
🎯 What does this example do?
This example:
- Sets up a connection to the Maritaca AI service
- Asks a simple question about Brazil's population
- Prints out the AI's response
🔑 Key Components
- We're using the
github.com/tmc/langchaingo/llms/maritacapackage to interact with Maritaca AI. - The program reads your Maritaca API key from an environment variable called
MARITACA_KEY. - We're using the "sabia-2-medium" model, which is pretty smart!
🚀 How it works
- First, we set up our Maritaca client with the API key and model choice.
- Then, we prepare a simple question: "How many people live in Brazil?"
- We send this question to the AI using the
Callmethod. - Finally, we print out whatever answer the AI gives us!
🎉 Running the example
To run this example, make sure you:
- Have your Maritaca API key set as an environment variable.
- Have all the necessary Go packages installed.
Then just run the program and see what the AI says about Brazil's population!
🤔 Why is this cool?
This example shows how easy it is to integrate AI into your Go programs. With just a few lines of code, you can ask an AI model complex questions and get intelligent responses. How awesome is that? 🎈
Happy coding, and have fun chatting with AI! 🤖💬