Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exa Go SDK

A comprehensive Go SDK for the Exa.ai API, providing idiomatic Go interfaces for neural search, content retrieval, similarity search, and question answering capabilities.

Installation

go get github.com/amalucelli/exa-go

Requirements

Quick Start

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/amalucelli/exa-go/exa"
)

func main() {
    // Create client with API key
    client, err := exa.New(
        exa.WithAPIKey("your-api-key"),
    )
    if err != nil {
        log.Fatal(err)
    }

    ctx := context.Background()

    // Perform a neural search
    searchReq := &exa.SearchRequest{
        Query:      "latest developments in quantum computing",
        SearchType: exa.SearchTypeNeural,
        NumResults: 10,
    }

    searchResp, err := client.Search.Search(ctx, searchReq)
    if err != nil {
        log.Fatal(err)
    }

    // Print results
    for _, result := range searchResp.Results {
        fmt.Printf("Title: %s\nURL: %s\nScore: %.2f\n\n", 
            result.Title, result.URL, result.Score)
    }
}

Configuration

Client Options

The SDK provides several configuration options:

client, err := exa.New(
    // Can also use EXA_API_KEY env variable
    exa.WithAPIKey("your-api-key"),
    
    // Custom base URL (optional)
    exa.WithBaseURL("https://custom-api.exa.ai/"),
    
    // Custom HTTP client (optional)
    exa.WithHTTPClient(&http.Client{
        Timeout: 30 * time.Second,
    }),
    
    // Enable debug logging (optional)
    exa.WithDebug(true),
)

Environment Variables

  • EXA_API_KEY: Your Exa.ai API key (used if not provided via WithAPIKey)

About

Go client library to access the Exa API

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages