Skip to content

Getting_Started

theirish81 edited this page Sep 3, 2026 · 5 revisions

Getting Started

Depending on your needs, you can get started by using the CLI tool, or embed frags in your own project.

CLI tool

The CLI tool is a simple way to experience what Frags can do for you.

Installation

  • 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 .env file with your desired settings

Basic configuration

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-lite or gemini-3.5-flash
  • For ollama: qwen3:latest or llama3.2:latest
  • For anthropic: claude-sonnet-5 or claude-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=false

Check

Let's use the simplest command:

frags ask "What is the meaning of life?"

If you receive an answer, then you're lucky!


Library

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.

Installation

  • Download the latest Frags library:
    go get github.com/fragshq/frags
  • Choose an AI implementation between gemini, ollama, chatgpt, or anthropic:
    go get github.com/fragshq/frags/gemini
    or
    go get github.com/fragshq/frags/ollama

Basic Integration

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"])
}

Clone this wiki locally