-
Notifications
You must be signed in to change notification settings - Fork 1
Getting_Started
Depending on your needs, you can get started by using the CLI tool, or embed frags in your own project.
The CLI tool is a simple way to experience what Frags can do for you.
- Head to the GitHub Releases for the CLI and download the latest binary for your platform.
- Make the binary executable (*Nix systems:
chmod +x <file_name>) - Binaries are not signed and will trigger a security alert on most systems, so you will need to bypass the security check.
- Run the binary once to generate the configuration file
.env - Configure the
.envfile with your desired settings
The main choice to make is the AI_ENGINE setting. Currently supported values are: gemini, ollama, chatgpt, anthropic, and dummy.
Secondly, you will need to choose the MODEL. Some common models based on your engine choice:
- For
gemini:gemini-3.1-flash-liteorgemini-3.5-flash - For
ollama:qwen3:latestorllama3.2:latest - For
anthropic:claude-sonnet-5orclaude-opus-5
Note: If you use Google Gemini, you will need a Google Cloud account and a Vertex enabled service account key.
Sample configuration:
AI_ENGINE=gemini
MODEL=gemini-2.5-pro
PARALLEL_WORKERS=1
# Gemini-specific configuration
GEMINI_SERVICE_ACCOUNT_PATH=gemini.json
GEMINI_PROJECT_ID=myproject-473810
GEMINI_LOCATION=global
# Anthropic-specific configuration (if AI_ENGINE=anthropic)
# ANTHROPIC_API_KEY=sk-ant-...
# ChatGPT-specific configuration (if AI_ENGINE=chatgpt)
# CHATGPT_API_KEY=...
# CHATGPT_BASE_URL=https://api.openai.com/v1
# Ollama-specific configuration (if AI_ENGINE=ollama)
# OLLAMA_BASE_URL=http://localhost:11434
# General model parameters
TEMPERATURE=0.6
TOP_K=40
TOP_P=0.9
NUM_PREDICT=10000
# Advanced Settings
THINKING_LEVEL=LOW
OAUTH_DISABLED=falseLet's use the simplest command:
frags ask "What is the meaning of life?"If you receive an answer, then you're lucky!
If you need to embed Frags in your own project, follow the next steps.
Notice: We recommend that you gain some familiarity with the CLI first to grasp the basic concepts.
- Download the latest Frags library:
go get github.com/fragshq/frags
- Choose an AI implementation between
gemini,ollama,chatgpt, oranthropic:orgo get github.com/fragshq/frags/gemini
go get github.com/fragshq/frags/ollama
Integrate the most basic session and run it:
package main
import (
"context"
"fmt"
"log"
"github.com/fragshq/frags"
"github.com/fragshq/frags/gemini"
"github.com/fragshq/frags/resources"
)
func main() {
// 1. Instantiate the Google SDK client according to your settings
client := newGeminiClient()
// 2. Instantiate the frags AI implementation
ai := gemini.NewAI(client, gemini.Config{
Temperature: 0.5,
TopK: 40,
TopP: 0.9,
Model: "gemini-2.5-pro",
})
// 3. Create the session manager
mgr := frags.NewSessionManager()
// 4. Define and set a basic session
mgr.SetSession("default", frags.Session{
Prompt: "what is the meaning of life?",
})
// 5. Initialize the runner with your session manager, resource loader, and AI implementation
runner := frags.NewRunner(mgr, resources.NewFileResourceLoader("."), ai)
// 6. Run the sessions (accepts an optional context and input parameters)
res, err := runner.Run(context.Background(), nil)
if err != nil {
log.Fatalf("execution failed: %v", err)
}
fmt.Println("Result:", res["default"])
}