Install
openclaw skills install @psyb0t/go-vectaraUnofficial Go client for the Vectara API v2. Package vectara (github.com/psyb0t/go-vectara) has typed methods for corpora, documents, search, RAG queries, chats, agents, tools, pipelines and account administration. Use when Go code needs Vectara or already imports go-vectara.
openclaw skills install @psyb0t/go-vectaraUnofficial, typed Go client for the Vectara API v2, in package vectara at the module root.
For installation, operations, pagination and response fields, see references/setup.md.
VECTARA_API_KEY and send it in x-api-key. Never hardcode, commit or log credentials or authentication headers.https://api.vectara.io as the base URL. Generated paths include /v2.github.com/psyb0t/go-vectara.AGENTS.md in the repo.The usage below covers one call. Every operation in the spec has a generated method, and the spec's descriptions are on them as Go doc comments. Look names and fields up instead of guessing. After go get github.com/psyb0t/go-vectara, from inside your module:
go doc github.com/psyb0t/go-vectara ClientWithResponsesInterface # every endpoint method
go doc github.com/psyb0t/go-vectara ListCorporaParams # one method, params type or model
go doc -all github.com/psyb0t/go-vectara # the whole package
The same documentation is at https://pkg.go.dev/github.com/psyb0t/go-vectara.
Method names come from the spec's operation IDs. <OperationId>WithResponse takes the context, then the path parameters in order, then *<OperationId>Params when the operation has query or header parameters, then the request body when it has one. Almost every operation takes a params struct, because the spec declares request timeout headers on them; pass nil when you set none. The JSON200 field (or JSON201 and so on, per declared status) holds the decoded body; it is nil for any other status.
Set x-api-key with a request editor, create the client, then call an operation. This is the repo's example_test.go:
import (
"context"
"net/http"
"os"
"github.com/psyb0t/go-vectara"
)
auth := vectara.WithRequestEditorFn(func(_ context.Context, req *http.Request) error {
req.Header.Set("x-api-key", os.Getenv("VECTARA_API_KEY"))
return nil
})
client, err := vectara.NewClientWithResponses("https://api.vectara.io", auth)
if err != nil {
return err
}
res, err := client.ListCorporaWithResponse(context.Background(), nil)
if err != nil {
return err
}
_ = res.JSON200 // *vectara.ListCorporaResponse
Check err for request construction, transport and decoding failures. Check StatusCode() and the expected success field such as JSON200 for API failures. A non-2xx response can have a nil Go error. Optional fields may be pointers; check before dereferencing.
The client does not paginate, retry or refresh OAuth tokens automatically. For server-sent events, call the raw method, decode the stream yourself and close the response body. Parsed response methods read the full body.