Home / Market / go-weave

go-weave

Unofficial Go client for the W&B Weave trace server API, generated with oapi-codegen. `weave.NewClientWithResponses(baseURL, auth)` from `github.com/psyb0t/go-weave` gives typed methods for every endpoint of the Weave trace server (start, end, read and query calls, objects, tables, files, feedback, costs, refs, threads, annotation queues, evaluations, agents, completions, OTel trace export, and the v2 datasets, models, ops, scorers, scores, predictions and evaluation runs). Auth is HTTP Basic wi

skill★ 00 dlclawhubMIT-0Install in CosmosUpstream Source

Documentation & Preview

go-weave: setup and reference

Requirements

Install

go get github.com/psyb0t/go-weave

The package name is weave:

import "github.com/psyb0t/go-weave"

Client

The generated code is split in two files: the models in types.gen.go, the client in client.gen.go.

Endpoint groups

| Group | Paths | Example method | |---|---|---| | Calls | /call/start, /call/end, /call/read, /call/update, /call/upsert_batch, /calls/* | CallStartCallStartPostWithResponse | | Objects | /obj/create, /obj/read, /obj/delete, /objs/query | ObjReadObjReadPostWithResponse | | Tables | /table/* | TableQueryTableQueryPostWithResponse | | Files | /file/create, /file/content, /files/query_stats | FileContentFileContentPostWithResponse | | Feedback | /feedback/* | FeedbackCreateFeedbackCreatePostWithResponse | | Costs | /cost/* | CostQueryCostQueryPostWithResponse | | Refs, threads, usage | /refs/read_batch, /threads/stream_query, /trace/usage | RefsReadBatchRefsReadBatchPostWithResponse | | Annotation queues | /annotation_queues/* | AnnotationQueueReadAnnotationQueuesQueueIdGetWithResponse | | Evaluations | /evaluations/* | EvaluationStatusEvaluationsStatusPostWithResponse | | OTel | /otel/v1/traces | ExportTraceOtelV1TracesPostWithResponse | | Agents | /agents/* | GenaiAgentsQueryAgentsQueryPostWithResponse | | Completions and images | /completions/create, /completions/create_stream, /image/create | CompletionsCreateCompletionsCreatePostWithResponse | | v2 resources | /v2/{entity}/{project}/... | DatasetListV2EntityProjectDatasetsGetWithResponse | | Service | /health, /version, /server_info, /geolocate | ServerInfoServerInfoGetWithResponse |

The v2 methods take entity and project as path arguments instead of a ProjectId body field.

Streaming responses

POST /calls/stream_query, POST /threads/stream_query, POST /annotation_queues/query, POST /completions/create_stream and the v2 list endpoints (datasets, evaluations, evaluation runs, models, ops, predictions, scorers, scores) answer with JSONL (application/jsonl or application/x-ndjson), one JSON object per line. The generated wrapper has no typed field for it. Read Body and decode it line by line with a json.Decoder, or use the plain Client method (no WithResponse suffix) to get the *http.Response and stream its body yourself.

Errors

Free-form values

Inputs, outputs, attributes and summaries are map[string]interface{} or interface{}, because the spec allows any JSON there. Numbers inside them decode as float64. Typed number fields are float64 too.