The official Go SDK for Valyu's DeepSearch API.
Access academic papers, real-time web content, structured data, and AI-powered research.
go get github.com/Veri5ied/valyu-gopackage main
import (
"context"
"fmt"
"log"
"github.com/Veri5ied/valyu-go/valyu"
"github.com/Veri5ied/valyu-go/valyu/search"
)
func main() {
client, err := valyu.New("") // Uses VALYU_API_KEY env var
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
resp, _ := client.Search.Search(ctx, "machine learning transformers", nil)
for _, r := range resp.Results {
fmt.Println(r.Title)
}
}export VALYU_API_KEY="your-api-key"Or pass directly:
client, err := valyu.New("your-api-key")import "github.com/Veri5ied/valyu-go/valyu/search"
import "github.com/Veri5ied/valyu-go/valyu/common"
resp, _ := client.Search.Search(ctx, "query", &search.Options{
SearchType: common.SearchTypeProprietary,
MaxNumResults: 20,
IncludedSources: []string{"valyu/valyu-arxiv"},
})import "github.com/Veri5ied/valyu-go/valyu/contents"
import "github.com/Veri5ied/valyu-go/valyu/common"
resp, _ := client.Contents.Get(ctx, []string{"https://example.com"}, &contents.Options{
Summary: true,
ResponseLength: common.ResponseLengthMax,
})import "github.com/Veri5ied/valyu-go/valyu/answer"
import "github.com/Veri5ied/valyu-go/valyu/common"
resp, _ := client.Answer.Answer(ctx, "What are transformers?", &answer.Options{
SearchType: common.SearchTypeAll,
FastMode: true,
})import "github.com/Veri5ied/valyu-go/valyu/deepresearch"
import "github.com/Veri5ied/valyu-go/valyu/common"
task, _ := client.DeepResearch.Create(ctx, &deepresearch.CreateOptions{
Query: "AI safety research summary",
Mode: common.DeepResearchModeFast,
})
status, _ := client.DeepResearch.Get(ctx, task.DeepResearchID)import "github.com/Veri5ied/valyu-go/valyu/batch"
import "github.com/Veri5ied/valyu-go/valyu/common"
newBatch, _ := client.Batch.Create(ctx, &batch.CreateOptions{
Name: "Research Batch",
Mode: common.DeepResearchModeStandard,
})
status, _ := client.Batch.Get(ctx, newBatch.BatchID)sources, _ := client.Datasources.List(ctx)client, err := valyu.New("api-key",
valyu.WithBaseURL("https://custom.api.com"),
valyu.WithTimeout(60 * time.Second),
valyu.WithHTTPClient(customClient),
)resp, err := client.Search.Search(ctx, "query", nil)
if err != nil {
log.Fatal("Network error:", err)
}
if !resp.Success {
log.Fatal("API error:", resp.Error)
}MIT License - see LICENSE for details.