Files
OpenViking/sdk/go/relations.go
T
Hao Zheandzhiheng.liu 797406c381 fix(sdk): consolidate model, client, and evaluation correctness (#3550)
* fix(models): route multimodal inputs to DashScope embed_content

Sweep findings: A-09. Preserve image parts through the shared embedding entrypoints.

(cherry picked from commit 50b20d7ca9)

* fix(models): constrain DashScope multimodal routing

Sweep findings: A-09. Preserve text mode and require a single fused vector for multipart input.

(cherry picked from commit 77784429d4)

* fix(models): respect DashScope Qwen fusion parameters

Sweep finding A-09

(cherry picked from commit aafc702b20)

* fix(review): preserve tongyi multipart compatibility

Addresses blocking review finding on #3400.

(cherry picked from commit 96844047c5)

* fix(eval): flush queued records on stop and adapt RAG pipeline to FindResult

Sweep findings: B-05, B-12. Drain recorder queues through the sentinel and consume current retrieval result objects.

(cherry picked from commit fecdbeb6d4)

* fix(sdk/python): support sync client inside a running event loop

Sweep findings: F-09. Run sync wrappers on one persistent worker loop with result and exception propagation.

(cherry picked from commit ba0faadc87)

* fix(sdk/python): preserve cancellation and fork safety

Sweep finding: F-09. Preserve original cancellation errors and reset worker synchronization after fork.

(cherry picked from commit a19e3c95e9)

* feat(sdk/go): add tags filter and relations API for parity

Sweep findings: F-11, F-12. Expose existing server capabilities consistently to Go callers.

(cherry picked from commit 8af0c2cb36)

* fix(sdk/python): runnable quickstarts, correct migrate payload, explicit timeout precedence

Sweep findings: F-01, F-02, F-14. Initialize documented clients and preserve Python SDK request/config semantics.

(cherry picked from commit d9a64f5665)

---------

Co-authored-by: zhiheng.liu <zhiheng.liu@bytedance.com>
2026-07-28 18:11:30 +08:00

35 lines
1.1 KiB
Go

package openviking
import (
"context"
"net/http"
"net/url"
)
// Relations returns the relations associated with a resource.
func (c *Client) Relations(ctx context.Context, uri string) ([]map[string]any, error) {
query := url.Values{"uri": []string{NormalizeURI(uri)}}
var result []map[string]any
err := c.doJSON(ctx, http.MethodGet, "/api/v1/relations", query, nil, &result)
return result, err
}
// Link creates relations from one resource to a string or []string target.
func (c *Client) Link(ctx context.Context, fromURI string, toURIs any, reason string) error {
payload := map[string]any{
"from_uri": NormalizeURI(fromURI),
"to_uris": normalizeTarget(toURIs),
"reason": reason,
}
return c.doJSON(ctx, http.MethodPost, "/api/v1/relations/link", nil, payload, nil)
}
// Unlink removes a resource relation.
func (c *Client) Unlink(ctx context.Context, fromURI, toURI string) error {
payload := map[string]any{
"from_uri": NormalizeURI(fromURI),
"to_uri": NormalizeURI(toURI),
}
return c.doJSON(ctx, http.MethodDelete, "/api/v1/relations/link", nil, payload, nil)
}