bem

package module
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

README

Bem Go API Library

Go Reference

The Bem Go library provides convenient access to the Bem REST API from applications written in Go.

It is generated with Stainless.

MCP Server

Use the Bem MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.

Add to Cursor Install in VS Code

Note: You may need to set environment variables in your MCP client.

Installation

import (
	"github.com/bem-team/bem-go-sdk" // imported as bem
)

Or to pin the version:

go get -u 'github.com/bem-team/bem-go-sdk@v0.21.0'

Requirements

This library requires Go 1.22+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/bem-team/bem-go-sdk"
	"github.com/bem-team/bem-go-sdk/option"
)

func main() {
	client := bem.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("BEM_API_KEY")
	)
	functionResponse, err := client.Functions.New(context.TODO(), bem.FunctionNewParams{
		CreateFunction: bem.CreateFunctionUnionParam{
			OfExtract: &bem.CreateFunctionExtractParam{
				FunctionName: "functionName",
			},
		},
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", functionResponse.Function)
}

Request fields

The bem library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `api:"required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, bem.String(string), bem.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := bem.ExampleParams{
	ID:   "id_xxx",          // required property
	Name: bem.String("..."), // optional property

	Point: bem.Point{
		X: 0,          // required field will serialize as 0
		Y: bem.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: bem.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[bem.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of its variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := bem.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Functions.New(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

iter := client.Functions.ListAutoPaging(context.TODO(), bem.FunctionListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	function := iter.Current()
	fmt.Printf("%+v\n", function)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

page, err := client.Functions.List(context.TODO(), bem.FunctionListParams{})
for page != nil {
	for _, function := range page.Functions {
		fmt.Printf("%+v\n", function)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *bem.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Functions.New(context.TODO(), bem.FunctionNewParams{
	CreateFunction: bem.CreateFunctionUnionParam{
		OfExtract: &bem.CreateFunctionExtractParam{
			FunctionName: "functionName",
		},
	},
})
if err != nil {
	var apierr *bem.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/v3/functions": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Functions.New(
	ctx,
	bem.FunctionNewParams{
		CreateFunction: bem.CreateFunctionUnionParam{
			OfExtract: &bem.CreateFunctionExtractParam{
				FunctionName: "functionName",
			},
		},
	},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper bem.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := bem.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Functions.New(
	context.TODO(),
	bem.FunctionNewParams{
		CreateFunction: bem.CreateFunctionUnionParam{
			OfExtract: &bem.CreateFunctionExtractParam{
				FunctionName: "functionName",
			},
		},
	},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
functionResponse, err := client.Functions.New(
	context.TODO(),
	bem.FunctionNewParams{
		CreateFunction: bem.CreateFunctionUnionParam{
			OfExtract: &bem.CreateFunctionExtractParam{
				FunctionName: "functionName",
			},
		},
	},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", functionResponse)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: bem.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := bem.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (BEM_API_KEY, BEM_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type AnyTypeUnion

type AnyTypeUnion struct {
	// This field will be present if the value is a [[]any] instead of an object.
	OfAnyArray []any `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	JSON   struct {
		OfAnyArray respjson.Field
		OfString   respjson.Field
		OfFloat    respjson.Field
		OfBool     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AnyTypeUnion contains all possible properties and values from [[]any], [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfAnyArray OfString OfFloat OfBool]

func (AnyTypeUnion) AsAnyArray

func (u AnyTypeUnion) AsAnyArray() (v []any)

func (AnyTypeUnion) AsBool

func (u AnyTypeUnion) AsBool() (v bool)

func (AnyTypeUnion) AsFloat

func (u AnyTypeUnion) AsFloat() (v float64)

func (AnyTypeUnion) AsString

func (u AnyTypeUnion) AsString() (v string)

func (AnyTypeUnion) RawJSON

func (u AnyTypeUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*AnyTypeUnion) UnmarshalJSON

func (r *AnyTypeUnion) UnmarshalJSON(data []byte) error

type BucketDeleteParams added in v0.21.0

type BucketDeleteParams struct {
	// When `true`, delete the bucket even if it still contains entities (the entities
	// are removed along with it). When omitted or `false`, the request is rejected
	// with `409 Conflict` if the bucket is non-empty.
	//
	// The default bucket can never be deleted regardless of this flag.
	Cascade param.Opt[bool] `query:"cascade,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (BucketDeleteParams) URLQuery added in v0.21.0

func (r BucketDeleteParams) URLQuery() (v url.Values, err error)

URLQuery serializes BucketDeleteParams's query parameters as `url.Values`.

type BucketGetResponse added in v0.21.0

type BucketGetResponse struct {
	// Stable public identifier for the bucket (`bkt_...`).
	BucketID string `json:"bucketID" api:"required"`
	// Creation timestamp (RFC 3339).
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Optional human-facing note about the bucket.
	Description string `json:"description" api:"required"`
	// Whether this is the account+environment's default bucket.
	IsDefault bool `json:"isDefault" api:"required"`
	// Human-facing bucket name. Unique within an account+environment.
	Name string `json:"name" api:"required"`
	// Last-update timestamp (RFC 3339).
	UpdatedAt time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BucketID    respjson.Field
		CreatedAt   respjson.Field
		Description respjson.Field
		IsDefault   respjson.Field
		Name        respjson.Field
		UpdatedAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A Bucket is a named partition of the knowledge graph within an account+environment. Entities, mentions, and relations are scoped to a bucket so a single account+environment can host multiple isolated graphs.

Every account+environment has exactly one default bucket. The default bucket can be renamed but never deleted.

func (BucketGetResponse) RawJSON added in v0.21.0

func (r BucketGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BucketGetResponse) UnmarshalJSON added in v0.21.0

func (r *BucketGetResponse) UnmarshalJSON(data []byte) error

type BucketListParams added in v0.21.0

type BucketListParams struct {
	// Cursor: return buckets whose `bucketID` sorts before this value.
	EndingBefore param.Opt[string] `query:"endingBefore,omitzero" json:"-"`
	// Maximum number of buckets to return (default 50, max 200).
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Case-insensitive substring match on the bucket name.
	NameSubstring param.Opt[string] `query:"nameSubstring,omitzero" json:"-"`
	// Cursor: return buckets whose `bucketID` sorts after this value.
	StartingAfter param.Opt[string] `query:"startingAfter,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (BucketListParams) URLQuery added in v0.21.0

func (r BucketListParams) URLQuery() (v url.Values, err error)

URLQuery serializes BucketListParams's query parameters as `url.Values`.

type BucketListResponse added in v0.21.0

type BucketListResponse struct {
	Buckets []BucketListResponseBucket `json:"buckets" api:"required"`
	// Total number of buckets matching the query, ignoring pagination.
	TotalCount int64 `json:"totalCount" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Buckets     respjson.Field
		TotalCount  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response body for listing buckets.

func (BucketListResponse) RawJSON added in v0.21.0

func (r BucketListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BucketListResponse) UnmarshalJSON added in v0.21.0

func (r *BucketListResponse) UnmarshalJSON(data []byte) error

type BucketListResponseBucket added in v0.21.0

type BucketListResponseBucket struct {
	// Stable public identifier for the bucket (`bkt_...`).
	BucketID string `json:"bucketID" api:"required"`
	// Creation timestamp (RFC 3339).
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Optional human-facing note about the bucket.
	Description string `json:"description" api:"required"`
	// Whether this is the account+environment's default bucket.
	IsDefault bool `json:"isDefault" api:"required"`
	// Human-facing bucket name. Unique within an account+environment.
	Name string `json:"name" api:"required"`
	// Last-update timestamp (RFC 3339).
	UpdatedAt time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BucketID    respjson.Field
		CreatedAt   respjson.Field
		Description respjson.Field
		IsDefault   respjson.Field
		Name        respjson.Field
		UpdatedAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A Bucket is a named partition of the knowledge graph within an account+environment. Entities, mentions, and relations are scoped to a bucket so a single account+environment can host multiple isolated graphs.

Every account+environment has exactly one default bucket. The default bucket can be renamed but never deleted.

func (BucketListResponseBucket) RawJSON added in v0.21.0

func (r BucketListResponseBucket) RawJSON() string

Returns the unmodified JSON received from the API

func (*BucketListResponseBucket) UnmarshalJSON added in v0.21.0

func (r *BucketListResponseBucket) UnmarshalJSON(data []byte) error

type BucketNewParams added in v0.21.0

type BucketNewParams struct {
	// Bucket name. Required and unique within the account+environment.
	Name string `json:"name" api:"required"`
	// Optional description.
	Description param.Opt[string] `json:"description,omitzero"`
	// contains filtered or unexported fields
}

func (BucketNewParams) MarshalJSON added in v0.21.0

func (r BucketNewParams) MarshalJSON() (data []byte, err error)

func (*BucketNewParams) UnmarshalJSON added in v0.21.0

func (r *BucketNewParams) UnmarshalJSON(data []byte) error

type BucketNewResponse added in v0.21.0

type BucketNewResponse struct {
	// Stable public identifier for the bucket (`bkt_...`).
	BucketID string `json:"bucketID" api:"required"`
	// Creation timestamp (RFC 3339).
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Optional human-facing note about the bucket.
	Description string `json:"description" api:"required"`
	// Whether this is the account+environment's default bucket.
	IsDefault bool `json:"isDefault" api:"required"`
	// Human-facing bucket name. Unique within an account+environment.
	Name string `json:"name" api:"required"`
	// Last-update timestamp (RFC 3339).
	UpdatedAt time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BucketID    respjson.Field
		CreatedAt   respjson.Field
		Description respjson.Field
		IsDefault   respjson.Field
		Name        respjson.Field
		UpdatedAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A Bucket is a named partition of the knowledge graph within an account+environment. Entities, mentions, and relations are scoped to a bucket so a single account+environment can host multiple isolated graphs.

Every account+environment has exactly one default bucket. The default bucket can be renamed but never deleted.

func (BucketNewResponse) RawJSON added in v0.21.0

func (r BucketNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BucketNewResponse) UnmarshalJSON added in v0.21.0

func (r *BucketNewResponse) UnmarshalJSON(data []byte) error

type BucketService added in v0.21.0

type BucketService struct {
	// contains filtered or unexported fields
}

Buckets are named partitions of the knowledge graph within an account+environment. Entities, mentions, and relations are scoped to a bucket so a single account+environment can host multiple isolated graphs — for example one per data source or workspace.

Every account+environment has exactly one **default** bucket, used by unscoped flows. The default bucket can be renamed but never deleted.

Use these endpoints to create, list, fetch, rename, and delete buckets:

  • **`POST /v3/buckets`** creates a non-default bucket.
  • **`GET /v3/buckets`** lists buckets with cursor pagination (`startingAfter` / `endingBefore` over `bucketID`).
  • **`PATCH /v3/buckets/{bucketID}`** updates `name` and/or `description`.
  • **`DELETE /v3/buckets/{bucketID}`** soft-deletes a bucket. A non-empty bucket is rejected with `409 Conflict` unless `?cascade=true` is passed; the default bucket can never be deleted.

BucketService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBucketService method instead.

func NewBucketService added in v0.21.0

func NewBucketService(opts ...option.RequestOption) (r BucketService)

NewBucketService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*BucketService) Delete added in v0.21.0

func (r *BucketService) Delete(ctx context.Context, bucketID string, body BucketDeleteParams, opts ...option.RequestOption) (err error)

Delete a Bucket

func (*BucketService) Get added in v0.21.0

func (r *BucketService) Get(ctx context.Context, bucketID string, opts ...option.RequestOption) (res *BucketGetResponse, err error)

Get a Bucket

func (*BucketService) List added in v0.21.0

func (r *BucketService) List(ctx context.Context, query BucketListParams, opts ...option.RequestOption) (res *BucketListResponse, err error)

List Buckets

func (*BucketService) New added in v0.21.0

Create a Bucket

func (*BucketService) Update added in v0.21.0

func (r *BucketService) Update(ctx context.Context, bucketID string, body BucketUpdateParams, opts ...option.RequestOption) (res *BucketUpdateResponse, err error)

Update a Bucket

type BucketUpdateParams added in v0.21.0

type BucketUpdateParams struct {
	// New description.
	Description param.Opt[string] `json:"description,omitzero"`
	// New name.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (BucketUpdateParams) MarshalJSON added in v0.21.0

func (r BucketUpdateParams) MarshalJSON() (data []byte, err error)

func (*BucketUpdateParams) UnmarshalJSON added in v0.21.0

func (r *BucketUpdateParams) UnmarshalJSON(data []byte) error

type BucketUpdateResponse added in v0.21.0

type BucketUpdateResponse struct {
	// Stable public identifier for the bucket (`bkt_...`).
	BucketID string `json:"bucketID" api:"required"`
	// Creation timestamp (RFC 3339).
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Optional human-facing note about the bucket.
	Description string `json:"description" api:"required"`
	// Whether this is the account+environment's default bucket.
	IsDefault bool `json:"isDefault" api:"required"`
	// Human-facing bucket name. Unique within an account+environment.
	Name string `json:"name" api:"required"`
	// Last-update timestamp (RFC 3339).
	UpdatedAt time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BucketID    respjson.Field
		CreatedAt   respjson.Field
		Description respjson.Field
		IsDefault   respjson.Field
		Name        respjson.Field
		UpdatedAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A Bucket is a named partition of the knowledge graph within an account+environment. Entities, mentions, and relations are scoped to a bucket so a single account+environment can host multiple isolated graphs.

Every account+environment has exactly one default bucket. The default bucket can be renamed but never deleted.

func (BucketUpdateResponse) RawJSON added in v0.21.0

func (r BucketUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BucketUpdateResponse) UnmarshalJSON added in v0.21.0

func (r *BucketUpdateResponse) UnmarshalJSON(data []byte) error

type Call

type Call struct {
	// Unique identifier of the call.
	CallID string `json:"callID" api:"required"`
	// The date and time the call was created.
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Terminal error events of this call. Workflow calls are not atomic — `errors` and
	// `outputs` may both be non-empty if some enclosed function calls succeeded and
	// others failed.
	//
	// Retrieve individual errors via `GET /v3/errors/{eventID}`.
	Errors []ErrorEvent `json:"errors" api:"required"`
	// Terminal non-error outputs of this call: primary events (non-split-collection)
	// that did not trigger any downstream function calls. Workflow calls are not
	// atomic — `outputs` and `errors` may both be non-empty if some enclosed function
	// calls succeeded and others failed.
	//
	// Each element is a polymorphic event object; inspect `eventType` to determine the
	// type. Retrieve individual outputs via `GET /v3/outputs/{eventID}`.
	Outputs []EventUnion `json:"outputs" api:"required"`
	// Hint URL for the full execution trace: `GET /v3/calls/{callID}/trace`.
	TraceURL string `json:"traceUrl" api:"required"`
	// Hint URL for retrieving this call: `GET /v3/calls/{callID}`.
	URL string `json:"url" api:"required"`
	// Your reference ID for this call, propagated from the original request.
	CallReferenceID string `json:"callReferenceID"`
	// The date and time the call finished. Only set once status is `completed` or
	// `failed`.
	FinishedAt time.Time `json:"finishedAt" format:"date-time"`
	// Input to the main function call.
	Input CallInput `json:"input"`
	// Status of call.
	//
	// Any of "pending", "running", "completed", "failed".
	Status CallStatus `json:"status"`
	// Unique identifier of the workflow.
	WorkflowID string `json:"workflowID"`
	// Name of the workflow.
	WorkflowName string `json:"workflowName"`
	// Version number of the workflow.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CallID             respjson.Field
		CreatedAt          respjson.Field
		Errors             respjson.Field
		Outputs            respjson.Field
		TraceURL           respjson.Field
		URL                respjson.Field
		CallReferenceID    respjson.Field
		FinishedAt         respjson.Field
		Input              respjson.Field
		Status             respjson.Field
		WorkflowID         respjson.Field
		WorkflowName       respjson.Field
		WorkflowVersionNum respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A workflow call returned by the V3 API.

Compared to the V2 `Call` model:

  • Terminal outputs are split into `outputs` (non-error events) and `errors` (error events)
  • `callType` and function-scoped fields are removed — V3 calls are always workflow calls
  • The deprecated `functionCalls` field is removed (use `GET /v3/calls/{callID}/trace`)
  • `url` and `traceUrl` hint fields are included for resource discovery

func (Call) RawJSON

func (r Call) RawJSON() string

Returns the unmodified JSON received from the API

func (*Call) UnmarshalJSON

func (r *Call) UnmarshalJSON(data []byte) error

type CallGetResponse

type CallGetResponse struct {
	// A workflow call returned by the V3 API.
	//
	// Compared to the V2 `Call` model:
	//
	//   - Terminal outputs are split into `outputs` (non-error events) and `errors`
	//     (error events)
	//   - `callType` and function-scoped fields are removed — V3 calls are always
	//     workflow calls
	//   - The deprecated `functionCalls` field is removed (use
	//     `GET /v3/calls/{callID}/trace`)
	//   - `url` and `traceUrl` hint fields are included for resource discovery
	Call Call `json:"call"`
	// Error message if the call retrieval failed, or if the call itself failed when
	// using `wait=true`.
	Error string `json:"error"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Call        respjson.Field
		Error       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CallGetResponse) RawJSON

func (r CallGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CallGetResponse) UnmarshalJSON

func (r *CallGetResponse) UnmarshalJSON(data []byte) error

type CallGetTraceResponse added in v0.9.0

type CallGetTraceResponse struct {
	// Error message if trace retrieval failed.
	Error string `json:"error"`
	// Full execution DAG of a call as flat arrays. Reconstruct the graph using
	// FunctionCallResponseBase.sourceEventID and each event's functionCallID.
	Trace CallGetTraceResponseTrace `json:"trace"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Error       respjson.Field
		Trace       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response from `GET /v3/calls/{callID}/trace`.

Contains the full execution DAG as flat arrays of function calls and events. Reconstruct the graph using `FunctionCallResponseBase.sourceEventID` (the event that spawned each function call) and each event's `functionCallID` (the function call that emitted it).

func (CallGetTraceResponse) RawJSON added in v0.9.0

func (r CallGetTraceResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CallGetTraceResponse) UnmarshalJSON added in v0.9.0

func (r *CallGetTraceResponse) UnmarshalJSON(data []byte) error

type CallGetTraceResponseTrace added in v0.9.0

type CallGetTraceResponseTrace struct {
	// All events emitted within this call, polymorphic by eventType.
	Events []any `json:"events" api:"required"`
	// All function calls executed within this call.
	FunctionCalls []CallGetTraceResponseTraceFunctionCall `json:"functionCalls" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Events        respjson.Field
		FunctionCalls respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Full execution DAG of a call as flat arrays. Reconstruct the graph using FunctionCallResponseBase.sourceEventID and each event's functionCallID.

func (CallGetTraceResponseTrace) RawJSON added in v0.9.0

func (r CallGetTraceResponseTrace) RawJSON() string

Returns the unmodified JSON received from the API

func (*CallGetTraceResponseTrace) UnmarshalJSON added in v0.9.0

func (r *CallGetTraceResponseTrace) UnmarshalJSON(data []byte) error

type CallGetTraceResponseTraceFunctionCall added in v0.9.0

type CallGetTraceResponseTraceFunctionCall struct {
	// Unique identifier for this function call
	FunctionCallID string `json:"functionCallID" api:"required"`
	// ID of the function that was called
	FunctionID string `json:"functionID" api:"required"`
	// Name of the function that was called
	FunctionName string `json:"functionName" api:"required"`
	// User-provided reference ID for tracking
	ReferenceID string `json:"referenceID" api:"required"`
	// The date and time this function call started.
	StartedAt time.Time `json:"startedAt" api:"required" format:"date-time"`
	// The status of the action.
	//
	// Any of "pending", "running", "completed", "failed".
	Status string `json:"status" api:"required"`
	// The type of the function.
	//
	// Any of "transform", "extract", "route", "classify", "send", "split", "join",
	// "analyze", "payload_shaping", "enrich", "parse".
	Type FunctionType `json:"type" api:"required"`
	// Array of activity steps for this function call
	Activity []CallGetTraceResponseTraceFunctionCallActivity `json:"activity"`
	// The date and time this function call finished. Absent while still running.
	FinishedAt time.Time `json:"finishedAt" format:"date-time"`
	// Version number of the function
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The labelled outlet on the upstream node that routed execution to this call.
	// Absent for root calls, unlabelled edges, and pre-migration rows.
	IncomingDestinationName string `json:"incomingDestinationName"`
	// Array of all file inputs with their S3 URLs
	Inputs []CallGetTraceResponseTraceFunctionCallInput `json:"inputs"`
	// Input type for single file input (set when there's exactly one file input)
	InputType string `json:"inputType"`
	// Presigned S3 URL for single file input (set when there's exactly one file input)
	S3URL string `json:"s3URL"`
	// ID of the event that spawned this function call (for DAG reconstruction). Nil
	// for the root function call.
	SourceEventID string `json:"sourceEventID"`
	// ID of the function call that spawned this function call (for DAG reconstruction)
	SourceFunctionCallID string `json:"sourceFunctionCallID"`
	// ID of the workflow call this function call belongs to (top-level execution
	// context)
	WorkflowCallID string `json:"workflowCallID"`
	// Name of the workflow DAG call-site node this function call is executing. Absent
	// for non-workflow calls and pre-migration rows.
	WorkflowNodeName string `json:"workflowNodeName"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FunctionCallID          respjson.Field
		FunctionID              respjson.Field
		FunctionName            respjson.Field
		ReferenceID             respjson.Field
		StartedAt               respjson.Field
		Status                  respjson.Field
		Type                    respjson.Field
		Activity                respjson.Field
		FinishedAt              respjson.Field
		FunctionVersionNum      respjson.Field
		IncomingDestinationName respjson.Field
		Inputs                  respjson.Field
		InputType               respjson.Field
		S3URL                   respjson.Field
		SourceEventID           respjson.Field
		SourceFunctionCallID    respjson.Field
		WorkflowCallID          respjson.Field
		WorkflowNodeName        respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CallGetTraceResponseTraceFunctionCall) RawJSON added in v0.9.0

Returns the unmodified JSON received from the API

func (*CallGetTraceResponseTraceFunctionCall) UnmarshalJSON added in v0.9.0

func (r *CallGetTraceResponseTraceFunctionCall) UnmarshalJSON(data []byte) error

type CallGetTraceResponseTraceFunctionCallActivity added in v0.9.0

type CallGetTraceResponseTraceFunctionCallActivity struct {
	DisplayName string `json:"displayName"`
	// Any of "pending", "running", "completed", "failed".
	Status string `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DisplayName respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CallGetTraceResponseTraceFunctionCallActivity) RawJSON added in v0.9.0

Returns the unmodified JSON received from the API

func (*CallGetTraceResponseTraceFunctionCallActivity) UnmarshalJSON added in v0.9.0

func (r *CallGetTraceResponseTraceFunctionCallActivity) UnmarshalJSON(data []byte) error

type CallGetTraceResponseTraceFunctionCallInput added in v0.9.0

type CallGetTraceResponseTraceFunctionCallInput struct {
	// Input type of the file
	InputType string `json:"inputType"`
	// Item reference ID for batch inputs
	ItemReferenceID string `json:"itemReferenceID"`
	// Presigned S3 URL for the file input
	S3URL string `json:"s3URL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InputType       respjson.Field
		ItemReferenceID respjson.Field
		S3URL           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CallGetTraceResponseTraceFunctionCallInput) RawJSON added in v0.9.0

Returns the unmodified JSON received from the API

func (*CallGetTraceResponseTraceFunctionCallInput) UnmarshalJSON added in v0.9.0

func (r *CallGetTraceResponseTraceFunctionCallInput) UnmarshalJSON(data []byte) error

type CallInput

type CallInput struct {
	BatchFiles CallInputBatchFiles `json:"batchFiles"`
	SingleFile CallInputSingleFile `json:"singleFile"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BatchFiles  respjson.Field
		SingleFile  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Input to the main function call.

func (CallInput) RawJSON

func (r CallInput) RawJSON() string

Returns the unmodified JSON received from the API

func (*CallInput) UnmarshalJSON

func (r *CallInput) UnmarshalJSON(data []byte) error

type CallInputBatchFiles

type CallInputBatchFiles struct {
	Inputs []CallInputBatchFilesInput `json:"inputs"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Inputs      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CallInputBatchFiles) RawJSON

func (r CallInputBatchFiles) RawJSON() string

Returns the unmodified JSON received from the API

func (*CallInputBatchFiles) UnmarshalJSON

func (r *CallInputBatchFiles) UnmarshalJSON(data []byte) error

type CallInputBatchFilesInput

type CallInputBatchFilesInput struct {
	// Input type of the file
	InputType string `json:"inputType"`
	// Item reference ID
	ItemReferenceID string `json:"itemReferenceID"`
	// Presigned S3 URL for the file
	S3URL string `json:"s3URL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InputType       respjson.Field
		ItemReferenceID respjson.Field
		S3URL           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CallInputBatchFilesInput) RawJSON

func (r CallInputBatchFilesInput) RawJSON() string

Returns the unmodified JSON received from the API

func (*CallInputBatchFilesInput) UnmarshalJSON

func (r *CallInputBatchFilesInput) UnmarshalJSON(data []byte) error

type CallInputSingleFile

type CallInputSingleFile struct {
	// Input type of the file
	InputType string `json:"inputType"`
	// Presigned S3 URL for the file
	S3URL string `json:"s3URL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InputType   respjson.Field
		S3URL       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CallInputSingleFile) RawJSON

func (r CallInputSingleFile) RawJSON() string

Returns the unmodified JSON received from the API

func (*CallInputSingleFile) UnmarshalJSON

func (r *CallInputSingleFile) UnmarshalJSON(data []byte) error

type CallListParams

type CallListParams struct {
	EndingBefore param.Opt[string] `query:"endingBefore,omitzero" json:"-"`
	Limit        param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// Case-insensitive substring match against `callReferenceID`.
	ReferenceIDSubstring param.Opt[string] `query:"referenceIDSubstring,omitzero" json:"-"`
	StartingAfter        param.Opt[string] `query:"startingAfter,omitzero" json:"-"`
	CallIDs              []string          `query:"callIDs,omitzero" json:"-"`
	ReferenceIDs         []string          `query:"referenceIDs,omitzero" json:"-"`
	// Any of "asc", "desc".
	SortOrder CallListParamsSortOrder `query:"sortOrder,omitzero" json:"-"`
	// Filter by one or more statuses.
	//
	// Any of "pending", "running", "completed", "failed".
	Statuses      []string `query:"statuses,omitzero" json:"-"`
	WorkflowIDs   []string `query:"workflowIDs,omitzero" json:"-"`
	WorkflowNames []string `query:"workflowNames,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CallListParams) URLQuery

func (r CallListParams) URLQuery() (v url.Values, err error)

URLQuery serializes CallListParams's query parameters as `url.Values`.

type CallListParamsSortOrder

type CallListParamsSortOrder string
const (
	CallListParamsSortOrderAsc  CallListParamsSortOrder = "asc"
	CallListParamsSortOrderDesc CallListParamsSortOrder = "desc"
)

type CallService

type CallService struct {
	// contains filtered or unexported fields
}

The Calls API provides a unified interface for invoking both **Workflows** and **Functions**.

Use this API when you want to:

- Execute a complete workflow that chains multiple functions together - Call a single function directly without defining a workflow - Submit batch requests with multiple inputs in a single API call - Track execution status using call reference IDs

**Key Difference**: Calls vs Function Calls

  • **Calls API** (`/v3/calls`): High-level API for invoking workflows or functions by name/ID. Supports batch processing and workflow orchestration.
  • **Function Calls API** (`/v3/functions/{functionName}/call`): Direct function invocation with function-type-specific arguments. Better for granular control over individual function calls.

CallService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCallService method instead.

func NewCallService

func NewCallService(opts ...option.RequestOption) (r CallService)

NewCallService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CallService) Get

func (r *CallService) Get(ctx context.Context, callID string, opts ...option.RequestOption) (res *CallGetResponse, err error)

**Retrieve a workflow call by ID.**

Returns the full call object including status, workflow details, terminal outputs, and terminal errors. `outputs` and `errors` are both populated once the call finishes — they are not mutually exclusive (a partially-completed workflow may have both).

## Status

| Status | Description | | ----------- | ----------------------------------------------------------- | | `pending` | Queued, not yet started | | `running` | Currently executing | | `completed` | All enclosed function calls finished without errors | | `failed` | One or more enclosed function calls produced an error event |

Poll this endpoint or configure a webhook subscription to detect completion.

func (*CallService) GetTrace added in v0.9.0

func (r *CallService) GetTrace(ctx context.Context, callID string, opts ...option.RequestOption) (res *CallGetTraceResponse, err error)

**Retrieve the full execution trace of a workflow call.**

Returns all function calls and events emitted during the call as flat arrays. The DAG can be reconstructed using `FunctionCallResponseBase.sourceEventID` (the event that spawned each function call) and each event's `functionCallID` (the function call that emitted it).

## Graph structure

  • A function call with no `sourceEventID` is the root.
  • An event's `functionCallID` points to the function call that emitted it.
  • A function call's `sourceEventID` points to the event that triggered it.
  • `workflowNodeName` identifies the DAG node; `incomingDestinationName` identifies the labelled outlet used to reach this call (absent for unlabelled edges and root calls).

The trace is available as soon as the call exists and grows as execution proceeds.

func (*CallService) List

func (r *CallService) List(ctx context.Context, query CallListParams, opts ...option.RequestOption) (res *pagination.CallsPage[Call], err error)

**List workflow calls with filtering and pagination.**

Returns calls created via `POST /v3/workflows/{workflowName}/call`.

## Filtering

- `callIDs`: Specific call identifiers - `referenceIDs`: Your custom reference IDs - `workflowIDs` / `workflowNames`: Filter by workflow

## Pagination

Use `startingAfter` and `endingBefore` cursors with a default limit of 50.

func (*CallService) ListAutoPaging

**List workflow calls with filtering and pagination.**

Returns calls created via `POST /v3/workflows/{workflowName}/call`.

## Filtering

- `callIDs`: Specific call identifiers - `referenceIDs`: Your custom reference IDs - `workflowIDs` / `workflowNames`: Filter by workflow

## Pagination

Use `startingAfter` and `endingBefore` cursors with a default limit of 50.

type CallStatus

type CallStatus string

Status of call.

const (
	CallStatusPending   CallStatus = "pending"
	CallStatusRunning   CallStatus = "running"
	CallStatusCompleted CallStatus = "completed"
	CallStatusFailed    CallStatus = "failed"
)

type ClassificationListItem added in v0.7.0

type ClassificationListItem struct {
	Name            string                       `json:"name" api:"required"`
	Description     string                       `json:"description"`
	FunctionID      string                       `json:"functionID"`
	FunctionName    string                       `json:"functionName"`
	IsErrorFallback bool                         `json:"isErrorFallback"`
	Origin          ClassificationListItemOrigin `json:"origin"`
	Regex           ClassificationListItemRegex  `json:"regex"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name            respjson.Field
		Description     respjson.Field
		FunctionID      respjson.Field
		FunctionName    respjson.Field
		IsErrorFallback respjson.Field
		Origin          respjson.Field
		Regex           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ClassificationListItem) RawJSON added in v0.7.0

func (r ClassificationListItem) RawJSON() string

Returns the unmodified JSON received from the API

func (ClassificationListItem) ToParam added in v0.7.0

ToParam converts this ClassificationListItem to a ClassificationListItemParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ClassificationListItemParam.Overrides()

func (*ClassificationListItem) UnmarshalJSON added in v0.7.0

func (r *ClassificationListItem) UnmarshalJSON(data []byte) error

type ClassificationListItemOrigin added in v0.7.0

type ClassificationListItemOrigin struct {
	Email ClassificationListItemOriginEmail `json:"email"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Email       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ClassificationListItemOrigin) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*ClassificationListItemOrigin) UnmarshalJSON added in v0.7.0

func (r *ClassificationListItemOrigin) UnmarshalJSON(data []byte) error

type ClassificationListItemOriginEmail added in v0.7.0

type ClassificationListItemOriginEmail struct {
	Patterns []string `json:"patterns"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Patterns    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ClassificationListItemOriginEmail) RawJSON added in v0.7.0

Returns the unmodified JSON received from the API

func (*ClassificationListItemOriginEmail) UnmarshalJSON added in v0.7.0

func (r *ClassificationListItemOriginEmail) UnmarshalJSON(data []byte) error

type ClassificationListItemOriginEmailParam added in v0.7.0

type ClassificationListItemOriginEmailParam struct {
	Patterns []string `json:"patterns,omitzero"`
	// contains filtered or unexported fields
}

func (ClassificationListItemOriginEmailParam) MarshalJSON added in v0.7.0

func (r ClassificationListItemOriginEmailParam) MarshalJSON() (data []byte, err error)

func (*ClassificationListItemOriginEmailParam) UnmarshalJSON added in v0.7.0

func (r *ClassificationListItemOriginEmailParam) UnmarshalJSON(data []byte) error

type ClassificationListItemOriginParam added in v0.7.0

type ClassificationListItemOriginParam struct {
	Email ClassificationListItemOriginEmailParam `json:"email,omitzero"`
	// contains filtered or unexported fields
}

func (ClassificationListItemOriginParam) MarshalJSON added in v0.7.0

func (r ClassificationListItemOriginParam) MarshalJSON() (data []byte, err error)

func (*ClassificationListItemOriginParam) UnmarshalJSON added in v0.7.0

func (r *ClassificationListItemOriginParam) UnmarshalJSON(data []byte) error

type ClassificationListItemParam added in v0.7.0

type ClassificationListItemParam struct {
	Name            string                            `json:"name" api:"required"`
	Description     param.Opt[string]                 `json:"description,omitzero"`
	FunctionID      param.Opt[string]                 `json:"functionID,omitzero"`
	FunctionName    param.Opt[string]                 `json:"functionName,omitzero"`
	IsErrorFallback param.Opt[bool]                   `json:"isErrorFallback,omitzero"`
	Origin          ClassificationListItemOriginParam `json:"origin,omitzero"`
	Regex           ClassificationListItemRegexParam  `json:"regex,omitzero"`
	// contains filtered or unexported fields
}

The property Name is required.

func (ClassificationListItemParam) MarshalJSON added in v0.7.0

func (r ClassificationListItemParam) MarshalJSON() (data []byte, err error)

func (*ClassificationListItemParam) UnmarshalJSON added in v0.7.0

func (r *ClassificationListItemParam) UnmarshalJSON(data []byte) error

type ClassificationListItemRegex added in v0.7.0

type ClassificationListItemRegex struct {
	Patterns []string `json:"patterns"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Patterns    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ClassificationListItemRegex) RawJSON added in v0.7.0

func (r ClassificationListItemRegex) RawJSON() string

Returns the unmodified JSON received from the API

func (*ClassificationListItemRegex) UnmarshalJSON added in v0.7.0

func (r *ClassificationListItemRegex) UnmarshalJSON(data []byte) error

type ClassificationListItemRegexParam added in v0.7.0

type ClassificationListItemRegexParam struct {
	Patterns []string `json:"patterns,omitzero"`
	// contains filtered or unexported fields
}

func (ClassificationListItemRegexParam) MarshalJSON added in v0.7.0

func (r ClassificationListItemRegexParam) MarshalJSON() (data []byte, err error)

func (*ClassificationListItemRegexParam) UnmarshalJSON added in v0.7.0

func (r *ClassificationListItemRegexParam) UnmarshalJSON(data []byte) error

type ClassifyWebhookEvent added in v0.14.0

type ClassifyWebhookEvent struct {
	// The classification chosen by the classify function.
	Choice string `json:"choice" api:"required"`
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "classify".
	EventType ClassifyWebhookEventEventType `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent            `json:"inboundEmail"`
	Metadata     ClassifyWebhookEventMetadata `json:"metadata"`
	// The presigned S3 URL of the file that was classified.
	S3URL string `json:"s3URL"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Choice                respjson.Field
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ReferenceID           respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		S3URL                 respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ClassifyWebhookEvent) RawJSON added in v0.14.0

func (r ClassifyWebhookEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ClassifyWebhookEvent) UnmarshalJSON added in v0.14.0

func (r *ClassifyWebhookEvent) UnmarshalJSON(data []byte) error

type ClassifyWebhookEventEventType added in v0.14.0

type ClassifyWebhookEventEventType string
const (
	ClassifyWebhookEventEventTypeClassify ClassifyWebhookEventEventType = "classify"
)

type ClassifyWebhookEventMetadata added in v0.14.0

type ClassifyWebhookEventMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ClassifyWebhookEventMetadata) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*ClassifyWebhookEventMetadata) UnmarshalJSON added in v0.14.0

func (r *ClassifyWebhookEventMetadata) UnmarshalJSON(data []byte) error

type Client

type Client struct {
	Functions FunctionService
	// The Calls API provides a unified interface for invoking both **Workflows** and
	// **Functions**.
	//
	// Use this API when you want to:
	//
	// - Execute a complete workflow that chains multiple functions together
	// - Call a single function directly without defining a workflow
	// - Submit batch requests with multiple inputs in a single API call
	// - Track execution status using call reference IDs
	//
	// **Key Difference**: Calls vs Function Calls
	//
	//   - **Calls API** (`/v3/calls`): High-level API for invoking workflows or
	//     functions by name/ID. Supports batch processing and workflow orchestration.
	//   - **Function Calls API** (`/v3/functions/{functionName}/call`): Direct function
	//     invocation with function-type-specific arguments. Better for granular control
	//     over individual function calls.
	Calls CallService
	// Retrieve terminal error events from workflow calls.
	//
	// Errors are events produced by function steps that failed during processing. A
	// single workflow call may produce multiple error events if several steps fail
	// independently.
	//
	// Errors and outputs from the same call are not mutually exclusive: a
	// partially-completed workflow may have both.
	//
	// Use `GET /v3/errors` to list errors across calls, or `GET /v3/errors/{eventID}`
	// to retrieve a specific error. To get errors scoped to a single call, filter by
	// `callIDs`.
	Errors ErrorService
	// Retrieve terminal non-error output events from workflow calls.
	//
	// Outputs are events produced by successful terminal function steps — steps that
	// completed without errors and did not spawn further downstream function calls. A
	// single workflow call may produce multiple outputs (e.g. from a
	// split-then-transform pipeline).
	//
	// Outputs and errors from the same call are not mutually exclusive: a
	// partially-completed workflow may have both.
	//
	// Use `GET /v3/outputs` to list outputs across calls, or
	// `GET /v3/outputs/{eventID}` to retrieve a specific output. To get outputs scoped
	// to a single call, filter by `callIDs`.
	Outputs OutputService
	// Workflows orchestrate one or more functions into a directed acyclic graph (DAG)
	// for document processing.
	//
	// Use these endpoints to create, update, list, and manage workflows, and to invoke
	// them with file input via `POST /v3/workflows/{workflowName}/call`.
	//
	// The call endpoint accepts files as either multipart form data or JSON with
	// base64-encoded content. In the Bem CLI, use `@path/to/file` inside JSON values
	// to automatically read and encode files:
	//
	// “`
	//
	//	bem workflows call --workflow-name my-workflow \
	//	  --input.single-file '{"inputContent": "@file.pdf", "inputType": "pdf"}' \
	//	  --wait
	//
	// “`
	Workflows WorkflowService
	// Infer JSON Schemas from uploaded documents using AI.
	//
	// Upload a file (PDF, image, spreadsheet, email, etc.) and receive a
	// general-purpose JSON Schema that captures the document's structure. The inferred
	// schema can be used directly as the `outputSchema` when creating Extract
	// functions.
	//
	// The schema is designed to be broadly applicable to documents of the same type,
	// not just the specific file uploaded.
	InferSchema InferSchemaService
	// Collections are named groups of embedded items used by Enrich functions for
	// semantic search.
	//
	// Each collection is referenced by a `collectionName`, which supports dot notation
	// for hierarchical paths (e.g. `customers.premium.vip`). Names must contain only
	// letters, digits, underscores, and dots, and each segment must start with a
	// letter or underscore.
	//
	// ## Items
	//
	// Items carry either a string or a JSON object in their `data` field. When items
	// are added or updated, their `data` is embedded asynchronously —
	// `POST /v3/collections/items` and `PUT /v3/collections/items` return immediately
	// with a `pending` status and an `eventID` that can be correlated with webhook
	// notifications once processing completes.
	//
	// ## Listing and hierarchy
	//
	// Use `GET /v3/collections` with `parentCollectionName` to list collections under
	// a path, or `collectionNameSearch` for a case-insensitive substring match.
	// `GET /v3/collections/items` retrieves a specific collection's items; pass
	// `includeSubcollections=true` to fold in items from all descendant collections.
	//
	// ## Token counting
	//
	// Use `POST /v3/collections/token-count` to check whether texts fit within the
	// embedding model's 8,192-token-per-text limit before submitting them for
	// embedding.
	Collections CollectionService
	// Submit training corrections for `extract`, `classify`, and `join` events.
	//
	// Feedback is event-centric — each correction is attached to an event by its
	// `eventID`, and the server resolves the correct underlying storage (extract/join
	// transformations or classify route events) from the event's function type.
	//
	// Split and enrich function types do not support feedback.
	Events   EventService
	Webhooks WebhookService
	// bem POSTs a JSON event to your configured webhook URL each time a subscribed
	// function call, workflow output, or collection-processing job fires. This section
	// is the reference for those deliveries: the payload shape per event type, plus
	// the endpoints you use to manage the signing secret.
	//
	// Every variant shares the same envelope — function/workflow IDs, timestamps, the
	// inbound email that triggered the call, and so on — and adds a payload field that
	// depends on the function type. The `eventType` field on the body is the
	// discriminator: dispatch on it to select which payload shape to expect. SDKs
	// generated from this spec expose a `webhooks.unwrap()` helper that performs the
	// dispatch and returns a typed event.
	//
	// ## Payloads
	//
	// | `eventType`             | Payload                                                                      | Schema                      |
	// | ----------------------- | ---------------------------------------------------------------------------- | --------------------------- |
	// | `extract`               | [Extract event](/api/v3/webhooks/events/extract)                             | `ExtractEvent`              |
	// | `classify`              | [Classify event](/api/v3/webhooks/events/classify)                           | `ClassifyEvent`             |
	// | `parse`                 | [Parse event](/api/v3/webhooks/events/parse)                                 | `ParseEvent`                |
	// | `split_collection`      | [Split collection event](/api/v3/webhooks/events/split-collection)           | `SplitCollectionEvent`      |
	// | `split_item`            | [Split item event](/api/v3/webhooks/events/split-item)                       | `SplitItemEvent`            |
	// | `join`                  | [Join event](/api/v3/webhooks/events/join)                                   | `JoinEvent`                 |
	// | `enrich`                | [Enrich event](/api/v3/webhooks/events/enrich)                               | `EnrichEvent`               |
	// | `payload_shaping`       | [Payload shaping event](/api/v3/webhooks/events/payload-shaping)             | `PayloadShapingEvent`       |
	// | `send`                  | [Send event](/api/v3/webhooks/events/send)                                   | `SendEvent`                 |
	// | `evaluation`            | [Evaluation event](/api/v3/webhooks/events/evaluation)                       | `EvaluationEvent`           |
	// | `collection_processing` | [Collection processing event](/api/v3/webhooks/events/collection-processing) | `collectionProcessingEvent` |
	// | `error`                 | [Error event](/api/v3/webhooks/events/error)                                 | `ErrorEvent`                |
	//
	// ## Signing secret
	//
	// Every delivery includes a `bem-signature` header in the format
	// `t={unix_timestamp},v1={hex_hmac_sha256}`. The signature covers
	// `{timestamp}.{raw_request_body}` and is computed with HMAC-SHA256 using the
	// active signing secret for your environment.
	//
	// To verify a payload:
	//
	//  1. Parse `bem-signature: t={timestamp},v1={signature}`.
	//  2. Construct the signed string: `{timestamp}.{raw_request_body}`.
	//  3. Compute HMAC-SHA256 of that string using your secret.
	//  4. Reject the request if the hex digest doesn't match `v1`, or if the timestamp
	//     is more than a few minutes old.
	//
	// Manage the secret with these endpoints:
	//
	//   - [**Generate a signing secret**](/api/v3/webhooks/secret/generate-secret) —
	//     `POST /v3/webhook-secret`. Returns the new secret in full exactly once.
	//   - [**Get the signing secret**](/api/v3/webhooks/secret/get-secret) —
	//     `GET /v3/webhook-secret`. Returns the active secret.
	//   - [**Revoke the signing secret**](/api/v3/webhooks/secret/revoke-secret) —
	//     `DELETE /v3/webhook-secret`. Webhook deliveries continue but are unsigned
	//     until a new secret is generated.
	//
	// For zero-downtime rotation, briefly accept both the old and new secret in your
	// verification logic before revoking the old one.
	//
	// ## Retries
	//
	// bem treats any non-2XX response (or a transport failure) as a delivery error and
	// retries with exponential backoff. Return a 2XX as soon as you have durably
	// queued the payload — do not block on downstream work.
	WebhookSecret WebhookSecretService
	// Monitor, evaluate, and iterate on the quality of every function in your
	// environment. Function Accuracy bundles two complementary loops:
	//
	// ## Evaluations (`/v3/eval`)
	//
	// Trigger and retrieve per-transformation evaluations. Evaluations run
	// asynchronously and score each transformation's output against the function's
	// schema for confidence, per-field hallucination detection, and relevance.
	// Supported for `extract`, `transform`, `analyze`, and `join` events.
	//
	//  1. **Trigger** — `POST /v3/eval` queues jobs for a batch of transformation IDs.
	//  2. **Poll** — `GET /v3/eval/results` returns the current state of each requested
	//     ID, partitioned into `results`, `pending`, and `failed`. Accepts either
	//     `eventIDs` (preferred) or `transformationIDs` as a comma-separated query
	//     parameter, and always keys the response by event KSUID.
	//
	// Up to 100 IDs may be submitted per request.
	//
	// ## Metrics, review, regression (`/v3/functions/{metrics,review,regression,compare}`)
	//
	// Roll evaluation results and user corrections up into actionable function-level
	// signal:
	//
	//   - **`GET /v3/functions/metrics`** — aggregate accuracy, precision, recall, F1,
	//     and confusion-matrix counts per function.
	//   - **`POST /v3/functions/review`** — sample-size estimation, confidence-bucketed
	//     distribution, PR-AUC, and per-threshold confidence intervals (Wald or Wilson)
	//     for picking review cutoffs.
	//   - **`POST /v3/functions/regression`** — replay corrected historical inputs
	//     against a new function version, producing a labeled regression dataset.
	//   - **`POST /v3/functions/regression/corrections`** — propagate baseline
	//     corrections onto the regression dataset so it can be scored.
	//   - **`POST /v3/functions/compare`** — compute aggregate and field-level lift
	//     between any two versions, optionally scoped to the regression dataset.
	//
	// All five endpoints support `extract` end-to-end on both the vision and OCR
	// paths, alongside the legacy `transform` / `analyze` / `join` types.
	Eval EvalService
	// Unix-shell-style nav over parsed documents and the cross-doc memory store.
	//
	// `POST /v3/fs` is a single op-driven endpoint designed for LLM agents and
	// programmatic consumers that want to walk a corpus the way they'd walk a
	// filesystem.
	//
	// ## Doc-level ops (every parsed document)
	//
	// - `ls` — list parsed documents with rich per-doc metadata.
	// - `cat` — read one doc's parse JSON, sliced (`range`) or projected (`select`).
	// - `head` — first N sections of one doc.
	// - `grep` — substring or regex search; `scope`, `path`, `countOnly` available.
	// - `stat` — metadata only (page/section/entity counts, timestamps).
	//
	// ## Memory-level ops (require `linkAcrossDocuments: true` on the parse function)
	//
	// - `find` — list canonical entities across the corpus.
	// - `open` — entity + mentions.
	// - `xref` — for one entity, sections across docs that mention it (with content).
	//
	// Memory ops return an empty list with a `hint` when no docs in this environment
	// have been memory-linked.
	//
	// ## Pagination
	//
	// List ops paginate by cursor — pass the previous response's `nextCursor` back as
	// `cursor`; `hasMore: false` signals the last page. Same idiom as `/v3/calls` and
	// `/v3/outputs`.
	Fs FService
	// Connectors are integrations that trigger a Bem workflow from an external system.
	//
	// A connector binds an inbound source — currently Box or a Paragon-managed
	// integration such as Google Drive — to a specific workflow (by `workflowName` or
	// `workflowID`). When the source observes a new file, Bem invokes the bound
	// workflow against that file.
	//
	// Use these endpoints to create, list, and remove connectors. The fields used at
	// create time depend on the connector `type`: Box connectors require Box
	// credentials and a folder to watch, while Paragon connectors carry a
	// `paragonIntegration` identifier and an integration-specific
	// `paragonConfiguration` object (for example, `{ "folderId": "..." }` for Google
	// Drive).
	Connectors ConnectorService
	// Subscriptions wire up notifications for the events your functions and
	// collections produce.
	//
	// Most subscriptions target a single function (by `functionName` or `functionID`)
	// or a single collection (by `collectionName` or `collectionID`) and select a
	// `type` corresponding to the event you want to receive — for example `transform`,
	// `route`, `join`, `evaluation`, `error`, `enrich`, or `collection_processing`.
	//
	// Entity-lifecycle events are account-wide and target no function or collection.
	// Set `type` to one of the following and provide a `webhookURL` (these event types
	// support webhook delivery only):
	//
	//   - `entity_proposed` — an entity entered the `proposed` curation status (queued
	//     for review).
	//   - `entity_validated` — an entity was approved/validated by a reviewer.
	//   - `entity_rejected` — an entity was rejected by a reviewer.
	//
	// Each entity-lifecycle delivery is a JSON POST describing the transition
	// (`entityID`, `typeName`, `priorStatus`, `newStatus`, optional `actorUserID` and
	// `reason`, and a `timestamp`).
	//
	// Deliveries can be sent to any combination of:
	//
	// - `webhookURL` — HTTPS endpoint that receives a JSON POST per event.
	// - `s3Bucket` + `s3FilePath` — sync output JSON into an AWS S3 prefix you own.
	// - `googleDriveFolderID` — drop output JSON into a Google Drive folder.
	//
	// Use `disabled: true` to pause delivery without deleting the subscription.
	// Updates follow conventional PATCH semantics — only the fields you include are
	// changed.
	Subscriptions SubscriptionService
	// Views are tabular projections over the `transformations` your functions produce
	// — a saved query that turns raw extracted JSON into a filterable, paginatable,
	// aggregatable table.
	//
	// ## Anatomy
	//
	// A view declares:
	//
	//   - One or more **functions** to read from (by `functionID` or `functionName`).
	//   - A list of **columns**, each pinned to a `valueSchemaPath` (a JSON Pointer into
	//     the function's output schema).
	//   - Optional **filters** (string equality, numeric comparators, null-checks) and
	//     **aggregations** (`count`, `count_distinct`, `sum`, `average`, `min`, `max`).
	//
	// Views are versioned: every update produces a new version, and the previous
	// version remains immutable and addressable. Function types that produce
	// transformations with an output schema — `extract`, `transform`, `analyze`,
	// `join` — are all queryable through views; `extract` works uniformly across
	// vision and OCR inputs.
	//
	// ## Reading data
	//
	//   - **`POST /v3/views/table-data`** — paginated rows of column values. Each row
	//     reports the underlying event's `eventID` (the externally-stable KSUID used
	//     everywhere else in V3) plus the projected column values.
	//   - **`POST /v3/views/aggregation-data`** — group-by-able aggregate values across
	//     the same query surface.
	//
	// Both endpoints take a `timeWindow` to bound the transformation set and require
	// at least one `function` to read from.
	Views ViewService
	// Buckets are named partitions of the knowledge graph within an
	// account+environment. Entities, mentions, and relations are scoped to a bucket so
	// a single account+environment can host multiple isolated graphs — for example one
	// per data source or workspace.
	//
	// Every account+environment has exactly one **default** bucket, used by unscoped
	// flows. The default bucket can be renamed but never deleted.
	//
	// Use these endpoints to create, list, fetch, rename, and delete buckets:
	//
	//   - **`POST /v3/buckets`** creates a non-default bucket.
	//   - **`GET /v3/buckets`** lists buckets with cursor pagination (`startingAfter` /
	//     `endingBefore` over `bucketID`).
	//   - **`PATCH /v3/buckets/{bucketID}`** updates `name` and/or `description`.
	//   - **`DELETE /v3/buckets/{bucketID}`** soft-deletes a bucket. A non-empty bucket
	//     is rejected with `409 Conflict` unless `?cascade=true` is passed; the default
	//     bucket can never be deleted.
	Buckets  BucketService
	Entities EntityService
	// Entity Types are the customer-defined taxonomy for the knowledge graph, scoped
	// to an account+environment. Each type has a unique, immutable name and can be
	// organised into hierarchies via `parentTypeID`. A type may carry per-type
	// structured attribute metadata in `attributeSchema` (for example
	// `{"unit": "mg", "range": [0, 100]}`).
	//
	// Use these endpoints to create, list, fetch, update, and delete entity types:
	//
	//   - **`POST /v3/entity-types`** creates a type, optionally under a parent.
	//   - **`GET /v3/entity-types`** lists types with cursor pagination (`startingAfter`
	//     / `endingBefore` over `typeID`) and an optional `parentTypeId` filter for
	//     direct children.
	//   - **`PATCH /v3/entity-types/{typeID}`** updates `description`, `parentTypeID`,
	//     and/or `attributeSchema`. The `name` is immutable.
	//   - **`DELETE /v3/entity-types/{typeID}`** soft-deletes a type. The request is
	//     rejected with `409 Conflict` while any live entity is assigned to the type or
	//     any live child type points at it.
	EntityTypes EntityTypeService
	// Read the cross-document knowledge graph — the canonical entities and the
	// directed relations between them that the Parse pipeline populates when
	// `linkAcrossDocuments` is enabled.
	//
	//   - **`GET /v3/entities/{id}/relations`** returns the inbound and outbound edges
	//     incident to one entity, split by direction. Supports `direction`, an exact
	//     `relationType` filter, and cursor pagination over edges. A merged-away entity
	//     id transparently resolves to its surviving canonical entity.
	//   - **`GET /v3/knowledge-graph`** returns the graph as `{ nodes, edges }`,
	//     paginating over edges. The `nodes` for a page are the distinct endpoint
	//     entities of that page's edges (both endpoints of every edge are included).
	//     Filter with `type[]`, `since`, and `search`; an edge is returned only when
	//     both of its endpoints survive the entity filters.
	//
	// Both endpoints take an optional `bucket` (`bkt_...`) to scope the read to a
	// single bucket; omit it for the unscoped account+environment view.
	KnowledgeGraph KnowledgeGraphService
	// The reviewer-facing read surface for entity curation, available on the dashboard
	// (JWT) only.
	//
	//   - **`GET /v3/review-queue`** returns a cursor-paginated set of entities awaiting
	//     curation, scoped to your account+environment (and optional `bucket`). Each row
	//     is a full entity plus a small preview (up to 2) of its first mentions, so a
	//     reviewer can triage without opening every entity.
	//
	// Filters AND together. `status` (repeatable) defaults to the pre-terminal states
	// `extracted` + `proposed` when omitted. `type` (repeatable `ety_…` IDs) matches
	// the entity's _effective_ type — its assigned type id, or, for entities with no
	// assigned type, its bem-inferred type name. `assignedTo` (`me` or a `usr_…` ID)
	// restricts to entities whose effective type the user reviews. `since` (RFC3339)
	// filters by creation time. Pagination is cursor-based on `entityID` ascending;
	// default limit 50, maximum 200.
	ReviewQueue ReviewQueueService
	// Reviewer assignments link users to the entity types they are responsible for
	// reviewing, scoped to an account+environment. These are dashboard-only endpoints:
	// an assignment needs a user identity, which only the dashboard (JWT) surface
	// carries.
	//
	//   - **`POST /v3/entity-types/{typeID}/reviewers`** assigns a user as a reviewer of
	//     the type. The assignment is idempotent: re-assigning an existing reviewer
	//     returns the existing assignment. Requires the `admin` role.
	//   - **`GET /v3/entity-types/{typeID}/reviewers`** lists the users assigned to
	//     review the type, with each user's email and role. Requires the `operator`
	//     role.
	//   - **`DELETE /v3/entity-types/{typeID}/reviewers/{userID}`** removes an
	//     assignment. Requires the `admin` role.
	//   - **`GET /v3/users/{userID}/reviewer-assignments`** is the reverse lookup: the
	//     entity types a user reviews. A user may read their own assignments; reading
	//     another user's assignments requires the `admin` role.
	Users UserService
	// contains filtered or unexported fields
}

Client creates a struct with services and top level methods that help with interacting with the bem API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (BEM_API_KEY, BEM_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type Collection added in v0.14.0

type Collection struct {
	// Unique identifier for the collection
	CollectionID string `json:"collectionID" api:"required"`
	// The collection name/path. Only letters, digits, underscores, and dots are
	// allowed.
	CollectionName string `json:"collectionName" api:"required"`
	// When the collection was created
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Number of items in the collection
	ItemCount int64 `json:"itemCount" api:"required"`
	// List of items in the collection (when fetching collection details)
	Items []CollectionItem `json:"items"`
	// Number of items per page
	Limit int64 `json:"limit"`
	// Current page number
	Page int64 `json:"page"`
	// Total number of pages
	TotalPages int64 `json:"totalPages"`
	// When the collection was last updated
	UpdatedAt time.Time `json:"updatedAt" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CollectionID   respjson.Field
		CollectionName respjson.Field
		CreatedAt      respjson.Field
		ItemCount      respjson.Field
		Items          respjson.Field
		Limit          respjson.Field
		Page           respjson.Field
		TotalPages     respjson.Field
		UpdatedAt      respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Collection details

func (Collection) RawJSON added in v0.14.0

func (r Collection) RawJSON() string

Returns the unmodified JSON received from the API

func (*Collection) UnmarshalJSON added in v0.14.0

func (r *Collection) UnmarshalJSON(data []byte) error

type CollectionCountTokensParams added in v0.9.0

type CollectionCountTokensParams struct {
	// One or more texts to tokenize.
	Texts []string `json:"texts,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (CollectionCountTokensParams) MarshalJSON added in v0.9.0

func (r CollectionCountTokensParams) MarshalJSON() (data []byte, err error)

func (*CollectionCountTokensParams) UnmarshalJSON added in v0.9.0

func (r *CollectionCountTokensParams) UnmarshalJSON(data []byte) error

type CollectionCountTokensResponse added in v0.9.0

type CollectionCountTokensResponse struct {
	// Maximum tokens allowed per text by the embedding model.
	MaxTokenLimit int64 `json:"max_token_limit"`
	// Number of input texts that exceed `max_token_limit`.
	TextsExceedingLimit int64 `json:"texts_exceeding_limit"`
	// Per-text tokenization results in the same order as the request.
	TokenCounts []CollectionCountTokensResponseTokenCount `json:"token_counts"`
	// Sum of `token_count` across all texts.
	TotalTokens int64 `json:"total_tokens"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MaxTokenLimit       respjson.Field
		TextsExceedingLimit respjson.Field
		TokenCounts         respjson.Field
		TotalTokens         respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response for the token count endpoint.

func (CollectionCountTokensResponse) RawJSON added in v0.9.0

Returns the unmodified JSON received from the API

func (*CollectionCountTokensResponse) UnmarshalJSON added in v0.9.0

func (r *CollectionCountTokensResponse) UnmarshalJSON(data []byte) error

type CollectionCountTokensResponseTokenCount added in v0.9.0

type CollectionCountTokensResponseTokenCount struct {
	// Character count of the input text.
	CharCount int64 `json:"char_count"`
	// True if `token_count` exceeds the embedding model's per-text limit.
	ExceedsLimit bool `json:"exceeds_limit"`
	// Zero-based position of this entry in the request `texts` array.
	Index int64 `json:"index"`
	// Number of tokens produced by the tokenizer.
	TokenCount int64 `json:"token_count"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CharCount    respjson.Field
		ExceedsLimit respjson.Field
		Index        respjson.Field
		TokenCount   respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Per-text token count result.

func (CollectionCountTokensResponseTokenCount) RawJSON added in v0.9.0

Returns the unmodified JSON received from the API

func (*CollectionCountTokensResponseTokenCount) UnmarshalJSON added in v0.9.0

func (r *CollectionCountTokensResponseTokenCount) UnmarshalJSON(data []byte) error

type CollectionDeleteParams added in v0.9.0

type CollectionDeleteParams struct {
	// The name/path of the collection to delete. Must use only letters, digits,
	// underscores, and dots. Each segment must start with a letter or underscore.
	CollectionName string `query:"collectionName" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (CollectionDeleteParams) URLQuery added in v0.9.0

func (r CollectionDeleteParams) URLQuery() (v url.Values, err error)

URLQuery serializes CollectionDeleteParams's query parameters as `url.Values`.

type CollectionItem added in v0.14.0

type CollectionItem struct {
	// Unique identifier for the item
	CollectionItemID string `json:"collectionItemID" api:"required"`
	// When the item was created
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// The data stored in this item
	Data any `json:"data" api:"required"`
	// When the item was last updated
	UpdatedAt time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CollectionItemID respjson.Field
		CreatedAt        respjson.Field
		Data             respjson.Field
		UpdatedAt        respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A single item in a collection

func (CollectionItem) RawJSON added in v0.14.0

func (r CollectionItem) RawJSON() string

Returns the unmodified JSON received from the API

func (*CollectionItem) UnmarshalJSON added in v0.14.0

func (r *CollectionItem) UnmarshalJSON(data []byte) error

type CollectionItemAddParams added in v0.9.0

type CollectionItemAddParams struct {
	// The name/path of the collection. Must use only letters, digits, underscores, and
	// dots. Each segment must start with a letter or underscore.
	CollectionName string `json:"collectionName" api:"required"`
	// Array of items to add (maximum 100 items per request)
	Items []CollectionItemAddParamsItem `json:"items,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (CollectionItemAddParams) MarshalJSON added in v0.9.0

func (r CollectionItemAddParams) MarshalJSON() (data []byte, err error)

func (*CollectionItemAddParams) UnmarshalJSON added in v0.9.0

func (r *CollectionItemAddParams) UnmarshalJSON(data []byte) error

type CollectionItemAddParamsItem added in v0.9.0

type CollectionItemAddParamsItem struct {
	// The data to be embedded and stored (string or JSON object)
	Data any `json:"data,omitzero" api:"required"`
	// contains filtered or unexported fields
}

Data for creating a new item in a collection

The property Data is required.

func (CollectionItemAddParamsItem) MarshalJSON added in v0.9.0

func (r CollectionItemAddParamsItem) MarshalJSON() (data []byte, err error)

func (*CollectionItemAddParamsItem) UnmarshalJSON added in v0.9.0

func (r *CollectionItemAddParamsItem) UnmarshalJSON(data []byte) error

type CollectionItemAddResponse added in v0.9.0

type CollectionItemAddResponse struct {
	// Event ID for tracking this operation. Use this to correlate with webhook
	// notifications.
	EventID string `json:"eventID" api:"required"`
	// Status message
	Message string `json:"message" api:"required"`
	// Processing status
	//
	// Any of "pending".
	Status CollectionItemAddResponseStatus `json:"status" api:"required"`
	// Number of new items added (only present in synchronous mode, deprecated)
	AddedCount int64 `json:"addedCount"`
	// Array of items that were added (only present in synchronous mode, deprecated)
	Items []CollectionItem `json:"items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID     respjson.Field
		Message     respjson.Field
		Status      respjson.Field
		AddedCount  respjson.Field
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response after queuing items for async processing

func (CollectionItemAddResponse) RawJSON added in v0.9.0

func (r CollectionItemAddResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CollectionItemAddResponse) UnmarshalJSON added in v0.9.0

func (r *CollectionItemAddResponse) UnmarshalJSON(data []byte) error

type CollectionItemAddResponseStatus added in v0.9.0

type CollectionItemAddResponseStatus string

Processing status

const (
	CollectionItemAddResponseStatusPending CollectionItemAddResponseStatus = "pending"
)

type CollectionItemDeleteParams added in v0.9.0

type CollectionItemDeleteParams struct {
	// The unique identifier of the item to delete
	CollectionItemID string `query:"collectionItemID" api:"required" json:"-"`
	// The name/path of the collection. Must use only letters, digits, underscores, and
	// dots. Each segment must start with a letter or underscore.
	CollectionName string `query:"collectionName" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (CollectionItemDeleteParams) URLQuery added in v0.9.0

func (r CollectionItemDeleteParams) URLQuery() (v url.Values, err error)

URLQuery serializes CollectionItemDeleteParams's query parameters as `url.Values`.

type CollectionItemGetParams added in v0.9.0

type CollectionItemGetParams struct {
	// The name/path of the collection. Must use only letters, digits, underscores, and
	// dots. Each segment must start with a letter or underscore.
	CollectionName string `query:"collectionName" api:"required" json:"-"`
	// When true, includes items from all subcollections under the specified collection
	// path. For example, querying "customers" with this flag will return items from
	// "customers", "customers.premium", "customers.premium.vip", etc.
	IncludeSubcollections param.Opt[bool] `query:"includeSubcollections,omitzero" json:"-"`
	// Number of items per page
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page number for pagination
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CollectionItemGetParams) URLQuery added in v0.9.0

func (r CollectionItemGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes CollectionItemGetParams's query parameters as `url.Values`.

type CollectionItemService added in v0.9.0

type CollectionItemService struct {
	// contains filtered or unexported fields
}

Collections are named groups of embedded items used by Enrich functions for semantic search.

Each collection is referenced by a `collectionName`, which supports dot notation for hierarchical paths (e.g. `customers.premium.vip`). Names must contain only letters, digits, underscores, and dots, and each segment must start with a letter or underscore.

## Items

Items carry either a string or a JSON object in their `data` field. When items are added or updated, their `data` is embedded asynchronously — `POST /v3/collections/items` and `PUT /v3/collections/items` return immediately with a `pending` status and an `eventID` that can be correlated with webhook notifications once processing completes.

## Listing and hierarchy

Use `GET /v3/collections` with `parentCollectionName` to list collections under a path, or `collectionNameSearch` for a case-insensitive substring match. `GET /v3/collections/items` retrieves a specific collection's items; pass `includeSubcollections=true` to fold in items from all descendant collections.

## Token counting

Use `POST /v3/collections/token-count` to check whether texts fit within the embedding model's 8,192-token-per-text limit before submitting them for embedding.

CollectionItemService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCollectionItemService method instead.

func NewCollectionItemService added in v0.9.0

func NewCollectionItemService(opts ...option.RequestOption) (r CollectionItemService)

NewCollectionItemService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CollectionItemService) Add added in v0.9.0

Add new items to a Collection

func (*CollectionItemService) Delete added in v0.9.0

Delete an item from a Collection

func (*CollectionItemService) Get added in v0.9.0

Get a Collection

func (*CollectionItemService) Update added in v0.9.0

Update existing items in a Collection

type CollectionItemUpdateParams added in v0.9.0

type CollectionItemUpdateParams struct {
	// The name/path of the collection. Must use only letters, digits, underscores, and
	// dots. Each segment must start with a letter or underscore.
	CollectionName string `json:"collectionName" api:"required"`
	// Array of items to update (maximum 100 items per request)
	Items []CollectionItemUpdateParamsItem `json:"items,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (CollectionItemUpdateParams) MarshalJSON added in v0.9.0

func (r CollectionItemUpdateParams) MarshalJSON() (data []byte, err error)

func (*CollectionItemUpdateParams) UnmarshalJSON added in v0.9.0

func (r *CollectionItemUpdateParams) UnmarshalJSON(data []byte) error

type CollectionItemUpdateParamsItem added in v0.9.0

type CollectionItemUpdateParamsItem struct {
	// Unique identifier for the item to update
	CollectionItemID string `json:"collectionItemID" api:"required"`
	// The updated data to be embedded and stored (string or JSON object)
	Data any `json:"data,omitzero" api:"required"`
	// contains filtered or unexported fields
}

Data for updating an existing item in a collection

The properties CollectionItemID, Data are required.

func (CollectionItemUpdateParamsItem) MarshalJSON added in v0.9.0

func (r CollectionItemUpdateParamsItem) MarshalJSON() (data []byte, err error)

func (*CollectionItemUpdateParamsItem) UnmarshalJSON added in v0.9.0

func (r *CollectionItemUpdateParamsItem) UnmarshalJSON(data []byte) error

type CollectionItemUpdateResponse added in v0.9.0

type CollectionItemUpdateResponse struct {
	// Event ID for tracking this operation. Use this to correlate with webhook
	// notifications.
	EventID string `json:"eventID" api:"required"`
	// Status message
	Message string `json:"message" api:"required"`
	// Processing status
	//
	// Any of "pending".
	Status CollectionItemUpdateResponseStatus `json:"status" api:"required"`
	// Array of items that were updated (only present in synchronous mode, deprecated)
	Items []CollectionItem `json:"items"`
	// Number of items updated (only present in synchronous mode, deprecated)
	UpdatedCount int64 `json:"updatedCount"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID      respjson.Field
		Message      respjson.Field
		Status       respjson.Field
		Items        respjson.Field
		UpdatedCount respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response after queuing items for async update

func (CollectionItemUpdateResponse) RawJSON added in v0.9.0

Returns the unmodified JSON received from the API

func (*CollectionItemUpdateResponse) UnmarshalJSON added in v0.9.0

func (r *CollectionItemUpdateResponse) UnmarshalJSON(data []byte) error

type CollectionItemUpdateResponseStatus added in v0.9.0

type CollectionItemUpdateResponseStatus string

Processing status

const (
	CollectionItemUpdateResponseStatusPending CollectionItemUpdateResponseStatus = "pending"
)

type CollectionListParams added in v0.9.0

type CollectionListParams struct {
	// Optional substring search filter for collection names (case-insensitive). For
	// example, "premium" will match "customers.premium", "products.premium", etc.
	CollectionNameSearch param.Opt[string] `query:"collectionNameSearch,omitzero" json:"-"`
	// Number of collections per page
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page number for pagination
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Optional filter to list only collections under a specific parent collection
	// path. For example, "customers" will return "customers", "customers.premium",
	// "customers.premium.vip", etc.
	ParentCollectionName param.Opt[string] `query:"parentCollectionName,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CollectionListParams) URLQuery added in v0.9.0

func (r CollectionListParams) URLQuery() (v url.Values, err error)

URLQuery serializes CollectionListParams's query parameters as `url.Values`.

type CollectionListResponse added in v0.9.0

type CollectionListResponse struct {
	// List of collections
	Collections []CollectionListResponseCollection `json:"collections" api:"required"`
	// Number of collections per page
	Limit int64 `json:"limit" api:"required"`
	// Current page number
	Page int64 `json:"page" api:"required"`
	// Total number of collections
	TotalCount int64 `json:"totalCount" api:"required"`
	// Total number of pages
	TotalPages int64 `json:"totalPages" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Collections respjson.Field
		Limit       respjson.Field
		Page        respjson.Field
		TotalCount  respjson.Field
		TotalPages  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response for listing collections

func (CollectionListResponse) RawJSON added in v0.9.0

func (r CollectionListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CollectionListResponse) UnmarshalJSON added in v0.9.0

func (r *CollectionListResponse) UnmarshalJSON(data []byte) error

type CollectionListResponseCollection added in v0.9.0

type CollectionListResponseCollection struct {
	// Unique identifier for the collection
	CollectionID string `json:"collectionID" api:"required"`
	// The collection name/path. Only letters, digits, underscores, and dots are
	// allowed.
	CollectionName string `json:"collectionName" api:"required"`
	// When the collection was created
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Number of items in the collection
	ItemCount int64 `json:"itemCount" api:"required"`
	// When the collection was last updated
	UpdatedAt time.Time `json:"updatedAt" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CollectionID   respjson.Field
		CollectionName respjson.Field
		CreatedAt      respjson.Field
		ItemCount      respjson.Field
		UpdatedAt      respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Collection metadata without items

func (CollectionListResponseCollection) RawJSON added in v0.9.0

Returns the unmodified JSON received from the API

func (*CollectionListResponseCollection) UnmarshalJSON added in v0.9.0

func (r *CollectionListResponseCollection) UnmarshalJSON(data []byte) error

type CollectionNewParams added in v0.9.0

type CollectionNewParams struct {
	// Unique name/path for the collection. Supports dot notation for hierarchical
	// paths.
	//
	//   - Only letters (a-z, A-Z), digits (0-9), underscores (\_), and dots (.) are
	//     allowed
	//   - Each segment (between dots) must start with a letter or underscore (not a
	//     digit)
	//   - Segments cannot consist only of digits
	//   - Each segment must be 1-256 characters
	//   - No leading, trailing, or consecutive dots
	//   - Invalid names are rejected with a 400 Bad Request error
	//
	// **Valid Examples:**
	//
	// - 'product_catalog'
	// - 'orders.line_items.sku'
	// - 'customer_data'
	// - 'price_v2'
	//
	// **Invalid Examples:**
	//
	// - 'product-catalog' (contains hyphen)
	// - '123items' (starts with digit)
	// - 'items..data' (consecutive dots)
	// - 'order#123' (contains invalid character #)
	CollectionName string `json:"collectionName" api:"required"`
	// contains filtered or unexported fields
}

func (CollectionNewParams) MarshalJSON added in v0.9.0

func (r CollectionNewParams) MarshalJSON() (data []byte, err error)

func (*CollectionNewParams) UnmarshalJSON added in v0.9.0

func (r *CollectionNewParams) UnmarshalJSON(data []byte) error

type CollectionProcessingWebhookEvent added in v0.14.0

type CollectionProcessingWebhookEvent struct {
	// Unique identifier of the collection.
	CollectionID string `json:"collectionID" api:"required"`
	// Name/path of the collection.
	CollectionName string `json:"collectionName" api:"required"`
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// The operation performed (add or update).
	//
	// Any of "add", "update".
	Operation CollectionProcessingWebhookEventOperation `json:"operation" api:"required"`
	// Number of items successfully processed.
	ProcessedCount int64 `json:"processedCount" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Processing status (success or failed).
	//
	// Any of "success", "failed".
	Status CollectionProcessingWebhookEventStatus `json:"status" api:"required"`
	// Array of collection item KSUIDs that were added or updated.
	CollectionItemIDs []string `json:"collectionItemIDs"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Error message if processing failed.
	ErrorMessage string `json:"errorMessage"`
	// Any of "collection_processing".
	EventType CollectionProcessingWebhookEventEventType `json:"eventType"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent                        `json:"inboundEmail"`
	Metadata     CollectionProcessingWebhookEventMetadata `json:"metadata"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CollectionID          respjson.Field
		CollectionName        respjson.Field
		EventID               respjson.Field
		Operation             respjson.Field
		ProcessedCount        respjson.Field
		ReferenceID           respjson.Field
		Status                respjson.Field
		CollectionItemIDs     respjson.Field
		CreatedAt             respjson.Field
		ErrorMessage          respjson.Field
		EventType             respjson.Field
		FunctionCallTryNumber respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CollectionProcessingWebhookEvent) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*CollectionProcessingWebhookEvent) UnmarshalJSON added in v0.14.0

func (r *CollectionProcessingWebhookEvent) UnmarshalJSON(data []byte) error

type CollectionProcessingWebhookEventEventType added in v0.14.0

type CollectionProcessingWebhookEventEventType string
const (
	CollectionProcessingWebhookEventEventTypeCollectionProcessing CollectionProcessingWebhookEventEventType = "collection_processing"
)

type CollectionProcessingWebhookEventMetadata added in v0.14.0

type CollectionProcessingWebhookEventMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CollectionProcessingWebhookEventMetadata) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*CollectionProcessingWebhookEventMetadata) UnmarshalJSON added in v0.14.0

func (r *CollectionProcessingWebhookEventMetadata) UnmarshalJSON(data []byte) error

type CollectionProcessingWebhookEventOperation added in v0.14.0

type CollectionProcessingWebhookEventOperation string

The operation performed (add or update).

const (
	CollectionProcessingWebhookEventOperationAdd    CollectionProcessingWebhookEventOperation = "add"
	CollectionProcessingWebhookEventOperationUpdate CollectionProcessingWebhookEventOperation = "update"
)

type CollectionProcessingWebhookEventStatus added in v0.14.0

type CollectionProcessingWebhookEventStatus string

Processing status (success or failed).

const (
	CollectionProcessingWebhookEventStatusSuccess CollectionProcessingWebhookEventStatus = "success"
	CollectionProcessingWebhookEventStatusFailed  CollectionProcessingWebhookEventStatus = "failed"
)

type CollectionService added in v0.9.0

type CollectionService struct {

	// Collections are named groups of embedded items used by Enrich functions for
	// semantic search.
	//
	// Each collection is referenced by a `collectionName`, which supports dot notation
	// for hierarchical paths (e.g. `customers.premium.vip`). Names must contain only
	// letters, digits, underscores, and dots, and each segment must start with a
	// letter or underscore.
	//
	// ## Items
	//
	// Items carry either a string or a JSON object in their `data` field. When items
	// are added or updated, their `data` is embedded asynchronously —
	// `POST /v3/collections/items` and `PUT /v3/collections/items` return immediately
	// with a `pending` status and an `eventID` that can be correlated with webhook
	// notifications once processing completes.
	//
	// ## Listing and hierarchy
	//
	// Use `GET /v3/collections` with `parentCollectionName` to list collections under
	// a path, or `collectionNameSearch` for a case-insensitive substring match.
	// `GET /v3/collections/items` retrieves a specific collection's items; pass
	// `includeSubcollections=true` to fold in items from all descendant collections.
	//
	// ## Token counting
	//
	// Use `POST /v3/collections/token-count` to check whether texts fit within the
	// embedding model's 8,192-token-per-text limit before submitting them for
	// embedding.
	Items CollectionItemService
	// contains filtered or unexported fields
}

Collections are named groups of embedded items used by Enrich functions for semantic search.

Each collection is referenced by a `collectionName`, which supports dot notation for hierarchical paths (e.g. `customers.premium.vip`). Names must contain only letters, digits, underscores, and dots, and each segment must start with a letter or underscore.

## Items

Items carry either a string or a JSON object in their `data` field. When items are added or updated, their `data` is embedded asynchronously — `POST /v3/collections/items` and `PUT /v3/collections/items` return immediately with a `pending` status and an `eventID` that can be correlated with webhook notifications once processing completes.

## Listing and hierarchy

Use `GET /v3/collections` with `parentCollectionName` to list collections under a path, or `collectionNameSearch` for a case-insensitive substring match. `GET /v3/collections/items` retrieves a specific collection's items; pass `includeSubcollections=true` to fold in items from all descendant collections.

## Token counting

Use `POST /v3/collections/token-count` to check whether texts fit within the embedding model's 8,192-token-per-text limit before submitting them for embedding.

CollectionService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCollectionService method instead.

func NewCollectionService added in v0.9.0

func NewCollectionService(opts ...option.RequestOption) (r CollectionService)

NewCollectionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CollectionService) CountTokens added in v0.9.0

Count the number of tokens in the provided texts using the BGE M3 tokenizer. This is useful for checking if texts will fit within the embedding model's token limit (8,192 tokens per text) before sending them for embedding.

func (*CollectionService) Delete added in v0.9.0

Delete a Collection

func (*CollectionService) List added in v0.9.0

List Collections

func (*CollectionService) New added in v0.9.0

Create a Collection

type Connector added in v0.14.0

type Connector struct {
	// Box client ID (from your Box application).
	BoxClientID string `json:"boxClientID" api:"required"`
	// Box client secret (from your Box application).
	//
	// Note: This value is sensitive and should be stored securely.
	BoxClientSecret string `json:"boxClientSecret" api:"required"`
	// Box enterprise ID.
	BoxEnterpriseID string `json:"boxEnterpriseID" api:"required"`
	// Box folder ID to watch for new uploads.
	BoxFolderID string `json:"boxFolderID" api:"required"`
	// Unique identifier for the connector.
	ConnectorID string `json:"connectorID" api:"required"`
	// Human-friendly name for this connector.
	Name string `json:"name" api:"required"`
	// Configuration specific to the type of integration.
	ParagonConfiguration any `json:"paragonConfiguration" api:"required"`
	// Paragon integration, eg. "googledrive".
	ParagonIntegration string `json:"paragonIntegration" api:"required"`
	// Paragon sync ID.
	ParagonSyncID string `json:"paragonSyncID" api:"required"`
	// Connector type.
	//
	// Any of "box", "paragon".
	Type ConnectorType `json:"type" api:"required"`
	// Workflow API ID that will be triggered by this connector.
	WorkflowID string `json:"workflowID" api:"required"`
	// Workflow name that will be triggered by this connector.
	WorkflowName string `json:"workflowName" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BoxClientID          respjson.Field
		BoxClientSecret      respjson.Field
		BoxEnterpriseID      respjson.Field
		BoxFolderID          respjson.Field
		ConnectorID          respjson.Field
		Name                 respjson.Field
		ParagonConfiguration respjson.Field
		ParagonIntegration   respjson.Field
		ParagonSyncID        respjson.Field
		Type                 respjson.Field
		WorkflowID           respjson.Field
		WorkflowName         respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A Connector represents an integration that triggers a Bem workflow from an external system.

func (Connector) RawJSON added in v0.14.0

func (r Connector) RawJSON() string

Returns the unmodified JSON received from the API

func (*Connector) UnmarshalJSON added in v0.14.0

func (r *Connector) UnmarshalJSON(data []byte) error

type ConnectorListParams added in v0.14.0

type ConnectorListParams struct {
	// Filter connectors by workflow API ID (e.g. `wf_...`).
	//
	// If both `workflowID` and `workflowName` are provided, results must match both.
	WorkflowID param.Opt[string] `query:"workflowID,omitzero" json:"-"`
	// Filter connectors by workflow name (exact match).
	//
	// If both `workflowID` and `workflowName` are provided, results must match both.
	WorkflowName param.Opt[string] `query:"workflowName,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ConnectorListParams) URLQuery added in v0.14.0

func (r ConnectorListParams) URLQuery() (v url.Values, err error)

URLQuery serializes ConnectorListParams's query parameters as `url.Values`.

type ConnectorListResponse added in v0.14.0

type ConnectorListResponse struct {
	Connectors []Connector `json:"connectors" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Connectors  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response body for listing connectors.

func (ConnectorListResponse) RawJSON added in v0.14.0

func (r ConnectorListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConnectorListResponse) UnmarshalJSON added in v0.14.0

func (r *ConnectorListResponse) UnmarshalJSON(data []byte) error

type ConnectorNewParams added in v0.14.0

type ConnectorNewParams struct {
	// Human-friendly name for this connector.
	Name string `json:"name" api:"required"`
	// Connector type.
	//
	// Any of "box", "paragon".
	Type ConnectorType `json:"type,omitzero" api:"required"`
	// Box client ID (from your Box application).
	BoxClientID param.Opt[string] `json:"boxClientID,omitzero"`
	// Box client secret (from your Box application).
	BoxClientSecret param.Opt[string] `json:"boxClientSecret,omitzero"`
	// Box enterprise ID.
	BoxEnterpriseID param.Opt[string] `json:"boxEnterpriseID,omitzero"`
	// Box folder ID to watch for new uploads.
	BoxFolderID param.Opt[string] `json:"boxFolderID,omitzero"`
	// Paragon integration, eg. "googledrive".
	ParagonIntegration param.Opt[string] `json:"paragonIntegration,omitzero"`
	// One of `workflowID` or `workflowName` must be provided.
	//
	// If both are provided, they must refer to the same workflow.
	WorkflowID param.Opt[string] `json:"workflowID,omitzero"`
	// One of `workflowID` or `workflowName` must be provided.
	//
	// If both are provided, they must refer to the same workflow.
	WorkflowName param.Opt[string] `json:"workflowName,omitzero"`
	// Configuration specific to the type of integration.
	ParagonConfiguration any `json:"paragonConfiguration,omitzero"`
	// contains filtered or unexported fields
}

func (ConnectorNewParams) MarshalJSON added in v0.14.0

func (r ConnectorNewParams) MarshalJSON() (data []byte, err error)

func (*ConnectorNewParams) UnmarshalJSON added in v0.14.0

func (r *ConnectorNewParams) UnmarshalJSON(data []byte) error

type ConnectorService added in v0.14.0

type ConnectorService struct {
	// contains filtered or unexported fields
}

Connectors are integrations that trigger a Bem workflow from an external system.

A connector binds an inbound source — currently Box or a Paragon-managed integration such as Google Drive — to a specific workflow (by `workflowName` or `workflowID`). When the source observes a new file, Bem invokes the bound workflow against that file.

Use these endpoints to create, list, and remove connectors. The fields used at create time depend on the connector `type`: Box connectors require Box credentials and a folder to watch, while Paragon connectors carry a `paragonIntegration` identifier and an integration-specific `paragonConfiguration` object (for example, `{ "folderId": "..." }` for Google Drive).

ConnectorService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewConnectorService method instead.

func NewConnectorService added in v0.14.0

func NewConnectorService(opts ...option.RequestOption) (r ConnectorService)

NewConnectorService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ConnectorService) Delete added in v0.14.0

func (r *ConnectorService) Delete(ctx context.Context, connectorID string, opts ...option.RequestOption) (res *string, err error)

Delete a Connector

func (*ConnectorService) List added in v0.14.0

List Connectors

func (*ConnectorService) New added in v0.14.0

func (r *ConnectorService) New(ctx context.Context, body ConnectorNewParams, opts ...option.RequestOption) (res *Connector, err error)

Create a Connector

type ConnectorType added in v0.14.0

type ConnectorType string

Connector type.

const (
	ConnectorTypeBox     ConnectorType = "box"
	ConnectorTypeParagon ConnectorType = "paragon"
)

type CreateFunctionClassifyParam added in v0.7.0

type CreateFunctionClassifyParam struct {
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Description of classifier. Can be used to provide additional context on
	// classifier's purpose and expected inputs.
	Description param.Opt[string] `json:"description,omitzero"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// List of classifications a classify function can produce. Shares the underlying
	// route list shape.
	Classifications []ClassificationListItemParam `json:"classifications,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "classify".
	Type constant.Classify `json:"type" default:"classify"`
	// contains filtered or unexported fields
}

V3 wire form of the classify function create payload.

The properties FunctionName, Type are required.

func (CreateFunctionClassifyParam) MarshalJSON added in v0.7.0

func (r CreateFunctionClassifyParam) MarshalJSON() (data []byte, err error)

func (*CreateFunctionClassifyParam) UnmarshalJSON added in v0.7.0

func (r *CreateFunctionClassifyParam) UnmarshalJSON(data []byte) error

type CreateFunctionEnrichParam

type CreateFunctionEnrichParam struct {
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// Configuration for an enrich function.
	//
	// **How Enrich Functions Work:**
	//
	// Enrich functions augment JSON input with data from external sources. They take
	// JSON input (typically from a previous function), extract specified fields, fetch
	// or search for matching data, and inject the results back into the JSON.
	//
	// **Data Sources:**
	//
	//   - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
	//     collection. Best for semantic matching against pre-indexed documents.
	//   - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
	//     Best for looking up live data from CRMs, ERPs, or other external systems.
	//     Optionally uses LLM agent reasoning to rank candidates returned by the
	//     endpoint.
	//
	// **Input Requirements:**
	//
	// - Must receive JSON input (typically from a previous function's output)
	//
	// **Example Use Cases:**
	//
	//   - Match product descriptions to SKU codes from a product catalog collection
	//   - Enrich customer data with account details from a CRM endpoint
	//   - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
	//     products
	//
	// **Configuration:**
	//
	// - Define named endpoints (for endpoint-source steps)
	// - Define one or more enrichment steps; steps are executed sequentially
	Config EnrichConfigParam `json:"config,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "enrich".
	Type constant.Enrich `json:"type" default:"enrich"`
	// contains filtered or unexported fields
}

The properties FunctionName, Type are required.

func (CreateFunctionEnrichParam) MarshalJSON

func (r CreateFunctionEnrichParam) MarshalJSON() (data []byte, err error)

func (*CreateFunctionEnrichParam) UnmarshalJSON

func (r *CreateFunctionEnrichParam) UnmarshalJSON(data []byte) error

type CreateFunctionExtractParam added in v0.2.0

type CreateFunctionExtractParam struct {
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// Whether bounding box extraction is enabled. Applies to vision input types (pdf,
	// png, jpeg, heic, heif, webp) that dispatch through the analyze path. When true,
	// the function returns the document regions (page, coordinates) from which each
	// field was extracted. Enabling this automatically configures the function to use
	// the bounding box model. Disabling resets to the default.
	EnableBoundingBoxes param.Opt[bool] `json:"enableBoundingBoxes,omitzero"`
	// Name of output schema object.
	OutputSchemaName param.Opt[string] `json:"outputSchemaName,omitzero"`
	// Reducing the risk of the model stopping early on long documents. Trade-off:
	// Increases total latency. Compatible with `enableBoundingBoxes`.
	PreCount param.Opt[bool] `json:"preCount,omitzero"`
	// Whether tabular chunking is enabled. When true, tables in CSV/Excel files are
	// processed in row batches rather than all at once.
	TabularChunkingEnabled param.Opt[bool] `json:"tabularChunkingEnabled,omitzero"`
	// Desired output structure defined in standard JSON Schema convention.
	OutputSchema any `json:"outputSchema,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "extract".
	Type constant.Extract `json:"type" default:"extract"`
	// contains filtered or unexported fields
}

The properties FunctionName, Type are required.

func (CreateFunctionExtractParam) MarshalJSON added in v0.2.0

func (r CreateFunctionExtractParam) MarshalJSON() (data []byte, err error)

func (*CreateFunctionExtractParam) UnmarshalJSON added in v0.2.0

func (r *CreateFunctionExtractParam) UnmarshalJSON(data []byte) error

type CreateFunctionJoinParam

type CreateFunctionJoinParam struct {
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Description of join function.
	Description param.Opt[string] `json:"description,omitzero"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// Name of output schema object.
	OutputSchemaName param.Opt[string] `json:"outputSchemaName,omitzero"`
	// The type of join to perform.
	//
	// Any of "standard".
	JoinType string `json:"joinType,omitzero"`
	// Desired output structure defined in standard JSON Schema convention.
	OutputSchema any `json:"outputSchema,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "join".
	Type constant.Join `json:"type" default:"join"`
	// contains filtered or unexported fields
}

The properties FunctionName, Type are required.

func (CreateFunctionJoinParam) MarshalJSON

func (r CreateFunctionJoinParam) MarshalJSON() (data []byte, err error)

func (*CreateFunctionJoinParam) UnmarshalJSON

func (r *CreateFunctionJoinParam) UnmarshalJSON(data []byte) error

type CreateFunctionParseExtraConfigParam added in v0.19.0

type CreateFunctionParseExtraConfigParam struct {
	// When true, return per-section and per-entity-mention coordinates in the parse
	// event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
	// array of `{page, left, top, width, height}` with coordinates normalized to [0,
	// 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
	// output. Only applies to the open-ended discovery path (no `schema`) and to
	// vision input types. Bedrock-backed parse functions silently return an empty map
	// (no native bbox support). Defaults to false.
	EnableBoundingBoxes param.Opt[bool] `json:"enableBoundingBoxes,omitzero"`
	// contains filtered or unexported fields
}

Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on Extract / Join — separated from `parseConfig` so the per-call Parse output shape stays distinct from operator-level execution flags.

func (CreateFunctionParseExtraConfigParam) MarshalJSON added in v0.19.0

func (r CreateFunctionParseExtraConfigParam) MarshalJSON() (data []byte, err error)

func (*CreateFunctionParseExtraConfigParam) UnmarshalJSON added in v0.19.0

func (r *CreateFunctionParseExtraConfigParam) UnmarshalJSON(data []byte) error

type CreateFunctionParseParam added in v0.10.0

type CreateFunctionParseParam struct {
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
	// Extract / Join — separated from `parseConfig` so the per-call Parse output shape
	// stays distinct from operator-level execution flags.
	ExtraConfig CreateFunctionParseExtraConfigParam `json:"extraConfig,omitzero"`
	// Per-version configuration for a Parse function.
	//
	// Parse renders document pages (PDF, image) via vision LLM and emits structured
	// JSON. The two toggles below independently control entity extraction (a per-call
	// output concern) and cross-document memory linking (an environment-wide concern).
	ParseConfig ParseConfigParam `json:"parseConfig,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "parse".
	Type constant.Parse `json:"type" default:"parse"`
	// contains filtered or unexported fields
}

The properties FunctionName, Type are required.

func (CreateFunctionParseParam) MarshalJSON added in v0.10.0

func (r CreateFunctionParseParam) MarshalJSON() (data []byte, err error)

func (*CreateFunctionParseParam) UnmarshalJSON added in v0.10.0

func (r *CreateFunctionParseParam) UnmarshalJSON(data []byte) error

type CreateFunctionPayloadShapingParam

type CreateFunctionPayloadShapingParam struct {
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// JMESPath expression that defines how to transform and customize the input
	// payload structure. Payload shaping allows you to extract, reshape, and
	// reorganize data from complex input payloads into a simplified, standardized
	// output format. Use JMESPath syntax to select specific fields, perform
	// calculations, and create new data structures tailored to your needs.
	ShapingSchema param.Opt[string] `json:"shapingSchema,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "payload_shaping".
	Type constant.PayloadShaping `json:"type" default:"payload_shaping"`
	// contains filtered or unexported fields
}

The properties FunctionName, Type are required.

func (CreateFunctionPayloadShapingParam) MarshalJSON

func (r CreateFunctionPayloadShapingParam) MarshalJSON() (data []byte, err error)

func (*CreateFunctionPayloadShapingParam) UnmarshalJSON

func (r *CreateFunctionPayloadShapingParam) UnmarshalJSON(data []byte) error

type CreateFunctionSendParam

type CreateFunctionSendParam struct {
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// Google Drive folder ID. Required when destinationType is google_drive. Managed
	// via Paragon OAuth.
	GoogleDriveFolderID param.Opt[string] `json:"googleDriveFolderId,omitzero"`
	// S3 bucket to upload the payload to. Required when destinationType is s3.
	S3Bucket param.Opt[string] `json:"s3Bucket,omitzero"`
	// Optional S3 key prefix (folder path).
	S3Prefix param.Opt[string] `json:"s3Prefix,omitzero"`
	// Whether to sign webhook deliveries with an HMAC-SHA256 `bem-signature` header.
	// Defaults to `true` when omitted — signing is on by default for new send
	// functions. Set explicitly to `false` to disable.
	WebhookSigningEnabled param.Opt[bool] `json:"webhookSigningEnabled,omitzero"`
	// Webhook URL to POST the payload to. Required when destinationType is webhook.
	WebhookURL param.Opt[string] `json:"webhookUrl,omitzero"`
	// Destination type for a Send function.
	//
	// Any of "webhook", "s3", "google_drive".
	DestinationType SendDestinationType `json:"destinationType,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "send".
	Type constant.Send `json:"type" default:"send"`
	// contains filtered or unexported fields
}

The properties FunctionName, Type are required.

func (CreateFunctionSendParam) MarshalJSON

func (r CreateFunctionSendParam) MarshalJSON() (data []byte, err error)

func (*CreateFunctionSendParam) UnmarshalJSON

func (r *CreateFunctionSendParam) UnmarshalJSON(data []byte) error

type CreateFunctionSplitParam

type CreateFunctionSplitParam struct {
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName             param.Opt[string]                               `json:"displayName,omitzero"`
	PrintPageSplitConfig    CreateFunctionSplitPrintPageSplitConfigParam    `json:"printPageSplitConfig,omitzero"`
	SemanticPageSplitConfig CreateFunctionSplitSemanticPageSplitConfigParam `json:"semanticPageSplitConfig,omitzero"`
	// Any of "print_page", "semantic_page".
	SplitType string `json:"splitType,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "split".
	Type constant.Split `json:"type" default:"split"`
	// contains filtered or unexported fields
}

The properties FunctionName, Type are required.

func (CreateFunctionSplitParam) MarshalJSON

func (r CreateFunctionSplitParam) MarshalJSON() (data []byte, err error)

func (*CreateFunctionSplitParam) UnmarshalJSON

func (r *CreateFunctionSplitParam) UnmarshalJSON(data []byte) error

type CreateFunctionSplitPrintPageSplitConfigParam

type CreateFunctionSplitPrintPageSplitConfigParam struct {
	NextFunctionID   param.Opt[string] `json:"nextFunctionID,omitzero"`
	NextFunctionName param.Opt[string] `json:"nextFunctionName,omitzero"`
	// contains filtered or unexported fields
}

func (CreateFunctionSplitPrintPageSplitConfigParam) MarshalJSON

func (r CreateFunctionSplitPrintPageSplitConfigParam) MarshalJSON() (data []byte, err error)

func (*CreateFunctionSplitPrintPageSplitConfigParam) UnmarshalJSON

func (r *CreateFunctionSplitPrintPageSplitConfigParam) UnmarshalJSON(data []byte) error

type CreateFunctionSplitSemanticPageSplitConfigParam

type CreateFunctionSplitSemanticPageSplitConfigParam struct {
	ItemClasses []SplitFunctionSemanticPageItemClassParam `json:"itemClasses,omitzero"`
	// contains filtered or unexported fields
}

func (CreateFunctionSplitSemanticPageSplitConfigParam) MarshalJSON

func (r CreateFunctionSplitSemanticPageSplitConfigParam) MarshalJSON() (data []byte, err error)

func (*CreateFunctionSplitSemanticPageSplitConfigParam) UnmarshalJSON

type CreateFunctionUnionParam

type CreateFunctionUnionParam struct {
	OfExtract        *CreateFunctionExtractParam        `json:",omitzero,inline"`
	OfClassify       *CreateFunctionClassifyParam       `json:",omitzero,inline"`
	OfSend           *CreateFunctionSendParam           `json:",omitzero,inline"`
	OfSplit          *CreateFunctionSplitParam          `json:",omitzero,inline"`
	OfJoin           *CreateFunctionJoinParam           `json:",omitzero,inline"`
	OfPayloadShaping *CreateFunctionPayloadShapingParam `json:",omitzero,inline"`
	OfEnrich         *CreateFunctionEnrichParam         `json:",omitzero,inline"`
	OfParse          *CreateFunctionParseParam          `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func CreateFunctionParamOfClassify added in v0.7.0

func CreateFunctionParamOfClassify(functionName string) CreateFunctionUnionParam

func CreateFunctionParamOfEnrich

func CreateFunctionParamOfEnrich(functionName string) CreateFunctionUnionParam

func CreateFunctionParamOfExtract added in v0.2.0

func CreateFunctionParamOfExtract(functionName string) CreateFunctionUnionParam

func CreateFunctionParamOfJoin

func CreateFunctionParamOfJoin(functionName string) CreateFunctionUnionParam

func CreateFunctionParamOfParse added in v0.10.0

func CreateFunctionParamOfParse(functionName string) CreateFunctionUnionParam

func CreateFunctionParamOfPayloadShaping

func CreateFunctionParamOfPayloadShaping(functionName string) CreateFunctionUnionParam

func CreateFunctionParamOfSend

func CreateFunctionParamOfSend(functionName string) CreateFunctionUnionParam

func CreateFunctionParamOfSplit

func CreateFunctionParamOfSplit(functionName string) CreateFunctionUnionParam

func (CreateFunctionUnionParam) MarshalJSON

func (u CreateFunctionUnionParam) MarshalJSON() ([]byte, error)

func (*CreateFunctionUnionParam) UnmarshalJSON

func (u *CreateFunctionUnionParam) UnmarshalJSON(data []byte) error

type EnrichConfig

type EnrichConfig struct {
	// Array of enrichment steps to execute sequentially.
	Steps []EnrichStep `json:"steps" api:"required"`
	// Named HTTP endpoints available to endpoint-source steps. Each endpoint must have
	// a unique `name` referenced by the step's `endpointName`. Required when any step
	// uses `source: "endpoint"`.
	Endpoints []EnrichConfigEndpoint `json:"endpoints"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Steps       respjson.Field
		Endpoints   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for an enrich function.

**How Enrich Functions Work:**

Enrich functions augment JSON input with data from external sources. They take JSON input (typically from a previous function), extract specified fields, fetch or search for matching data, and inject the results back into the JSON.

**Data Sources:**

  • **Collections** (`source: "collection"`): Vector/keyword search against a BEM collection. Best for semantic matching against pre-indexed documents.
  • **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API. Best for looking up live data from CRMs, ERPs, or other external systems. Optionally uses LLM agent reasoning to rank candidates returned by the endpoint.

**Input Requirements:**

- Must receive JSON input (typically from a previous function's output)

**Example Use Cases:**

  • Match product descriptions to SKU codes from a product catalog collection
  • Enrich customer data with account details from a CRM endpoint
  • Use LLM agent reasoning to fuzzy-match line item descriptions to catalog products

**Configuration:**

- Define named endpoints (for endpoint-source steps) - Define one or more enrichment steps; steps are executed sequentially

func (EnrichConfig) RawJSON

func (r EnrichConfig) RawJSON() string

Returns the unmodified JSON received from the API

func (EnrichConfig) ToParam

func (r EnrichConfig) ToParam() EnrichConfigParam

ToParam converts this EnrichConfig to a EnrichConfigParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with EnrichConfigParam.Overrides()

func (*EnrichConfig) UnmarshalJSON

func (r *EnrichConfig) UnmarshalJSON(data []byte) error

type EnrichConfigEndpoint added in v0.20.0

type EnrichConfigEndpoint struct {
	// HTTP method to use.
	//
	// Any of "GET", "POST".
	Method string `json:"method" api:"required"`
	// Unique name for this endpoint, referenced by enrichStep.endpointName.
	Name string `json:"name" api:"required"`
	// Full URL of the endpoint (must be http:// or https://).
	URL string `json:"url" api:"required"`
	// JSON body template for POST requests. **Required for POST endpoints.** Must
	// contain the `{value}` placeholder, which is replaced with the extracted source
	// value at runtime.
	//
	// Example: `bodyTemplate: "{\"query\": \"{value}\", \"limit\": 10}"`
	BodyTemplate string `json:"bodyTemplate"`
	// Additional HTTP headers to include in every request (e.g.
	// `Authorization: Bearer <token>`).
	Headers any `json:"headers"`
	// Natural-language instructions for LLM agent reasoning.
	//
	// When set, the candidates fetched from the endpoint are passed to an LLM with
	// these instructions, which selects the best match(es) and returns them with
	// confidence scores. Each injected result has the shape
	// `{ data, confidence, reasoning? }`.
	//
	// When omitted, the raw fetched value is injected without any LLM involvement.
	MatchInstructions string `json:"matchInstructions"`
	// Maximum number of ranked matches to return per source value when
	// `matchInstructions` is set (default: 1). Ignored when `matchInstructions` is
	// empty.
	MatchTopK int64 `json:"matchTopK"`
	// LLM batch size during agent reasoning (default: 50). All candidates — across all
	// fetched pages — are scored in batches of this size. Smaller values reduce
	// per-call token usage; larger values mean fewer LLM calls. Ignored when
	// `matchInstructions` is empty.
	MaxCandidates int64 `json:"maxCandidates"`
	// Maximum number of pages to fetch (default: 10). Acts as a safety cap against
	// infinite pagination loops when the server never returns an empty cursor.
	MaxPages int64 `json:"maxPages"`
	// Query parameter name used to pass the cursor on subsequent GET requests, or the
	// `{placeholder}` name used in the POST `bodyTemplate` (e.g. `"cursor"`,
	// `"pageToken"`, `"offset"`).
	//
	// Must be set together with `nextPagePath`.
	NextPageParam string `json:"nextPageParam"`
	// JMESPath expression applied to each raw response to extract the cursor or token
	// for the next page (e.g. `"nextCursor"`, `"pagination.nextToken"`). An absent,
	// null, or empty-string result stops pagination. Both string and numeric values
	// are supported — numbers are converted to their decimal string representation
	// before being forwarded as a query parameter.
	//
	// Must be set together with `nextPageParam`.
	//
	// **Supported pagination styles:**
	//
	//   - **Cursor/token-based** — server returns an opaque token in the response body
	//     (e.g. `{"nextCursor": "abc123"}`). Set `nextPagePath: "nextCursor"` and the
	//     platform forwards it verbatim on the next request.
	//   - **Server-computed offset/page** — server echoes back the next offset or page
	//     number in the response body (e.g. `{"nextOffset": 50}` or `{"nextPage": 2}`).
	//     Set `nextPagePath: "nextOffset"` and the platform forwards the value as-is.
	//
	// **Not supported:**
	//
	//   - **Client-computed offset** — APIs where the client must compute
	//     `offset += limit` itself (e.g. `?offset=0&limit=50` with no next-offset in the
	//     response). Workaround: ask the API provider to return the next offset in the
	//     response body, or bake a fixed page size into the URL and use a server-side
	//     cursor instead.
	//   - **Client-computed page number** — APIs where the client increments `?page=N`
	//     itself with no next-page value in the response. Same workaround applies.
	//   - **Link header** — `Link: <url>; rel="next"` in HTTP response headers. The
	//     platform only inspects the response body.
	NextPagePath string `json:"nextPagePath"`
	// Query parameter name used to pass the extracted source value. **Required for GET
	// endpoints.** The value is URL-encoded and appended as
	// `?{queryParam}={sourceValue}`.
	//
	// Example: `queryParam: "q"` → `GET /products?q=blue+widget`
	QueryParam string `json:"queryParam"`
	// JMESPath expression applied to the response body to extract the enrichment
	// value. Omit to use the entire response body as the result.
	//
	// **For agent reasoning:** use a wildcard projection (e.g. `items[*]` or
	// `results[*].data`) so the endpoint's list of candidates is flattened into an
	// array before being passed to the LLM. A non-wildcard path (e.g. `data.product`)
	// extracts a single value treated as one candidate.
	//
	// **Response size:** the platform reads at most 50 MB of the response body before
	// decoding, regardless of the Content-Length header.
	ResponsePath string `json:"responsePath"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Method            respjson.Field
		Name              respjson.Field
		URL               respjson.Field
		BodyTemplate      respjson.Field
		Headers           respjson.Field
		MatchInstructions respjson.Field
		MatchTopK         respjson.Field
		MaxCandidates     respjson.Field
		MaxPages          respjson.Field
		NextPageParam     respjson.Field
		NextPagePath      respjson.Field
		QueryParam        respjson.Field
		ResponsePath      respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A named HTTP endpoint that an enrich step can call to fetch enrichment data.

The platform makes one request per extracted source value, substituting the value as a query parameter or body template placeholder. The raw response (or the sub-value selected by `responsePath`) is injected into the output, or passed to LLM agent reasoning when `matchInstructions` is set.

**Request formats:**

  • `GET`: Appends `?{queryParam}={value}` to the URL.
  • `POST`: Sends `bodyTemplate` as the request body, replacing `{value}` with the extracted value.

func (EnrichConfigEndpoint) RawJSON added in v0.20.0

func (r EnrichConfigEndpoint) RawJSON() string

Returns the unmodified JSON received from the API

func (*EnrichConfigEndpoint) UnmarshalJSON added in v0.20.0

func (r *EnrichConfigEndpoint) UnmarshalJSON(data []byte) error

type EnrichConfigEndpointParam added in v0.20.0

type EnrichConfigEndpointParam struct {
	// HTTP method to use.
	//
	// Any of "GET", "POST".
	Method string `json:"method,omitzero" api:"required"`
	// Unique name for this endpoint, referenced by enrichStep.endpointName.
	Name string `json:"name" api:"required"`
	// Full URL of the endpoint (must be http:// or https://).
	URL string `json:"url" api:"required"`
	// JSON body template for POST requests. **Required for POST endpoints.** Must
	// contain the `{value}` placeholder, which is replaced with the extracted source
	// value at runtime.
	//
	// Example: `bodyTemplate: "{\"query\": \"{value}\", \"limit\": 10}"`
	BodyTemplate param.Opt[string] `json:"bodyTemplate,omitzero"`
	// Natural-language instructions for LLM agent reasoning.
	//
	// When set, the candidates fetched from the endpoint are passed to an LLM with
	// these instructions, which selects the best match(es) and returns them with
	// confidence scores. Each injected result has the shape
	// `{ data, confidence, reasoning? }`.
	//
	// When omitted, the raw fetched value is injected without any LLM involvement.
	MatchInstructions param.Opt[string] `json:"matchInstructions,omitzero"`
	// Maximum number of ranked matches to return per source value when
	// `matchInstructions` is set (default: 1). Ignored when `matchInstructions` is
	// empty.
	MatchTopK param.Opt[int64] `json:"matchTopK,omitzero"`
	// LLM batch size during agent reasoning (default: 50). All candidates — across all
	// fetched pages — are scored in batches of this size. Smaller values reduce
	// per-call token usage; larger values mean fewer LLM calls. Ignored when
	// `matchInstructions` is empty.
	MaxCandidates param.Opt[int64] `json:"maxCandidates,omitzero"`
	// Maximum number of pages to fetch (default: 10). Acts as a safety cap against
	// infinite pagination loops when the server never returns an empty cursor.
	MaxPages param.Opt[int64] `json:"maxPages,omitzero"`
	// Query parameter name used to pass the cursor on subsequent GET requests, or the
	// `{placeholder}` name used in the POST `bodyTemplate` (e.g. `"cursor"`,
	// `"pageToken"`, `"offset"`).
	//
	// Must be set together with `nextPagePath`.
	NextPageParam param.Opt[string] `json:"nextPageParam,omitzero"`
	// JMESPath expression applied to each raw response to extract the cursor or token
	// for the next page (e.g. `"nextCursor"`, `"pagination.nextToken"`). An absent,
	// null, or empty-string result stops pagination. Both string and numeric values
	// are supported — numbers are converted to their decimal string representation
	// before being forwarded as a query parameter.
	//
	// Must be set together with `nextPageParam`.
	//
	// **Supported pagination styles:**
	//
	//   - **Cursor/token-based** — server returns an opaque token in the response body
	//     (e.g. `{"nextCursor": "abc123"}`). Set `nextPagePath: "nextCursor"` and the
	//     platform forwards it verbatim on the next request.
	//   - **Server-computed offset/page** — server echoes back the next offset or page
	//     number in the response body (e.g. `{"nextOffset": 50}` or `{"nextPage": 2}`).
	//     Set `nextPagePath: "nextOffset"` and the platform forwards the value as-is.
	//
	// **Not supported:**
	//
	//   - **Client-computed offset** — APIs where the client must compute
	//     `offset += limit` itself (e.g. `?offset=0&limit=50` with no next-offset in the
	//     response). Workaround: ask the API provider to return the next offset in the
	//     response body, or bake a fixed page size into the URL and use a server-side
	//     cursor instead.
	//   - **Client-computed page number** — APIs where the client increments `?page=N`
	//     itself with no next-page value in the response. Same workaround applies.
	//   - **Link header** — `Link: <url>; rel="next"` in HTTP response headers. The
	//     platform only inspects the response body.
	NextPagePath param.Opt[string] `json:"nextPagePath,omitzero"`
	// Query parameter name used to pass the extracted source value. **Required for GET
	// endpoints.** The value is URL-encoded and appended as
	// `?{queryParam}={sourceValue}`.
	//
	// Example: `queryParam: "q"` → `GET /products?q=blue+widget`
	QueryParam param.Opt[string] `json:"queryParam,omitzero"`
	// JMESPath expression applied to the response body to extract the enrichment
	// value. Omit to use the entire response body as the result.
	//
	// **For agent reasoning:** use a wildcard projection (e.g. `items[*]` or
	// `results[*].data`) so the endpoint's list of candidates is flattened into an
	// array before being passed to the LLM. A non-wildcard path (e.g. `data.product`)
	// extracts a single value treated as one candidate.
	//
	// **Response size:** the platform reads at most 50 MB of the response body before
	// decoding, regardless of the Content-Length header.
	ResponsePath param.Opt[string] `json:"responsePath,omitzero"`
	// Additional HTTP headers to include in every request (e.g.
	// `Authorization: Bearer <token>`).
	Headers any `json:"headers,omitzero"`
	// contains filtered or unexported fields
}

A named HTTP endpoint that an enrich step can call to fetch enrichment data.

The platform makes one request per extracted source value, substituting the value as a query parameter or body template placeholder. The raw response (or the sub-value selected by `responsePath`) is injected into the output, or passed to LLM agent reasoning when `matchInstructions` is set.

**Request formats:**

  • `GET`: Appends `?{queryParam}={value}` to the URL.
  • `POST`: Sends `bodyTemplate` as the request body, replacing `{value}` with the extracted value.

The properties Method, Name, URL are required.

func (EnrichConfigEndpointParam) MarshalJSON added in v0.20.0

func (r EnrichConfigEndpointParam) MarshalJSON() (data []byte, err error)

func (*EnrichConfigEndpointParam) UnmarshalJSON added in v0.20.0

func (r *EnrichConfigEndpointParam) UnmarshalJSON(data []byte) error

type EnrichConfigParam

type EnrichConfigParam struct {
	// Array of enrichment steps to execute sequentially.
	Steps []EnrichStepParam `json:"steps,omitzero" api:"required"`
	// Named HTTP endpoints available to endpoint-source steps. Each endpoint must have
	// a unique `name` referenced by the step's `endpointName`. Required when any step
	// uses `source: "endpoint"`.
	Endpoints []EnrichConfigEndpointParam `json:"endpoints,omitzero"`
	// contains filtered or unexported fields
}

Configuration for an enrich function.

**How Enrich Functions Work:**

Enrich functions augment JSON input with data from external sources. They take JSON input (typically from a previous function), extract specified fields, fetch or search for matching data, and inject the results back into the JSON.

**Data Sources:**

  • **Collections** (`source: "collection"`): Vector/keyword search against a BEM collection. Best for semantic matching against pre-indexed documents.
  • **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API. Best for looking up live data from CRMs, ERPs, or other external systems. Optionally uses LLM agent reasoning to rank candidates returned by the endpoint.

**Input Requirements:**

- Must receive JSON input (typically from a previous function's output)

**Example Use Cases:**

  • Match product descriptions to SKU codes from a product catalog collection
  • Enrich customer data with account details from a CRM endpoint
  • Use LLM agent reasoning to fuzzy-match line item descriptions to catalog products

**Configuration:**

- Define named endpoints (for endpoint-source steps) - Define one or more enrichment steps; steps are executed sequentially

The property Steps is required.

func (EnrichConfigParam) MarshalJSON

func (r EnrichConfigParam) MarshalJSON() (data []byte, err error)

func (*EnrichConfigParam) UnmarshalJSON

func (r *EnrichConfigParam) UnmarshalJSON(data []byte) error

type EnrichStep

type EnrichStep struct {
	// JMESPath expression to extract source data. Can extract a single value or an
	// array. Each extracted value is looked up independently.
	SourceField string `json:"sourceField" api:"required"`
	// Field path where enriched results should be placed. Use simple field names
	// (e.g., "enriched_products"). Results are always injected as an array (list),
	// regardless of topK value.
	TargetField string `json:"targetField" api:"required"`
	// Name of the collection to search against. Required when `source` is
	// `"collection"`. The collection must exist and contain items. Supports
	// hierarchical paths when used with `includeSubcollections`.
	CollectionName string `json:"collectionName"`
	// Name of an endpoint defined in `enrichConfig.endpoints`. Required when `source`
	// is `"endpoint"`.
	EndpointName string `json:"endpointName"`
	// Whether to include cosine distance scores in results. Cosine distance ranges
	// from 0.0 (perfect match) to 2.0 (completely dissimilar). Lower scores indicate
	// better semantic similarity.
	//
	// When enabled, each result includes a `cosine_distance` field (semantic mode) or
	// a `hybrid_score` field (hybrid mode).
	IncludeScore bool `json:"includeScore"`
	// When true, searches all collections under the hierarchical path. For example,
	// "customers" will match "customers", "customers.premium", etc.
	IncludeSubcollections bool `json:"includeSubcollections"`
	// Maximum cosine distance threshold for filtering results (default: 0.6). Results
	// with cosine distance above this threshold are excluded.
	//
	// **Only applies to `semantic` and `hybrid` search modes.** Exact search does not
	// use cosine distance and ignores this setting.
	//
	// Cosine distance ranges from 0.0 (identical) to 2.0 (opposite):
	//
	// - 0.0 - 0.3: Very similar (strict threshold, high-quality matches only)
	// - 0.3 - 0.6: Reasonably similar (moderate threshold)
	// - 0.6 - 1.0: Loosely related (lenient threshold)
	// - > 1.0: Rarely useful — allows nearly unrelated results
	//
	// For most semantic search use cases, good matches typically fall in the 0.2 - 0.5
	// range.
	ScoreThreshold float64 `json:"scoreThreshold"`
	// Search mode to use for enrichment (default: "semantic").
	//
	// **semantic**: Vector similarity search using dense embeddings. Best for finding
	// conceptually similar items.
	//
	// - Use for: Product descriptions, natural language content
	// - Example: "red sports car" matches "crimson convertible automobile"
	//
	// **exact**: Exact keyword matching using PostgreSQL text search. Best for exact
	// identifiers.
	//
	// - Use for: SKU numbers, routing numbers, account IDs, exact tags
	// - Example: "SKU-12345" only matches items containing that exact text
	//
	// **hybrid**: Combined search using 20% semantic + 80% sparse embeddings
	// (keyword-based).
	//
	// - Use for: Tags, categories, partial identifiers
	// - Example: Balances semantic meaning with exact keyword matching
	//
	// Any of "semantic", "exact", "hybrid".
	SearchMode EnrichStepSearchMode `json:"searchMode"`
	// Where to fetch enrichment data from (default: `"collection"`).
	//
	//   - `"collection"`: Vector/keyword search against a BEM collection. Requires
	//     `collectionName`.
	//   - `"endpoint"`: HTTP call to a named endpoint defined in
	//     `enrichConfig.endpoints`. Requires `endpointName`.
	//
	// Any of "collection", "endpoint".
	Source EnrichStepSource `json:"source"`
	// Number of top matching results to return per query (default: 1). Results are
	// always returned as an array (list) and automatically sorted by cosine distance
	// (best match = lowest distance first).
	//
	// - 1: Returns array with single best match: `[{...}]`
	// - > 1: Returns array with multiple matches: `[{...}, {...}, ...]`
	TopK int64 `json:"topK"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SourceField           respjson.Field
		TargetField           respjson.Field
		CollectionName        respjson.Field
		EndpointName          respjson.Field
		IncludeScore          respjson.Field
		IncludeSubcollections respjson.Field
		ScoreThreshold        respjson.Field
		SearchMode            respjson.Field
		Source                respjson.Field
		TopK                  respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Single enrichment step configuration.

**Process Flow (collection source):**

  1. Extract values from `sourceField` using JMESPath
  2. Perform search against the specified collection (semantic, exact, or hybrid based on `searchMode`)
  3. Return top K matches sorted by relevance (best match first)
  4. Inject results into `targetField`

**Process Flow (endpoint source):**

  1. Extract values from `sourceField` using JMESPath
  2. Call the named endpoint once per extracted value, following pagination if `nextPagePath`/`nextPageParam` are configured on the endpoint
  3. Optionally apply LLM agent reasoning to rank candidates (`matchInstructions`), batching across all fetched pages in groups of `maxCandidates`
  4. Inject results into `targetField`

**Collection Search Modes** (`source: "collection"` only):

  • `semantic` (default): Vector similarity search — best for natural language and conceptual matching
  • `exact`: Exact keyword matching — best for SKU numbers, IDs, routing numbers
  • `hybrid`: Combined semantic + keyword search — best for tags and categories

**Result Format (collection source):**

- Always an array sorted by relevance (best match first) - Each element: `{ data, cosineDistance? }` or `{ data, hybridScore? }`

**Result Format (endpoint source, no matchInstructions):**

- Always an array; the raw fetched value is the single element

**Result Format (endpoint source, with matchInstructions):**

- Array of LLM-ranked matches: `[{ data, confidence, reasoning? }, ...]` - Length capped by `enrichEndpoint.matchTopK` (default 1)

func (EnrichStep) RawJSON

func (r EnrichStep) RawJSON() string

Returns the unmodified JSON received from the API

func (EnrichStep) ToParam

func (r EnrichStep) ToParam() EnrichStepParam

ToParam converts this EnrichStep to a EnrichStepParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with EnrichStepParam.Overrides()

func (*EnrichStep) UnmarshalJSON

func (r *EnrichStep) UnmarshalJSON(data []byte) error

type EnrichStepParam

type EnrichStepParam struct {
	// JMESPath expression to extract source data. Can extract a single value or an
	// array. Each extracted value is looked up independently.
	SourceField string `json:"sourceField" api:"required"`
	// Field path where enriched results should be placed. Use simple field names
	// (e.g., "enriched_products"). Results are always injected as an array (list),
	// regardless of topK value.
	TargetField string `json:"targetField" api:"required"`
	// Name of the collection to search against. Required when `source` is
	// `"collection"`. The collection must exist and contain items. Supports
	// hierarchical paths when used with `includeSubcollections`.
	CollectionName param.Opt[string] `json:"collectionName,omitzero"`
	// Name of an endpoint defined in `enrichConfig.endpoints`. Required when `source`
	// is `"endpoint"`.
	EndpointName param.Opt[string] `json:"endpointName,omitzero"`
	// Whether to include cosine distance scores in results. Cosine distance ranges
	// from 0.0 (perfect match) to 2.0 (completely dissimilar). Lower scores indicate
	// better semantic similarity.
	//
	// When enabled, each result includes a `cosine_distance` field (semantic mode) or
	// a `hybrid_score` field (hybrid mode).
	IncludeScore param.Opt[bool] `json:"includeScore,omitzero"`
	// When true, searches all collections under the hierarchical path. For example,
	// "customers" will match "customers", "customers.premium", etc.
	IncludeSubcollections param.Opt[bool] `json:"includeSubcollections,omitzero"`
	// Maximum cosine distance threshold for filtering results (default: 0.6). Results
	// with cosine distance above this threshold are excluded.
	//
	// **Only applies to `semantic` and `hybrid` search modes.** Exact search does not
	// use cosine distance and ignores this setting.
	//
	// Cosine distance ranges from 0.0 (identical) to 2.0 (opposite):
	//
	// - 0.0 - 0.3: Very similar (strict threshold, high-quality matches only)
	// - 0.3 - 0.6: Reasonably similar (moderate threshold)
	// - 0.6 - 1.0: Loosely related (lenient threshold)
	// - > 1.0: Rarely useful — allows nearly unrelated results
	//
	// For most semantic search use cases, good matches typically fall in the 0.2 - 0.5
	// range.
	ScoreThreshold param.Opt[float64] `json:"scoreThreshold,omitzero"`
	// Number of top matching results to return per query (default: 1). Results are
	// always returned as an array (list) and automatically sorted by cosine distance
	// (best match = lowest distance first).
	//
	// - 1: Returns array with single best match: `[{...}]`
	// - > 1: Returns array with multiple matches: `[{...}, {...}, ...]`
	TopK param.Opt[int64] `json:"topK,omitzero"`
	// Search mode to use for enrichment (default: "semantic").
	//
	// **semantic**: Vector similarity search using dense embeddings. Best for finding
	// conceptually similar items.
	//
	// - Use for: Product descriptions, natural language content
	// - Example: "red sports car" matches "crimson convertible automobile"
	//
	// **exact**: Exact keyword matching using PostgreSQL text search. Best for exact
	// identifiers.
	//
	// - Use for: SKU numbers, routing numbers, account IDs, exact tags
	// - Example: "SKU-12345" only matches items containing that exact text
	//
	// **hybrid**: Combined search using 20% semantic + 80% sparse embeddings
	// (keyword-based).
	//
	// - Use for: Tags, categories, partial identifiers
	// - Example: Balances semantic meaning with exact keyword matching
	//
	// Any of "semantic", "exact", "hybrid".
	SearchMode EnrichStepSearchMode `json:"searchMode,omitzero"`
	// Where to fetch enrichment data from (default: `"collection"`).
	//
	//   - `"collection"`: Vector/keyword search against a BEM collection. Requires
	//     `collectionName`.
	//   - `"endpoint"`: HTTP call to a named endpoint defined in
	//     `enrichConfig.endpoints`. Requires `endpointName`.
	//
	// Any of "collection", "endpoint".
	Source EnrichStepSource `json:"source,omitzero"`
	// contains filtered or unexported fields
}

Single enrichment step configuration.

**Process Flow (collection source):**

  1. Extract values from `sourceField` using JMESPath
  2. Perform search against the specified collection (semantic, exact, or hybrid based on `searchMode`)
  3. Return top K matches sorted by relevance (best match first)
  4. Inject results into `targetField`

**Process Flow (endpoint source):**

  1. Extract values from `sourceField` using JMESPath
  2. Call the named endpoint once per extracted value, following pagination if `nextPagePath`/`nextPageParam` are configured on the endpoint
  3. Optionally apply LLM agent reasoning to rank candidates (`matchInstructions`), batching across all fetched pages in groups of `maxCandidates`
  4. Inject results into `targetField`

**Collection Search Modes** (`source: "collection"` only):

  • `semantic` (default): Vector similarity search — best for natural language and conceptual matching
  • `exact`: Exact keyword matching — best for SKU numbers, IDs, routing numbers
  • `hybrid`: Combined semantic + keyword search — best for tags and categories

**Result Format (collection source):**

- Always an array sorted by relevance (best match first) - Each element: `{ data, cosineDistance? }` or `{ data, hybridScore? }`

**Result Format (endpoint source, no matchInstructions):**

- Always an array; the raw fetched value is the single element

**Result Format (endpoint source, with matchInstructions):**

- Array of LLM-ranked matches: `[{ data, confidence, reasoning? }, ...]` - Length capped by `enrichEndpoint.matchTopK` (default 1)

The properties SourceField, TargetField are required.

func (EnrichStepParam) MarshalJSON

func (r EnrichStepParam) MarshalJSON() (data []byte, err error)

func (*EnrichStepParam) UnmarshalJSON

func (r *EnrichStepParam) UnmarshalJSON(data []byte) error

type EnrichStepSearchMode

type EnrichStepSearchMode string

Search mode to use for enrichment (default: "semantic").

**semantic**: Vector similarity search using dense embeddings. Best for finding conceptually similar items.

- Use for: Product descriptions, natural language content - Example: "red sports car" matches "crimson convertible automobile"

**exact**: Exact keyword matching using PostgreSQL text search. Best for exact identifiers.

- Use for: SKU numbers, routing numbers, account IDs, exact tags - Example: "SKU-12345" only matches items containing that exact text

**hybrid**: Combined search using 20% semantic + 80% sparse embeddings (keyword-based).

- Use for: Tags, categories, partial identifiers - Example: Balances semantic meaning with exact keyword matching

const (
	EnrichStepSearchModeSemantic EnrichStepSearchMode = "semantic"
	EnrichStepSearchModeExact    EnrichStepSearchMode = "exact"
	EnrichStepSearchModeHybrid   EnrichStepSearchMode = "hybrid"
)

type EnrichStepSource added in v0.20.0

type EnrichStepSource string

Where to fetch enrichment data from (default: `"collection"`).

  • `"collection"`: Vector/keyword search against a BEM collection. Requires `collectionName`.
  • `"endpoint"`: HTTP call to a named endpoint defined in `enrichConfig.endpoints`. Requires `endpointName`.
const (
	EnrichStepSourceCollection EnrichStepSource = "collection"
	EnrichStepSourceEndpoint   EnrichStepSource = "endpoint"
)

type EnrichWebhookEvent added in v0.14.0

type EnrichWebhookEvent struct {
	// The enriched content produced by the enrich function. Contains the input data
	// augmented with results from semantic search against collections.
	EnrichedContent any `json:"enrichedContent" api:"required"`
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "enrich".
	EventType EnrichWebhookEventEventType `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent          `json:"inboundEmail"`
	Metadata     EnrichWebhookEventMetadata `json:"metadata"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EnrichedContent       respjson.Field
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ReferenceID           respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EnrichWebhookEvent) RawJSON added in v0.14.0

func (r EnrichWebhookEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*EnrichWebhookEvent) UnmarshalJSON added in v0.14.0

func (r *EnrichWebhookEvent) UnmarshalJSON(data []byte) error

type EnrichWebhookEventEventType added in v0.14.0

type EnrichWebhookEventEventType string
const (
	EnrichWebhookEventEventTypeEnrich EnrichWebhookEventEventType = "enrich"
)

type EnrichWebhookEventMetadata added in v0.14.0

type EnrichWebhookEventMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EnrichWebhookEventMetadata) RawJSON added in v0.14.0

func (r EnrichWebhookEventMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*EnrichWebhookEventMetadata) UnmarshalJSON added in v0.14.0

func (r *EnrichWebhookEventMetadata) UnmarshalJSON(data []byte) error

type EntityBulkNewParams added in v0.21.0

type EntityBulkNewParams struct {
	// The entities to seed. Must be non-empty.
	Entities []EntityBulkNewParamsEntity `json:"entities,omitzero" api:"required"`
	// Optional bucket public ID (`bkt_...`) to seed into. Omit to use the
	// account+environment default bucket.
	Bucket param.Opt[string] `json:"bucket,omitzero"`
	// Conflict strategy for an entity that already exists. Only `merge` is supported
	// and it is the default: synonyms are added additively, a longer description
	// replaces the old one, and attributes are merged with new keys winning.
	//
	// Any of "merge".
	OnConflict EntityBulkNewParamsOnConflict `json:"onConflict,omitzero"`
	// contains filtered or unexported fields
}

func (EntityBulkNewParams) MarshalJSON added in v0.21.0

func (r EntityBulkNewParams) MarshalJSON() (data []byte, err error)

func (*EntityBulkNewParams) UnmarshalJSON added in v0.21.0

func (r *EntityBulkNewParams) UnmarshalJSON(data []byte) error

type EntityBulkNewParamsEntity added in v0.21.0

type EntityBulkNewParamsEntity struct {
	// The canonical (longest / most descriptive) surface form for the entity, e.g.
	// `Acme Corporation`. Required. Normalized (lowercased, whitespace-folded) for the
	// uniqueness key.
	Canonical string `json:"canonical" api:"required"`
	// The entity type name, e.g. `instrument` or `organization`. Required. Resolved
	// against your taxonomy and created if it does not yet exist.
	Type string `json:"type" api:"required"`
	// Optional free-form description of the entity.
	Description param.Opt[string] `json:"description,omitzero"`
	// Optional per-entity structured attribute values, e.g.
	// `{ "manufacturer": "Acme", "dosageMg": 50 }`. When the entity's type declares an
	// attribute schema, keys not present in that schema cause the row to be rejected.
	Attributes any `json:"attributes,omitzero"`
	// Optional additional surface forms to attach as `customer_defined` synonyms.
	Synonyms []string `json:"synonyms,omitzero"`
	// contains filtered or unexported fields
}

One entity to seed in a `POST /v3/entities/bulk` batch.

The properties Canonical, Type are required.

func (EntityBulkNewParamsEntity) MarshalJSON added in v0.21.0

func (r EntityBulkNewParamsEntity) MarshalJSON() (data []byte, err error)

func (*EntityBulkNewParamsEntity) UnmarshalJSON added in v0.21.0

func (r *EntityBulkNewParamsEntity) UnmarshalJSON(data []byte) error

type EntityBulkNewParamsOnConflict added in v0.21.0

type EntityBulkNewParamsOnConflict string

Conflict strategy for an entity that already exists. Only `merge` is supported and it is the default: synonyms are added additively, a longer description replaces the old one, and attributes are merged with new keys winning.

const (
	EntityBulkNewParamsOnConflictMerge EntityBulkNewParamsOnConflict = "merge"
)

type EntityBulkNewResponse added in v0.21.0

type EntityBulkNewResponse struct {
	// Per-row outcomes, in request order.
	Results []EntityBulkNewResponseResult `json:"results" api:"required"`
	// Per-outcome tally across a batch.
	Summary EntityBulkNewResponseSummary `json:"summary" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Results     respjson.Field
		Summary     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

`200` response for a synchronously processed (small) batch.

func (EntityBulkNewResponse) RawJSON added in v0.21.0

func (r EntityBulkNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EntityBulkNewResponse) UnmarshalJSON added in v0.21.0

func (r *EntityBulkNewResponse) UnmarshalJSON(data []byte) error

type EntityBulkNewResponseResult added in v0.21.0

type EntityBulkNewResponseResult struct {
	// The canonical name from the input row.
	Canonical string `json:"canonical" api:"required"`
	// What happened to this row: `created` (new entity), `merged-with` (matched an
	// existing entity), or `rejected` (see `reason`).
	//
	// Any of "created", "merged-with", "rejected".
	Outcome string `json:"outcome" api:"required"`
	// Public ID (`ent_...`) of the created or merged entity. Absent when rejected.
	EntityID string `json:"entityID"`
	// Human-readable explanation when `outcome` is `rejected`.
	Reason string `json:"reason"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Canonical   respjson.Field
		Outcome     respjson.Field
		EntityID    respjson.Field
		Reason      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The outcome of seeding one row.

func (EntityBulkNewResponseResult) RawJSON added in v0.21.0

func (r EntityBulkNewResponseResult) RawJSON() string

Returns the unmodified JSON received from the API

func (*EntityBulkNewResponseResult) UnmarshalJSON added in v0.21.0

func (r *EntityBulkNewResponseResult) UnmarshalJSON(data []byte) error

type EntityBulkNewResponseSummary added in v0.21.0

type EntityBulkNewResponseSummary struct {
	// Number of rows that created a new entity.
	Created int64 `json:"created" api:"required"`
	// Number of rows merged into an existing entity.
	Merged int64 `json:"merged" api:"required"`
	// Number of rows rejected.
	Rejected int64 `json:"rejected" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Created     respjson.Field
		Merged      respjson.Field
		Rejected    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Per-outcome tally across a batch.

func (EntityBulkNewResponseSummary) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EntityBulkNewResponseSummary) UnmarshalJSON added in v0.21.0

func (r *EntityBulkNewResponseSummary) UnmarshalJSON(data []byte) error

type EntityBulkValidateParams added in v0.21.0

type EntityBulkValidateParams struct {
	// The `ent_...` IDs to transition. Must be non-empty.
	EntityIDs []string `json:"entityIDs,omitzero" api:"required"`
	// Terminal status to apply to every entity.
	//
	// Any of "approved", "rejected".
	Status EntityBulkValidateParamsStatus `json:"status,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (EntityBulkValidateParams) MarshalJSON added in v0.21.0

func (r EntityBulkValidateParams) MarshalJSON() (data []byte, err error)

func (*EntityBulkValidateParams) UnmarshalJSON added in v0.21.0

func (r *EntityBulkValidateParams) UnmarshalJSON(data []byte) error

type EntityBulkValidateParamsStatus added in v0.21.0

type EntityBulkValidateParamsStatus string

Terminal status to apply to every entity.

const (
	EntityBulkValidateParamsStatusApproved EntityBulkValidateParamsStatus = "approved"
	EntityBulkValidateParamsStatusRejected EntityBulkValidateParamsStatus = "rejected"
)

type EntityBulkValidateResponse added in v0.21.0

type EntityBulkValidateResponse struct {
	// Per-row outcomes, in request order.
	Results []EntityBulkValidateResponseResult `json:"results" api:"required"`
	// Per-outcome tally across a bulk-validate batch.
	Summary EntityBulkValidateResponseSummary `json:"summary" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Results     respjson.Field
		Summary     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

`200` response for `POST /v3/entities/bulk-validate`.

func (EntityBulkValidateResponse) RawJSON added in v0.21.0

func (r EntityBulkValidateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EntityBulkValidateResponse) UnmarshalJSON added in v0.21.0

func (r *EntityBulkValidateResponse) UnmarshalJSON(data []byte) error

type EntityBulkValidateResponseResult added in v0.21.0

type EntityBulkValidateResponseResult struct {
	// The `ent_...` ID from the request.
	EntityID string `json:"entityID" api:"required"`
	// `validated` (transition applied), `skipped` (not found or not authorized), or
	// `rejected-row` (the transition itself was illegal, e.g. already terminal).
	//
	// Any of "validated", "skipped", "rejected-row".
	Outcome string `json:"outcome" api:"required"`
	// Explanation for a `skipped` or `rejected-row` outcome.
	Reason string `json:"reason"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EntityID    respjson.Field
		Outcome     respjson.Field
		Reason      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The outcome of validating one row.

func (EntityBulkValidateResponseResult) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EntityBulkValidateResponseResult) UnmarshalJSON added in v0.21.0

func (r *EntityBulkValidateResponseResult) UnmarshalJSON(data []byte) error

type EntityBulkValidateResponseSummary added in v0.21.0

type EntityBulkValidateResponseSummary struct {
	// Rows whose transition was illegal.
	RejectedRow int64 `json:"rejectedRow" api:"required"`
	// Rows skipped (not found / not authorized).
	Skipped int64 `json:"skipped" api:"required"`
	// Rows whose transition was applied.
	Validated int64 `json:"validated" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		RejectedRow respjson.Field
		Skipped     respjson.Field
		Validated   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Per-outcome tally across a bulk-validate batch.

func (EntityBulkValidateResponseSummary) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EntityBulkValidateResponseSummary) UnmarshalJSON added in v0.21.0

func (r *EntityBulkValidateResponseSummary) UnmarshalJSON(data []byte) error

type EntityGetRelationsParams added in v0.21.0

type EntityGetRelationsParams struct {
	// Optional bucket public ID (`bkt_...`) to scope the read to one bucket. Omit for
	// the unscoped (all account+environment) view.
	Bucket param.Opt[string] `query:"bucket,omitzero" json:"-"`
	// Cursor: return edges whose KSUID sorts after this value.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Maximum number of edges to return (default 50, max 200).
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Exact-match filter on the relation label.
	RelationType param.Opt[string] `query:"relationType,omitzero" json:"-"`
	// Which edges to return relative to the entity. Defaults to `both`.
	//
	// Any of "inbound", "outbound", "both".
	Direction EntityGetRelationsParamsDirection `query:"direction,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (EntityGetRelationsParams) URLQuery added in v0.21.0

func (r EntityGetRelationsParams) URLQuery() (v url.Values, err error)

URLQuery serializes EntityGetRelationsParams's query parameters as `url.Values`.

type EntityGetRelationsParamsDirection added in v0.21.0

type EntityGetRelationsParamsDirection string

Which edges to return relative to the entity. Defaults to `both`.

const (
	EntityGetRelationsParamsDirectionInbound  EntityGetRelationsParamsDirection = "inbound"
	EntityGetRelationsParamsDirectionOutbound EntityGetRelationsParamsDirection = "outbound"
	EntityGetRelationsParamsDirectionBoth     EntityGetRelationsParamsDirection = "both"
)

type EntityGetRelationsResponse added in v0.21.0

type EntityGetRelationsResponse struct {
	// Edges pointing at the queried entity.
	Inbound []EntityGetRelationsResponseInbound `json:"inbound" api:"required"`
	// Edges pointing away from the queried entity.
	Outbound []EntityGetRelationsResponseOutbound `json:"outbound" api:"required"`
	// Opaque cursor for the next page of edges, or absent on the last page. Pass it
	// back as `cursor`.
	NextCursor string `json:"nextCursor"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Inbound     respjson.Field
		Outbound    respjson.Field
		NextCursor  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response body for `GET /v3/entities/{id}/relations`.

func (EntityGetRelationsResponse) RawJSON added in v0.21.0

func (r EntityGetRelationsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EntityGetRelationsResponse) UnmarshalJSON added in v0.21.0

func (r *EntityGetRelationsResponse) UnmarshalJSON(data []byte) error

type EntityGetRelationsResponseInbound added in v0.21.0

type EntityGetRelationsResponseInbound struct {
	// First-seen timestamp of the edge (RFC 3339).
	FirstSeenAt time.Time `json:"firstSeenAt" api:"required" format:"date-time"`
	// How many times this edge has been observed across parsed documents.
	MentionCount int64 `json:"mentionCount" api:"required"`
	// Free-form relation label (e.g. `author_of`, `affiliated_with`).
	RelationType string `json:"relationType" api:"required"`
	// A compact view of an entity sitting on the far end of a relation edge — the
	// stable public id, the canonical name, and the effective type. The full entity is
	// fetched separately via the entity detail / File System endpoints.
	SourceEntity EntityGetRelationsResponseInboundSourceEntity `json:"sourceEntity" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FirstSeenAt  respjson.Field
		MentionCount respjson.Field
		RelationType respjson.Field
		SourceEntity respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

One edge pointing AT the queried entity (some other entity is the source).

func (EntityGetRelationsResponseInbound) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EntityGetRelationsResponseInbound) UnmarshalJSON added in v0.21.0

func (r *EntityGetRelationsResponseInbound) UnmarshalJSON(data []byte) error

type EntityGetRelationsResponseInboundSourceEntity added in v0.21.0

type EntityGetRelationsResponseInboundSourceEntity struct {
	// Stable public identifier for the entity (`ent_...`).
	ID string `json:"id" api:"required"`
	// Canonical (most descriptive) surface form of the entity.
	Canonical string `json:"canonical" api:"required"`
	// Effective entity type.
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Canonical   respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A compact view of an entity sitting on the far end of a relation edge — the stable public id, the canonical name, and the effective type. The full entity is fetched separately via the entity detail / File System endpoints.

func (EntityGetRelationsResponseInboundSourceEntity) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EntityGetRelationsResponseInboundSourceEntity) UnmarshalJSON added in v0.21.0

func (r *EntityGetRelationsResponseInboundSourceEntity) UnmarshalJSON(data []byte) error

type EntityGetRelationsResponseOutbound added in v0.21.0

type EntityGetRelationsResponseOutbound struct {
	// First-seen timestamp of the edge (RFC 3339).
	FirstSeenAt time.Time `json:"firstSeenAt" api:"required" format:"date-time"`
	// How many times this edge has been observed across parsed documents.
	MentionCount int64 `json:"mentionCount" api:"required"`
	// Free-form relation label (e.g. `author_of`, `affiliated_with`).
	RelationType string `json:"relationType" api:"required"`
	// A compact view of an entity sitting on the far end of a relation edge — the
	// stable public id, the canonical name, and the effective type. The full entity is
	// fetched separately via the entity detail / File System endpoints.
	TargetEntity EntityGetRelationsResponseOutboundTargetEntity `json:"targetEntity" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FirstSeenAt  respjson.Field
		MentionCount respjson.Field
		RelationType respjson.Field
		TargetEntity respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

One edge pointing AWAY from the queried entity (it is the source).

func (EntityGetRelationsResponseOutbound) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EntityGetRelationsResponseOutbound) UnmarshalJSON added in v0.21.0

func (r *EntityGetRelationsResponseOutbound) UnmarshalJSON(data []byte) error

type EntityGetRelationsResponseOutboundTargetEntity added in v0.21.0

type EntityGetRelationsResponseOutboundTargetEntity struct {
	// Stable public identifier for the entity (`ent_...`).
	ID string `json:"id" api:"required"`
	// Canonical (most descriptive) surface form of the entity.
	Canonical string `json:"canonical" api:"required"`
	// Effective entity type.
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Canonical   respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A compact view of an entity sitting on the far end of a relation edge — the stable public id, the canonical name, and the effective type. The full entity is fetched separately via the entity detail / File System endpoints.

func (EntityGetRelationsResponseOutboundTargetEntity) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EntityGetRelationsResponseOutboundTargetEntity) UnmarshalJSON added in v0.21.0

type EntityGetSeedStatusResponse added in v0.21.0

type EntityGetSeedStatusResponse struct {
	// Rows that created a new entity.
	CreatedCount int64 `json:"createdCount" api:"required"`
	// Rows merged into an existing entity.
	MergedCount int64 `json:"mergedCount" api:"required"`
	// Rows rejected.
	RejectedCount int64 `json:"rejectedCount" api:"required"`
	// Public ID (`esj_...`) of the seed job.
	SeedJobID string `json:"seedJobID" api:"required"`
	// Lifecycle state.
	//
	// Any of "pending", "processing", "completed", "failed".
	Status EntityGetSeedStatusResponseStatus `json:"status" api:"required"`
	// Total rows in the submitted batch.
	TotalRows int64 `json:"totalRows" api:"required"`
	// Terminal error message when `status` is `failed`.
	Error string `json:"error"`
	// Per-row outcomes. Present only once `status` is `completed`.
	Results []EntityGetSeedStatusResponseResult `json:"results"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedCount  respjson.Field
		MergedCount   respjson.Field
		RejectedCount respjson.Field
		SeedJobID     respjson.Field
		Status        respjson.Field
		TotalRows     respjson.Field
		Error         respjson.Field
		Results       respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

`GET /v3/entities/seed/{id}` response.

func (EntityGetSeedStatusResponse) RawJSON added in v0.21.0

func (r EntityGetSeedStatusResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EntityGetSeedStatusResponse) UnmarshalJSON added in v0.21.0

func (r *EntityGetSeedStatusResponse) UnmarshalJSON(data []byte) error

type EntityGetSeedStatusResponseResult added in v0.21.0

type EntityGetSeedStatusResponseResult struct {
	// The canonical name from the input row.
	Canonical string `json:"canonical" api:"required"`
	// What happened to this row: `created` (new entity), `merged-with` (matched an
	// existing entity), or `rejected` (see `reason`).
	//
	// Any of "created", "merged-with", "rejected".
	Outcome string `json:"outcome" api:"required"`
	// Public ID (`ent_...`) of the created or merged entity. Absent when rejected.
	EntityID string `json:"entityID"`
	// Human-readable explanation when `outcome` is `rejected`.
	Reason string `json:"reason"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Canonical   respjson.Field
		Outcome     respjson.Field
		EntityID    respjson.Field
		Reason      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The outcome of seeding one row.

func (EntityGetSeedStatusResponseResult) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EntityGetSeedStatusResponseResult) UnmarshalJSON added in v0.21.0

func (r *EntityGetSeedStatusResponseResult) UnmarshalJSON(data []byte) error

type EntityGetSeedStatusResponseStatus added in v0.21.0

type EntityGetSeedStatusResponseStatus string

Lifecycle state.

const (
	EntityGetSeedStatusResponseStatusPending    EntityGetSeedStatusResponseStatus = "pending"
	EntityGetSeedStatusResponseStatusProcessing EntityGetSeedStatusResponseStatus = "processing"
	EntityGetSeedStatusResponseStatusCompleted  EntityGetSeedStatusResponseStatus = "completed"
	EntityGetSeedStatusResponseStatusFailed     EntityGetSeedStatusResponseStatus = "failed"
)

type EntityService added in v0.21.0

type EntityService struct {

	// Manage the human-readable surface forms (synonyms) attached to a canonical
	// entity. Synonyms feed the matcher's exact-match path, so adding the right
	// synonyms improves cross-document entity resolution.
	//
	//   - **`POST /v3/entities/{id}/synonyms`** attaches a `customer_defined` synonym.
	//     If the same normalized form already exists as an `extracted` synonym, it is
	//     upgraded to `customer_defined` (so the matcher weights it higher); an existing
	//     customer/SME synonym is returned unchanged.
	//   - **`DELETE /v3/entities/{id}/synonyms/{synonymID}`** soft-deletes a synonym.
	//     Only `customer_defined` and `sme_approved` synonyms are deletable; `extracted`
	//     synonyms are resolver-owned and the request is rejected with `409 Conflict`.
	//
	// A merged-away entity id transparently resolves to its surviving canonical
	// entity, so a synonym added to a stale id lands on the entity that persists.
	Synonyms EntitySynonymService
	// contains filtered or unexported fields
}

EntityService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEntityService method instead.

func NewEntityService added in v0.21.0

func NewEntityService(opts ...option.RequestOption) (r EntityService)

NewEntityService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EntityService) BulkNew added in v0.21.0

Bulk Seed Entities

func (*EntityService) BulkValidate added in v0.21.0

Bulk Validate Entities

func (*EntityService) GetRelations added in v0.21.0

Get an Entity's Relations

func (*EntityService) GetSeedStatus added in v0.21.0

func (r *EntityService) GetSeedStatus(ctx context.Context, id string, opts ...option.RequestOption) (res *EntityGetSeedStatusResponse, err error)

Get Seed Job Status

func (*EntityService) Update added in v0.21.0

Update Entity

type EntitySynonymAddParams added in v0.21.0

type EntitySynonymAddParams struct {
	// The human-readable synonym surface form to attach (e.g. `Acme Corp`, `ACME`). It
	// is normalized (lowercased, whitespace-folded) for the uniqueness key and the
	// matcher's exact-match path.
	Text string `json:"text" api:"required"`
	// Optional bucket public ID (`bkt_...`) to scope the entity lookup to one bucket.
	// Omit for the unscoped (all account+environment) view.
	Bucket param.Opt[string] `query:"bucket,omitzero" json:"-"`
	// Optional BCP 47 locale tag (e.g. `en-US`) for language-specific synonyms.
	Locale param.Opt[string] `json:"locale,omitzero"`
	// contains filtered or unexported fields
}

func (EntitySynonymAddParams) MarshalJSON added in v0.21.0

func (r EntitySynonymAddParams) MarshalJSON() (data []byte, err error)

func (EntitySynonymAddParams) URLQuery added in v0.21.0

func (r EntitySynonymAddParams) URLQuery() (v url.Values, err error)

URLQuery serializes EntitySynonymAddParams's query parameters as `url.Values`.

func (*EntitySynonymAddParams) UnmarshalJSON added in v0.21.0

func (r *EntitySynonymAddParams) UnmarshalJSON(data []byte) error

type EntitySynonymAddResponse added in v0.21.0

type EntitySynonymAddResponse struct {
	// Creation timestamp of the synonym (RFC 3339).
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Lowercased, whitespace-folded form of `text`.
	NormalizedText string `json:"normalizedText" api:"required"`
	// Provenance of the synonym. `customer_defined` and `sme_approved` synonyms are
	// deletable; `extracted` synonyms are resolver-owned and cannot be deleted.
	//
	// Any of "extracted", "customer_defined", "sme_approved".
	Source EntitySynonymAddResponseSource `json:"source" api:"required"`
	// Stable public identifier for the synonym (`esn_...`).
	SynonymID string `json:"synonymID" api:"required"`
	// The human-readable synonym as authored.
	Text string `json:"text" api:"required"`
	// Optional BCP 47 locale tag, when one was supplied.
	Locale string `json:"locale"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt      respjson.Field
		NormalizedText respjson.Field
		Source         respjson.Field
		SynonymID      respjson.Field
		Text           respjson.Field
		Locale         respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

One synonym attached to an entity.

func (EntitySynonymAddResponse) RawJSON added in v0.21.0

func (r EntitySynonymAddResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EntitySynonymAddResponse) UnmarshalJSON added in v0.21.0

func (r *EntitySynonymAddResponse) UnmarshalJSON(data []byte) error

type EntitySynonymAddResponseSource added in v0.21.0

type EntitySynonymAddResponseSource string

Provenance of the synonym. `customer_defined` and `sme_approved` synonyms are deletable; `extracted` synonyms are resolver-owned and cannot be deleted.

const (
	EntitySynonymAddResponseSourceExtracted       EntitySynonymAddResponseSource = "extracted"
	EntitySynonymAddResponseSourceCustomerDefined EntitySynonymAddResponseSource = "customer_defined"
	EntitySynonymAddResponseSourceSmeApproved     EntitySynonymAddResponseSource = "sme_approved"
)

type EntitySynonymRemoveParams added in v0.21.0

type EntitySynonymRemoveParams struct {
	ID string `path:"id" api:"required" json:"-"`
	// Optional bucket public ID (`bkt_...`) to scope the entity lookup to one bucket.
	// Omit for the unscoped (all account+environment) view.
	Bucket param.Opt[string] `query:"bucket,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (EntitySynonymRemoveParams) URLQuery added in v0.21.0

func (r EntitySynonymRemoveParams) URLQuery() (v url.Values, err error)

URLQuery serializes EntitySynonymRemoveParams's query parameters as `url.Values`.

type EntitySynonymService added in v0.21.0

type EntitySynonymService struct {
	// contains filtered or unexported fields
}

Manage the human-readable surface forms (synonyms) attached to a canonical entity. Synonyms feed the matcher's exact-match path, so adding the right synonyms improves cross-document entity resolution.

  • **`POST /v3/entities/{id}/synonyms`** attaches a `customer_defined` synonym. If the same normalized form already exists as an `extracted` synonym, it is upgraded to `customer_defined` (so the matcher weights it higher); an existing customer/SME synonym is returned unchanged.
  • **`DELETE /v3/entities/{id}/synonyms/{synonymID}`** soft-deletes a synonym. Only `customer_defined` and `sme_approved` synonyms are deletable; `extracted` synonyms are resolver-owned and the request is rejected with `409 Conflict`.

A merged-away entity id transparently resolves to its surviving canonical entity, so a synonym added to a stale id lands on the entity that persists.

EntitySynonymService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEntitySynonymService method instead.

func NewEntitySynonymService added in v0.21.0

func NewEntitySynonymService(opts ...option.RequestOption) (r EntitySynonymService)

NewEntitySynonymService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EntitySynonymService) Add added in v0.21.0

Add a Synonym to an Entity

func (*EntitySynonymService) Remove added in v0.21.0

func (r *EntitySynonymService) Remove(ctx context.Context, synonymID string, params EntitySynonymRemoveParams, opts ...option.RequestOption) (err error)

Remove a Synonym from an Entity

type EntityTypeGetResponse added in v0.21.0

type EntityTypeGetResponse struct {
	// Creation timestamp (RFC 3339).
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Optional human-facing note about the type.
	Description string `json:"description" api:"required"`
	// Human-facing type name. Unique within an account+environment, and immutable once
	// set.
	Name string `json:"name" api:"required"`
	// Public ID (`ety_...`) of the parent type, or an empty string when the type is
	// top-level.
	ParentTypeID string `json:"parentTypeID" api:"required"`
	// Stable public identifier for the entity type (`ety_...`).
	TypeID string `json:"typeID" api:"required"`
	// Last-update timestamp (RFC 3339).
	UpdatedAt time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// Optional per-type structured attribute metadata.
	AttributeSchema any `json:"attributeSchema"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt       respjson.Field
		Description     respjson.Field
		Name            respjson.Field
		ParentTypeID    respjson.Field
		TypeID          respjson.Field
		UpdatedAt       respjson.Field
		AttributeSchema respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An EntityType is a customer-defined type in the knowledge-graph taxonomy, scoped to an account+environment. Types may be organised into hierarchies via `parentTypeID`, and may carry per-type structured attribute metadata in `attributeSchema` (for example `{"unit": "mg", "range": [0, 100]}`).

func (EntityTypeGetResponse) RawJSON added in v0.21.0

func (r EntityTypeGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EntityTypeGetResponse) UnmarshalJSON added in v0.21.0

func (r *EntityTypeGetResponse) UnmarshalJSON(data []byte) error

type EntityTypeListParams added in v0.21.0

type EntityTypeListParams struct {
	// Cursor: return types whose `typeID` sorts before this value.
	EndingBefore param.Opt[string] `query:"endingBefore,omitzero" json:"-"`
	// Maximum number of entity types to return (default 50, max 200).
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Filter to the direct children of this parent type (`ety_...`).
	ParentTypeID param.Opt[string] `query:"parentTypeId,omitzero" json:"-"`
	// Cursor: return types whose `typeID` sorts after this value.
	StartingAfter param.Opt[string] `query:"startingAfter,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (EntityTypeListParams) URLQuery added in v0.21.0

func (r EntityTypeListParams) URLQuery() (v url.Values, err error)

URLQuery serializes EntityTypeListParams's query parameters as `url.Values`.

type EntityTypeListResponse added in v0.21.0

type EntityTypeListResponse struct {
	EntityTypes []EntityTypeListResponseEntityType `json:"entityTypes" api:"required"`
	// Total number of entity types matching the query, ignoring pagination.
	TotalCount int64 `json:"totalCount" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EntityTypes respjson.Field
		TotalCount  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response body for listing entity types.

func (EntityTypeListResponse) RawJSON added in v0.21.0

func (r EntityTypeListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EntityTypeListResponse) UnmarshalJSON added in v0.21.0

func (r *EntityTypeListResponse) UnmarshalJSON(data []byte) error

type EntityTypeListResponseEntityType added in v0.21.0

type EntityTypeListResponseEntityType struct {
	// Creation timestamp (RFC 3339).
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Optional human-facing note about the type.
	Description string `json:"description" api:"required"`
	// Human-facing type name. Unique within an account+environment, and immutable once
	// set.
	Name string `json:"name" api:"required"`
	// Public ID (`ety_...`) of the parent type, or an empty string when the type is
	// top-level.
	ParentTypeID string `json:"parentTypeID" api:"required"`
	// Stable public identifier for the entity type (`ety_...`).
	TypeID string `json:"typeID" api:"required"`
	// Last-update timestamp (RFC 3339).
	UpdatedAt time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// Optional per-type structured attribute metadata.
	AttributeSchema any `json:"attributeSchema"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt       respjson.Field
		Description     respjson.Field
		Name            respjson.Field
		ParentTypeID    respjson.Field
		TypeID          respjson.Field
		UpdatedAt       respjson.Field
		AttributeSchema respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An EntityType is a customer-defined type in the knowledge-graph taxonomy, scoped to an account+environment. Types may be organised into hierarchies via `parentTypeID`, and may carry per-type structured attribute metadata in `attributeSchema` (for example `{"unit": "mg", "range": [0, 100]}`).

func (EntityTypeListResponseEntityType) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EntityTypeListResponseEntityType) UnmarshalJSON added in v0.21.0

func (r *EntityTypeListResponseEntityType) UnmarshalJSON(data []byte) error

type EntityTypeNewParams added in v0.21.0

type EntityTypeNewParams struct {
	// Type name. Required and unique within the account+environment.
	Name string `json:"name" api:"required"`
	// Optional description.
	Description param.Opt[string] `json:"description,omitzero"`
	// Optional public ID (`ety_...`) of the parent type. Must belong to the same
	// account+environment.
	ParentTypeID param.Opt[string] `json:"parentTypeID,omitzero"`
	// Optional per-type structured attribute metadata.
	AttributeSchema any `json:"attributeSchema,omitzero"`
	// contains filtered or unexported fields
}

func (EntityTypeNewParams) MarshalJSON added in v0.21.0

func (r EntityTypeNewParams) MarshalJSON() (data []byte, err error)

func (*EntityTypeNewParams) UnmarshalJSON added in v0.21.0

func (r *EntityTypeNewParams) UnmarshalJSON(data []byte) error

type EntityTypeNewResponse added in v0.21.0

type EntityTypeNewResponse struct {
	// Creation timestamp (RFC 3339).
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Optional human-facing note about the type.
	Description string `json:"description" api:"required"`
	// Human-facing type name. Unique within an account+environment, and immutable once
	// set.
	Name string `json:"name" api:"required"`
	// Public ID (`ety_...`) of the parent type, or an empty string when the type is
	// top-level.
	ParentTypeID string `json:"parentTypeID" api:"required"`
	// Stable public identifier for the entity type (`ety_...`).
	TypeID string `json:"typeID" api:"required"`
	// Last-update timestamp (RFC 3339).
	UpdatedAt time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// Optional per-type structured attribute metadata.
	AttributeSchema any `json:"attributeSchema"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt       respjson.Field
		Description     respjson.Field
		Name            respjson.Field
		ParentTypeID    respjson.Field
		TypeID          respjson.Field
		UpdatedAt       respjson.Field
		AttributeSchema respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An EntityType is a customer-defined type in the knowledge-graph taxonomy, scoped to an account+environment. Types may be organised into hierarchies via `parentTypeID`, and may carry per-type structured attribute metadata in `attributeSchema` (for example `{"unit": "mg", "range": [0, 100]}`).

func (EntityTypeNewResponse) RawJSON added in v0.21.0

func (r EntityTypeNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EntityTypeNewResponse) UnmarshalJSON added in v0.21.0

func (r *EntityTypeNewResponse) UnmarshalJSON(data []byte) error

type EntityTypeReviewerAssignParams added in v0.21.0

type EntityTypeReviewerAssignParams struct {
	// Public ID (`usr_...`) of the user to assign. Must belong to the account.
	UserID string `json:"userID" api:"required"`
	// contains filtered or unexported fields
}

func (EntityTypeReviewerAssignParams) MarshalJSON added in v0.21.0

func (r EntityTypeReviewerAssignParams) MarshalJSON() (data []byte, err error)

func (*EntityTypeReviewerAssignParams) UnmarshalJSON added in v0.21.0

func (r *EntityTypeReviewerAssignParams) UnmarshalJSON(data []byte) error

type EntityTypeReviewerAssignResponse added in v0.21.0

type EntityTypeReviewerAssignResponse struct {
	// When the assignment was created (RFC 3339).
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// The assigned user's email.
	Email string `json:"email" api:"required"`
	// Stable public identifier for the assignment (`etr_...`).
	ReviewerID string `json:"reviewerID" api:"required"`
	// The assigned user's account role (for example `operator`, `admin`).
	Role string `json:"role" api:"required"`
	// Public identifier of the assigned user (`usr_...`).
	UserID string `json:"userID" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Email       respjson.Field
		ReviewerID  respjson.Field
		Role        respjson.Field
		UserID      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A reviewer assignment links a user to an entity type they are responsible for reviewing. The assignment is scoped to an account+environment and is unique per (entity type, user).

func (EntityTypeReviewerAssignResponse) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EntityTypeReviewerAssignResponse) UnmarshalJSON added in v0.21.0

func (r *EntityTypeReviewerAssignResponse) UnmarshalJSON(data []byte) error

type EntityTypeReviewerListResponse added in v0.21.0

type EntityTypeReviewerListResponse struct {
	Reviewers []EntityTypeReviewerListResponseReviewer `json:"reviewers" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Reviewers   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response body for listing the reviewers of an entity type.

func (EntityTypeReviewerListResponse) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EntityTypeReviewerListResponse) UnmarshalJSON added in v0.21.0

func (r *EntityTypeReviewerListResponse) UnmarshalJSON(data []byte) error

type EntityTypeReviewerListResponseReviewer added in v0.21.0

type EntityTypeReviewerListResponseReviewer struct {
	// When the assignment was created (RFC 3339).
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// The assigned user's email.
	Email string `json:"email" api:"required"`
	// Stable public identifier for the assignment (`etr_...`).
	ReviewerID string `json:"reviewerID" api:"required"`
	// The assigned user's account role (for example `operator`, `admin`).
	Role string `json:"role" api:"required"`
	// Public identifier of the assigned user (`usr_...`).
	UserID string `json:"userID" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Email       respjson.Field
		ReviewerID  respjson.Field
		Role        respjson.Field
		UserID      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A reviewer assignment links a user to an entity type they are responsible for reviewing. The assignment is scoped to an account+environment and is unique per (entity type, user).

func (EntityTypeReviewerListResponseReviewer) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EntityTypeReviewerListResponseReviewer) UnmarshalJSON added in v0.21.0

func (r *EntityTypeReviewerListResponseReviewer) UnmarshalJSON(data []byte) error

type EntityTypeReviewerRemoveParams added in v0.21.0

type EntityTypeReviewerRemoveParams struct {
	TypeID string `path:"typeID" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type EntityTypeReviewerService added in v0.21.0

type EntityTypeReviewerService struct {
	// contains filtered or unexported fields
}

Reviewer assignments link users to the entity types they are responsible for reviewing, scoped to an account+environment. These are dashboard-only endpoints: an assignment needs a user identity, which only the dashboard (JWT) surface carries.

  • **`POST /v3/entity-types/{typeID}/reviewers`** assigns a user as a reviewer of the type. The assignment is idempotent: re-assigning an existing reviewer returns the existing assignment. Requires the `admin` role.
  • **`GET /v3/entity-types/{typeID}/reviewers`** lists the users assigned to review the type, with each user's email and role. Requires the `operator` role.
  • **`DELETE /v3/entity-types/{typeID}/reviewers/{userID}`** removes an assignment. Requires the `admin` role.
  • **`GET /v3/users/{userID}/reviewer-assignments`** is the reverse lookup: the entity types a user reviews. A user may read their own assignments; reading another user's assignments requires the `admin` role.

EntityTypeReviewerService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEntityTypeReviewerService method instead.

func NewEntityTypeReviewerService added in v0.21.0

func NewEntityTypeReviewerService(opts ...option.RequestOption) (r EntityTypeReviewerService)

NewEntityTypeReviewerService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EntityTypeReviewerService) Assign added in v0.21.0

Assign a Reviewer

func (*EntityTypeReviewerService) List added in v0.21.0

List Reviewers

func (*EntityTypeReviewerService) Remove added in v0.21.0

Remove a Reviewer

type EntityTypeService added in v0.21.0

type EntityTypeService struct {

	// Reviewer assignments link users to the entity types they are responsible for
	// reviewing, scoped to an account+environment. These are dashboard-only endpoints:
	// an assignment needs a user identity, which only the dashboard (JWT) surface
	// carries.
	//
	//   - **`POST /v3/entity-types/{typeID}/reviewers`** assigns a user as a reviewer of
	//     the type. The assignment is idempotent: re-assigning an existing reviewer
	//     returns the existing assignment. Requires the `admin` role.
	//   - **`GET /v3/entity-types/{typeID}/reviewers`** lists the users assigned to
	//     review the type, with each user's email and role. Requires the `operator`
	//     role.
	//   - **`DELETE /v3/entity-types/{typeID}/reviewers/{userID}`** removes an
	//     assignment. Requires the `admin` role.
	//   - **`GET /v3/users/{userID}/reviewer-assignments`** is the reverse lookup: the
	//     entity types a user reviews. A user may read their own assignments; reading
	//     another user's assignments requires the `admin` role.
	Reviewers EntityTypeReviewerService
	// contains filtered or unexported fields
}

Entity Types are the customer-defined taxonomy for the knowledge graph, scoped to an account+environment. Each type has a unique, immutable name and can be organised into hierarchies via `parentTypeID`. A type may carry per-type structured attribute metadata in `attributeSchema` (for example `{"unit": "mg", "range": [0, 100]}`).

Use these endpoints to create, list, fetch, update, and delete entity types:

  • **`POST /v3/entity-types`** creates a type, optionally under a parent.
  • **`GET /v3/entity-types`** lists types with cursor pagination (`startingAfter` / `endingBefore` over `typeID`) and an optional `parentTypeId` filter for direct children.
  • **`PATCH /v3/entity-types/{typeID}`** updates `description`, `parentTypeID`, and/or `attributeSchema`. The `name` is immutable.
  • **`DELETE /v3/entity-types/{typeID}`** soft-deletes a type. The request is rejected with `409 Conflict` while any live entity is assigned to the type or any live child type points at it.

EntityTypeService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEntityTypeService method instead.

func NewEntityTypeService added in v0.21.0

func NewEntityTypeService(opts ...option.RequestOption) (r EntityTypeService)

NewEntityTypeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EntityTypeService) Delete added in v0.21.0

func (r *EntityTypeService) Delete(ctx context.Context, typeID string, opts ...option.RequestOption) (err error)

Delete an Entity Type

func (*EntityTypeService) Get added in v0.21.0

func (r *EntityTypeService) Get(ctx context.Context, typeID string, opts ...option.RequestOption) (res *EntityTypeGetResponse, err error)

Get an Entity Type

func (*EntityTypeService) List added in v0.21.0

List Entity Types

func (*EntityTypeService) New added in v0.21.0

Create an Entity Type

func (*EntityTypeService) Update added in v0.21.0

Update an Entity Type

type EntityTypeUpdateParams added in v0.21.0

type EntityTypeUpdateParams struct {
	// New description.
	Description param.Opt[string] `json:"description,omitzero"`
	// New parent type public ID (`ety_...`), or an empty string to clear the parent
	// (promote to top-level). Must belong to the same account+environment and may not
	// be the type itself.
	ParentTypeID param.Opt[string] `json:"parentTypeID,omitzero"`
	// New per-type structured attribute metadata.
	AttributeSchema any `json:"attributeSchema,omitzero"`
	// contains filtered or unexported fields
}

func (EntityTypeUpdateParams) MarshalJSON added in v0.21.0

func (r EntityTypeUpdateParams) MarshalJSON() (data []byte, err error)

func (*EntityTypeUpdateParams) UnmarshalJSON added in v0.21.0

func (r *EntityTypeUpdateParams) UnmarshalJSON(data []byte) error

type EntityTypeUpdateResponse added in v0.21.0

type EntityTypeUpdateResponse struct {
	// Creation timestamp (RFC 3339).
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Optional human-facing note about the type.
	Description string `json:"description" api:"required"`
	// Human-facing type name. Unique within an account+environment, and immutable once
	// set.
	Name string `json:"name" api:"required"`
	// Public ID (`ety_...`) of the parent type, or an empty string when the type is
	// top-level.
	ParentTypeID string `json:"parentTypeID" api:"required"`
	// Stable public identifier for the entity type (`ety_...`).
	TypeID string `json:"typeID" api:"required"`
	// Last-update timestamp (RFC 3339).
	UpdatedAt time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// Optional per-type structured attribute metadata.
	AttributeSchema any `json:"attributeSchema"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt       respjson.Field
		Description     respjson.Field
		Name            respjson.Field
		ParentTypeID    respjson.Field
		TypeID          respjson.Field
		UpdatedAt       respjson.Field
		AttributeSchema respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An EntityType is a customer-defined type in the knowledge-graph taxonomy, scoped to an account+environment. Types may be organised into hierarchies via `parentTypeID`, and may carry per-type structured attribute metadata in `attributeSchema` (for example `{"unit": "mg", "range": [0, 100]}`).

func (EntityTypeUpdateResponse) RawJSON added in v0.21.0

func (r EntityTypeUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EntityTypeUpdateResponse) UnmarshalJSON added in v0.21.0

func (r *EntityTypeUpdateResponse) UnmarshalJSON(data []byte) error

type EntityUpdateParams added in v0.21.0

type EntityUpdateParams struct {
	// The `ety_...` public ID of the type to assign (overriding the bem-inferred
	// type). The empty string clears the assignment. Omit to leave unchanged.
	AssignedTypeID param.Opt[string] `json:"assignedTypeID,omitzero"`
	// Replace the entity's canonical surface form (re-derives its normalized form).
	Canonical param.Opt[string] `json:"canonical,omitzero"`
	// Optional BCP 47 locale tag stamped on any added synonyms.
	Locale param.Opt[string] `json:"locale,omitzero"`
	// Surface forms to attach as `customer_defined` synonyms.
	AddSynonyms []string `json:"addSynonyms,omitzero"`
	// `esn_...` synonym IDs to soft-delete. Only `customer_defined` / `sme_approved`
	// synonyms may be removed; an `extracted` synonym is rejected with `409`.
	RemoveSynonymIDs []string `json:"removeSynonymIDs,omitzero"`
	// Transition the entity's curation status. Only `approved` or `rejected` are
	// accepted, and only from `extracted` or `proposed` (any other transition is
	// rejected with `409`).
	//
	// Any of "approved", "rejected".
	Status EntityUpdateParamsStatus `json:"status,omitzero"`
	// contains filtered or unexported fields
}

func (EntityUpdateParams) MarshalJSON added in v0.21.0

func (r EntityUpdateParams) MarshalJSON() (data []byte, err error)

func (*EntityUpdateParams) UnmarshalJSON added in v0.21.0

func (r *EntityUpdateParams) UnmarshalJSON(data []byte) error

type EntityUpdateParamsStatus added in v0.21.0

type EntityUpdateParamsStatus string

Transition the entity's curation status. Only `approved` or `rejected` are accepted, and only from `extracted` or `proposed` (any other transition is rejected with `409`).

const (
	EntityUpdateParamsStatusApproved EntityUpdateParamsStatus = "approved"
	EntityUpdateParamsStatusRejected EntityUpdateParamsStatus = "rejected"
)

type EntityUpdateResponse added in v0.21.0

type EntityUpdateResponse struct {
	// The canonical (longest / most descriptive) surface form.
	Canonical string `json:"canonical" api:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Public ID (`ent_...`).
	EntityID string `json:"entityID" api:"required"`
	// Total mentions across parsed documents.
	MentionCount int64 `json:"mentionCount" api:"required"`
	// Curation lifecycle state.
	//
	// Any of "extracted", "proposed", "approved", "rejected".
	Status EntityUpdateResponseStatus `json:"status" api:"required"`
	// Distinct surface forms resolved to this entity.
	SurfaceForms []string `json:"surfaceForms" api:"required"`
	// The entity's effective type name (assigned type if set, else inferred).
	Type string `json:"type" api:"required"`
	// Last-update timestamp.
	UpdatedAt time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// Free-form description.
	Description string `json:"description"`
	// `ety_...` public ID of the assigned type, when one is set.
	TypeID string `json:"typeID"`
	// When the entity was approved/rejected. Present only once validated.
	ValidatedAt time.Time `json:"validatedAt" format:"date-time"`
	// `usr_...` public ID of the validating user (dashboard transitions only).
	ValidatedByUserID string `json:"validatedByUserID"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Canonical         respjson.Field
		CreatedAt         respjson.Field
		EntityID          respjson.Field
		MentionCount      respjson.Field
		Status            respjson.Field
		SurfaceForms      respjson.Field
		Type              respjson.Field
		UpdatedAt         respjson.Field
		Description       respjson.Field
		TypeID            respjson.Field
		ValidatedAt       respjson.Field
		ValidatedByUserID respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An entity record, including its curation status and assigned type.

func (EntityUpdateResponse) RawJSON added in v0.21.0

func (r EntityUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EntityUpdateResponse) UnmarshalJSON added in v0.21.0

func (r *EntityUpdateResponse) UnmarshalJSON(data []byte) error

type EntityUpdateResponseStatus added in v0.21.0

type EntityUpdateResponseStatus string

Curation lifecycle state.

const (
	EntityUpdateResponseStatusExtracted EntityUpdateResponseStatus = "extracted"
	EntityUpdateResponseStatusProposed  EntityUpdateResponseStatus = "proposed"
	EntityUpdateResponseStatusApproved  EntityUpdateResponseStatus = "approved"
	EntityUpdateResponseStatusRejected  EntityUpdateResponseStatus = "rejected"
)

type Error

type Error = apierror.Error

type ErrorEvent

type ErrorEvent struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// Error message.
	Message string `json:"message" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "error".
	EventType ErrorEventEventType `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent  `json:"inboundEmail"`
	Metadata     ErrorEventMetadata `json:"metadata"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		Message               respjson.Field
		ReferenceID           respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ErrorEvent) RawJSON

func (r ErrorEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ErrorEvent) UnmarshalJSON

func (r *ErrorEvent) UnmarshalJSON(data []byte) error

type ErrorEventEventType

type ErrorEventEventType string
const (
	ErrorEventEventTypeError ErrorEventEventType = "error"
)

type ErrorEventMetadata

type ErrorEventMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ErrorEventMetadata) RawJSON

func (r ErrorEventMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*ErrorEventMetadata) UnmarshalJSON

func (r *ErrorEventMetadata) UnmarshalJSON(data []byte) error

type ErrorGetResponse

type ErrorGetResponse struct {
	// The error event.
	Error ErrorEvent `json:"error" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Error       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ErrorGetResponse) RawJSON

func (r ErrorGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ErrorGetResponse) UnmarshalJSON

func (r *ErrorGetResponse) UnmarshalJSON(data []byte) error

type ErrorListParams

type ErrorListParams struct {
	EndingBefore param.Opt[string] `query:"endingBefore,omitzero" json:"-"`
	Limit        param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// Case-insensitive substring match against `referenceID`.
	ReferenceIDSubstring param.Opt[string] `query:"referenceIDSubstring,omitzero" json:"-"`
	StartingAfter        param.Opt[string] `query:"startingAfter,omitzero" json:"-"`
	// Filter to errors from specific calls.
	CallIDs       []string `query:"callIDs,omitzero" json:"-"`
	FunctionIDs   []string `query:"functionIDs,omitzero" json:"-"`
	FunctionNames []string `query:"functionNames,omitzero" json:"-"`
	ReferenceIDs  []string `query:"referenceIDs,omitzero" json:"-"`
	// Any of "asc", "desc".
	SortOrder     ErrorListParamsSortOrder `query:"sortOrder,omitzero" json:"-"`
	WorkflowIDs   []string                 `query:"workflowIDs,omitzero" json:"-"`
	WorkflowNames []string                 `query:"workflowNames,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ErrorListParams) URLQuery

func (r ErrorListParams) URLQuery() (v url.Values, err error)

URLQuery serializes ErrorListParams's query parameters as `url.Values`.

type ErrorListParamsSortOrder

type ErrorListParamsSortOrder string
const (
	ErrorListParamsSortOrderAsc  ErrorListParamsSortOrder = "asc"
	ErrorListParamsSortOrderDesc ErrorListParamsSortOrder = "desc"
)

type ErrorService

type ErrorService struct {
	// contains filtered or unexported fields
}

Retrieve terminal error events from workflow calls.

Errors are events produced by function steps that failed during processing. A single workflow call may produce multiple error events if several steps fail independently.

Errors and outputs from the same call are not mutually exclusive: a partially-completed workflow may have both.

Use `GET /v3/errors` to list errors across calls, or `GET /v3/errors/{eventID}` to retrieve a specific error. To get errors scoped to a single call, filter by `callIDs`.

ErrorService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewErrorService method instead.

func NewErrorService

func NewErrorService(opts ...option.RequestOption) (r ErrorService)

NewErrorService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ErrorService) Get

func (r *ErrorService) Get(ctx context.Context, eventID string, opts ...option.RequestOption) (res *ErrorGetResponse, err error)

**Retrieve a single error event by ID.**

Returns `404` if the event does not exist or if it is not an error event (use `GET /v3/outputs/{eventID}` for non-error events).

func (*ErrorService) List

**List terminal error events.**

Returns error events produced by failed function calls within workflow executions. Non-error output events are excluded; use `GET /v3/outputs` to retrieve those.

## Filtering

Filter by call, workflow, function, or reference ID. Multiple filters are ANDed together.

func (*ErrorService) ListAutoPaging

**List terminal error events.**

Returns error events produced by failed function calls within workflow executions. Non-error output events are excluded; use `GET /v3/outputs` to retrieve those.

## Filtering

Filter by call, workflow, function, or reference ID. Multiple filters are ANDed together.

type EvalResultGetResultsParams added in v0.10.0

type EvalResultGetResultsParams struct {
	// Optional evaluation version filter.
	EvaluationVersion param.Opt[string] `query:"evaluationVersion,omitzero" json:"-"`
	// Comma-separated list of event KSUIDs to fetch results for. Between 1 and 100 IDs
	// per request. Mutually exclusive with `transformationIDs`.
	EventIDs param.Opt[string] `query:"eventIDs,omitzero" json:"-"`
	// Comma-separated list of transformation IDs to fetch results for. Between 1 and
	// 100 IDs per request. Mutually exclusive with `eventIDs`. Prefer `eventIDs` for
	// new integrations.
	TransformationIDs param.Opt[string] `query:"transformationIDs,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (EvalResultGetResultsParams) URLQuery added in v0.10.0

func (r EvalResultGetResultsParams) URLQuery() (v url.Values, err error)

URLQuery serializes EvalResultGetResultsParams's query parameters as `url.Values`.

type EvalResultService added in v0.10.0

type EvalResultService struct {
	// contains filtered or unexported fields
}

Monitor, evaluate, and iterate on the quality of every function in your environment. Function Accuracy bundles two complementary loops:

## Evaluations (`/v3/eval`)

Trigger and retrieve per-transformation evaluations. Evaluations run asynchronously and score each transformation's output against the function's schema for confidence, per-field hallucination detection, and relevance. Supported for `extract`, `transform`, `analyze`, and `join` events.

  1. **Trigger** — `POST /v3/eval` queues jobs for a batch of transformation IDs.
  2. **Poll** — `GET /v3/eval/results` returns the current state of each requested ID, partitioned into `results`, `pending`, and `failed`. Accepts either `eventIDs` (preferred) or `transformationIDs` as a comma-separated query parameter, and always keys the response by event KSUID.

Up to 100 IDs may be submitted per request.

## Metrics, review, regression (`/v3/functions/{metrics,review,regression,compare}`)

Roll evaluation results and user corrections up into actionable function-level signal:

  • **`GET /v3/functions/metrics`** — aggregate accuracy, precision, recall, F1, and confusion-matrix counts per function.
  • **`POST /v3/functions/review`** — sample-size estimation, confidence-bucketed distribution, PR-AUC, and per-threshold confidence intervals (Wald or Wilson) for picking review cutoffs.
  • **`POST /v3/functions/regression`** — replay corrected historical inputs against a new function version, producing a labeled regression dataset.
  • **`POST /v3/functions/regression/corrections`** — propagate baseline corrections onto the regression dataset so it can be scored.
  • **`POST /v3/functions/compare`** — compute aggregate and field-level lift between any two versions, optionally scoped to the regression dataset.

All five endpoints support `extract` end-to-end on both the vision and OCR paths, alongside the legacy `transform` / `analyze` / `join` types.

EvalResultService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEvalResultService method instead.

func NewEvalResultService added in v0.10.0

func NewEvalResultService(opts ...option.RequestOption) (r EvalResultService)

NewEvalResultService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EvalResultService) GetResults added in v0.10.0

**Fetch evaluation results for a batch of events.**

Pass either `eventIDs` (preferred — the externally-stable V3 identifier) or `transformationIDs` as a comma-separated query parameter. Exactly one of the two must be provided. Up to 100 IDs per request.

For each requested ID the response reports one of three states: a completed `result`, still-`pending`, or `failed`. Results, pending, and failed entries are all keyed by event KSUID regardless of which input form was used.

type EvalScoreCancelResponse added in v0.21.0

type EvalScoreCancelResponse struct {
	FunctionName       string `json:"functionName" api:"required"`
	FunctionVersionNum int64  `json:"functionVersionNum" api:"required"`
	// Comparator configuration. All fields optional; conservative defaults.
	MatchConfig EvalScoreCancelResponseMatchConfig `json:"matchConfig" api:"required"`
	// Per-pair results. `fieldResults` appears once a pair has been compared.
	PerPair []EvalScoreCancelResponsePerPair `json:"perPair" api:"required"`
	// Counts across all pairs.
	Progress   EvalScoreCancelResponseProgress `json:"progress" api:"required"`
	ScoreRunID string                          `json:"scoreRunID" api:"required"`
	// Status values for an eval-score run.
	//
	// Any of "pending", "initializing", "running", "completed", "error", "cancelled".
	Status EvalScoreCancelResponseStatus `json:"status" api:"required"`
	// Aggregate accuracy metrics.
	Aggregate EvalScoreCancelResponseAggregate `json:"aggregate"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FunctionName       respjson.Field
		FunctionVersionNum respjson.Field
		MatchConfig        respjson.Field
		PerPair            respjson.Field
		Progress           respjson.Field
		ScoreRunID         respjson.Field
		Status             respjson.Field
		Aggregate          respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Full status payload returned by `GET /v3/eval/score/{scoreRunID}`.

func (EvalScoreCancelResponse) RawJSON added in v0.21.0

func (r EvalScoreCancelResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvalScoreCancelResponse) UnmarshalJSON added in v0.21.0

func (r *EvalScoreCancelResponse) UnmarshalJSON(data []byte) error

type EvalScoreCancelResponseAggregate added in v0.21.0

type EvalScoreCancelResponseAggregate struct {
	ExactMatches        int64   `json:"exactMatches" api:"required"`
	Extras              int64   `json:"extras" api:"required"`
	F1                  float64 `json:"f1" api:"required"`
	FuzzyMatches        int64   `json:"fuzzyMatches" api:"required"`
	Misses              int64   `json:"misses" api:"required"`
	Precision           float64 `json:"precision" api:"required"`
	Recall              float64 `json:"recall" api:"required"`
	TotalFieldsActual   int64   `json:"totalFieldsActual" api:"required"`
	TotalFieldsExpected int64   `json:"totalFieldsExpected" api:"required"`
	WithinTolerance     int64   `json:"withinTolerance" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExactMatches        respjson.Field
		Extras              respjson.Field
		F1                  respjson.Field
		FuzzyMatches        respjson.Field
		Misses              respjson.Field
		Precision           respjson.Field
		Recall              respjson.Field
		TotalFieldsActual   respjson.Field
		TotalFieldsExpected respjson.Field
		WithinTolerance     respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Aggregate accuracy metrics.

func (EvalScoreCancelResponseAggregate) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EvalScoreCancelResponseAggregate) UnmarshalJSON added in v0.21.0

func (r *EvalScoreCancelResponseAggregate) UnmarshalJSON(data []byte) error

type EvalScoreCancelResponseMatchConfig added in v0.21.0

type EvalScoreCancelResponseMatchConfig struct {
	// P0 supports only `by-index`.
	//
	// Any of "by-index".
	ArrayMatch string `json:"arrayMatch"`
	// Levenshtein-ratio threshold used when `stringMatch == "fuzzy"`. Range `[0, 1]`.
	// Default `0.85`.
	FuzzyThreshold float64 `json:"fuzzyThreshold"`
	// JSON Pointer paths to skip during comparison. The asterisk character matches
	// arbitrary object keys / array indices.
	//
	// Example values: /metadata, /lineItems with asterisk segment, etc.
	IgnorePaths []string `json:"ignorePaths"`
	// Relative tolerance for numeric fields. `0` (default) means exact equality;
	// `0.01` means ±1%.
	NumericTolerance float64 `json:"numericTolerance"`
	// `exact` (default) or `fuzzy`.
	//
	// Any of "exact", "fuzzy".
	StringMatch string `json:"stringMatch"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ArrayMatch       respjson.Field
		FuzzyThreshold   respjson.Field
		IgnorePaths      respjson.Field
		NumericTolerance respjson.Field
		StringMatch      respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comparator configuration. All fields optional; conservative defaults.

func (EvalScoreCancelResponseMatchConfig) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EvalScoreCancelResponseMatchConfig) UnmarshalJSON added in v0.21.0

func (r *EvalScoreCancelResponseMatchConfig) UnmarshalJSON(data []byte) error

type EvalScoreCancelResponsePerPair added in v0.21.0

type EvalScoreCancelResponsePerPair struct {
	PairIndex int64 `json:"pairIndex" api:"required"`
	// Per-pair status.
	//
	// Any of "pending", "running", "completed", "failed".
	Status string `json:"status" api:"required"`
	// The function call that produced the actual output, if any.
	CallID string `json:"callID"`
	// Error message if the underlying function call failed.
	ErrorMessage string `json:"errorMessage"`
	// Per-leaf comparator output. Present only after the pair has been compared.
	FieldResults []EvalScoreCancelResponsePerPairFieldResult `json:"fieldResults"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		PairIndex    respjson.Field
		Status       respjson.Field
		CallID       respjson.Field
		ErrorMessage respjson.Field
		FieldResults respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Per-pair result.

func (EvalScoreCancelResponsePerPair) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EvalScoreCancelResponsePerPair) UnmarshalJSON added in v0.21.0

func (r *EvalScoreCancelResponsePerPair) UnmarshalJSON(data []byte) error

type EvalScoreCancelResponsePerPairFieldResult added in v0.21.0

type EvalScoreCancelResponsePerPairFieldResult struct {
	// Classification:
	//
	// - `exact`: both present and deep-equal
	// - `within_tolerance`: both numbers, within configured tolerance
	// - `fuzzy_match`: both strings, Levenshtein ratio above threshold
	// - `miss`: expected present, actual absent or different
	// - `extra`: actual present, expected absent
	//
	// Any of "exact", "within_tolerance", "fuzzy_match", "miss", "extra".
	Match string `json:"match" api:"required"`
	// JSON Pointer to the leaf.
	Path   string `json:"path" api:"required"`
	Actual any    `json:"actual"`
	// Populated for numeric comparisons; `actual - expected`.
	Delta    float64 `json:"delta"`
	Expected any     `json:"expected"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Match       respjson.Field
		Path        respjson.Field
		Actual      respjson.Field
		Delta       respjson.Field
		Expected    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

One leaf in `expected ∪ actual`.

func (EvalScoreCancelResponsePerPairFieldResult) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EvalScoreCancelResponsePerPairFieldResult) UnmarshalJSON added in v0.21.0

func (r *EvalScoreCancelResponsePerPairFieldResult) UnmarshalJSON(data []byte) error

type EvalScoreCancelResponseProgress added in v0.21.0

type EvalScoreCancelResponseProgress struct {
	Completed int64 `json:"completed" api:"required"`
	Failed    int64 `json:"failed" api:"required"`
	Total     int64 `json:"total" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Completed   respjson.Field
		Failed      respjson.Field
		Total       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Counts across all pairs.

func (EvalScoreCancelResponseProgress) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EvalScoreCancelResponseProgress) UnmarshalJSON added in v0.21.0

func (r *EvalScoreCancelResponseProgress) UnmarshalJSON(data []byte) error

type EvalScoreCancelResponseStatus added in v0.21.0

type EvalScoreCancelResponseStatus string

Status values for an eval-score run.

const (
	EvalScoreCancelResponseStatusPending      EvalScoreCancelResponseStatus = "pending"
	EvalScoreCancelResponseStatusInitializing EvalScoreCancelResponseStatus = "initializing"
	EvalScoreCancelResponseStatusRunning      EvalScoreCancelResponseStatus = "running"
	EvalScoreCancelResponseStatusCompleted    EvalScoreCancelResponseStatus = "completed"
	EvalScoreCancelResponseStatusError        EvalScoreCancelResponseStatus = "error"
	EvalScoreCancelResponseStatusCancelled    EvalScoreCancelResponseStatus = "cancelled"
)

type EvalScoreGetResponse added in v0.21.0

type EvalScoreGetResponse struct {
	FunctionName       string `json:"functionName" api:"required"`
	FunctionVersionNum int64  `json:"functionVersionNum" api:"required"`
	// Comparator configuration. All fields optional; conservative defaults.
	MatchConfig EvalScoreGetResponseMatchConfig `json:"matchConfig" api:"required"`
	// Per-pair results. `fieldResults` appears once a pair has been compared.
	PerPair []EvalScoreGetResponsePerPair `json:"perPair" api:"required"`
	// Counts across all pairs.
	Progress   EvalScoreGetResponseProgress `json:"progress" api:"required"`
	ScoreRunID string                       `json:"scoreRunID" api:"required"`
	// Status values for an eval-score run.
	//
	// Any of "pending", "initializing", "running", "completed", "error", "cancelled".
	Status EvalScoreGetResponseStatus `json:"status" api:"required"`
	// Aggregate accuracy metrics.
	Aggregate EvalScoreGetResponseAggregate `json:"aggregate"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FunctionName       respjson.Field
		FunctionVersionNum respjson.Field
		MatchConfig        respjson.Field
		PerPair            respjson.Field
		Progress           respjson.Field
		ScoreRunID         respjson.Field
		Status             respjson.Field
		Aggregate          respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Full status payload returned by `GET /v3/eval/score/{scoreRunID}`.

func (EvalScoreGetResponse) RawJSON added in v0.21.0

func (r EvalScoreGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvalScoreGetResponse) UnmarshalJSON added in v0.21.0

func (r *EvalScoreGetResponse) UnmarshalJSON(data []byte) error

type EvalScoreGetResponseAggregate added in v0.21.0

type EvalScoreGetResponseAggregate struct {
	ExactMatches        int64   `json:"exactMatches" api:"required"`
	Extras              int64   `json:"extras" api:"required"`
	F1                  float64 `json:"f1" api:"required"`
	FuzzyMatches        int64   `json:"fuzzyMatches" api:"required"`
	Misses              int64   `json:"misses" api:"required"`
	Precision           float64 `json:"precision" api:"required"`
	Recall              float64 `json:"recall" api:"required"`
	TotalFieldsActual   int64   `json:"totalFieldsActual" api:"required"`
	TotalFieldsExpected int64   `json:"totalFieldsExpected" api:"required"`
	WithinTolerance     int64   `json:"withinTolerance" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExactMatches        respjson.Field
		Extras              respjson.Field
		F1                  respjson.Field
		FuzzyMatches        respjson.Field
		Misses              respjson.Field
		Precision           respjson.Field
		Recall              respjson.Field
		TotalFieldsActual   respjson.Field
		TotalFieldsExpected respjson.Field
		WithinTolerance     respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Aggregate accuracy metrics.

func (EvalScoreGetResponseAggregate) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EvalScoreGetResponseAggregate) UnmarshalJSON added in v0.21.0

func (r *EvalScoreGetResponseAggregate) UnmarshalJSON(data []byte) error

type EvalScoreGetResponseMatchConfig added in v0.21.0

type EvalScoreGetResponseMatchConfig struct {
	// P0 supports only `by-index`.
	//
	// Any of "by-index".
	ArrayMatch string `json:"arrayMatch"`
	// Levenshtein-ratio threshold used when `stringMatch == "fuzzy"`. Range `[0, 1]`.
	// Default `0.85`.
	FuzzyThreshold float64 `json:"fuzzyThreshold"`
	// JSON Pointer paths to skip during comparison. The asterisk character matches
	// arbitrary object keys / array indices.
	//
	// Example values: /metadata, /lineItems with asterisk segment, etc.
	IgnorePaths []string `json:"ignorePaths"`
	// Relative tolerance for numeric fields. `0` (default) means exact equality;
	// `0.01` means ±1%.
	NumericTolerance float64 `json:"numericTolerance"`
	// `exact` (default) or `fuzzy`.
	//
	// Any of "exact", "fuzzy".
	StringMatch string `json:"stringMatch"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ArrayMatch       respjson.Field
		FuzzyThreshold   respjson.Field
		IgnorePaths      respjson.Field
		NumericTolerance respjson.Field
		StringMatch      respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comparator configuration. All fields optional; conservative defaults.

func (EvalScoreGetResponseMatchConfig) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EvalScoreGetResponseMatchConfig) UnmarshalJSON added in v0.21.0

func (r *EvalScoreGetResponseMatchConfig) UnmarshalJSON(data []byte) error

type EvalScoreGetResponsePerPair added in v0.21.0

type EvalScoreGetResponsePerPair struct {
	PairIndex int64 `json:"pairIndex" api:"required"`
	// Per-pair status.
	//
	// Any of "pending", "running", "completed", "failed".
	Status string `json:"status" api:"required"`
	// The function call that produced the actual output, if any.
	CallID string `json:"callID"`
	// Error message if the underlying function call failed.
	ErrorMessage string `json:"errorMessage"`
	// Per-leaf comparator output. Present only after the pair has been compared.
	FieldResults []EvalScoreGetResponsePerPairFieldResult `json:"fieldResults"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		PairIndex    respjson.Field
		Status       respjson.Field
		CallID       respjson.Field
		ErrorMessage respjson.Field
		FieldResults respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Per-pair result.

func (EvalScoreGetResponsePerPair) RawJSON added in v0.21.0

func (r EvalScoreGetResponsePerPair) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvalScoreGetResponsePerPair) UnmarshalJSON added in v0.21.0

func (r *EvalScoreGetResponsePerPair) UnmarshalJSON(data []byte) error

type EvalScoreGetResponsePerPairFieldResult added in v0.21.0

type EvalScoreGetResponsePerPairFieldResult struct {
	// Classification:
	//
	// - `exact`: both present and deep-equal
	// - `within_tolerance`: both numbers, within configured tolerance
	// - `fuzzy_match`: both strings, Levenshtein ratio above threshold
	// - `miss`: expected present, actual absent or different
	// - `extra`: actual present, expected absent
	//
	// Any of "exact", "within_tolerance", "fuzzy_match", "miss", "extra".
	Match string `json:"match" api:"required"`
	// JSON Pointer to the leaf.
	Path   string `json:"path" api:"required"`
	Actual any    `json:"actual"`
	// Populated for numeric comparisons; `actual - expected`.
	Delta    float64 `json:"delta"`
	Expected any     `json:"expected"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Match       respjson.Field
		Path        respjson.Field
		Actual      respjson.Field
		Delta       respjson.Field
		Expected    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

One leaf in `expected ∪ actual`.

func (EvalScoreGetResponsePerPairFieldResult) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EvalScoreGetResponsePerPairFieldResult) UnmarshalJSON added in v0.21.0

func (r *EvalScoreGetResponsePerPairFieldResult) UnmarshalJSON(data []byte) error

type EvalScoreGetResponseProgress added in v0.21.0

type EvalScoreGetResponseProgress struct {
	Completed int64 `json:"completed" api:"required"`
	Failed    int64 `json:"failed" api:"required"`
	Total     int64 `json:"total" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Completed   respjson.Field
		Failed      respjson.Field
		Total       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Counts across all pairs.

func (EvalScoreGetResponseProgress) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*EvalScoreGetResponseProgress) UnmarshalJSON added in v0.21.0

func (r *EvalScoreGetResponseProgress) UnmarshalJSON(data []byte) error

type EvalScoreGetResponseStatus added in v0.21.0

type EvalScoreGetResponseStatus string

Status values for an eval-score run.

const (
	EvalScoreGetResponseStatusPending      EvalScoreGetResponseStatus = "pending"
	EvalScoreGetResponseStatusInitializing EvalScoreGetResponseStatus = "initializing"
	EvalScoreGetResponseStatusRunning      EvalScoreGetResponseStatus = "running"
	EvalScoreGetResponseStatusCompleted    EvalScoreGetResponseStatus = "completed"
	EvalScoreGetResponseStatusError        EvalScoreGetResponseStatus = "error"
	EvalScoreGetResponseStatusCancelled    EvalScoreGetResponseStatus = "cancelled"
)

type EvalScoreNewParams added in v0.21.0

type EvalScoreNewParams struct {
	// Name of the function to score. Must be of type extract, transform, or analyze.
	FunctionName string `json:"functionName" api:"required"`
	// Up to 1000 pairs per request.
	Pairs []EvalScoreNewParamsPair `json:"pairs,omitzero" api:"required"`
	// Optional version number to score against. P0: only the function's current
	// version is accepted; passing a different version returns 422.
	FunctionVersionNum param.Opt[int64] `json:"functionVersionNum,omitzero"`
	// Comparator configuration. All fields optional; conservative defaults.
	MatchConfig EvalScoreNewParamsMatchConfig `json:"matchConfig,omitzero"`
	// contains filtered or unexported fields
}

func (EvalScoreNewParams) MarshalJSON added in v0.21.0

func (r EvalScoreNewParams) MarshalJSON() (data []byte, err error)

func (*EvalScoreNewParams) UnmarshalJSON added in v0.21.0

func (r *EvalScoreNewParams) UnmarshalJSON(data []byte) error

type EvalScoreNewParamsMatchConfig added in v0.21.0

type EvalScoreNewParamsMatchConfig struct {
	// Levenshtein-ratio threshold used when `stringMatch == "fuzzy"`. Range `[0, 1]`.
	// Default `0.85`.
	FuzzyThreshold param.Opt[float64] `json:"fuzzyThreshold,omitzero"`
	// Relative tolerance for numeric fields. `0` (default) means exact equality;
	// `0.01` means ±1%.
	NumericTolerance param.Opt[float64] `json:"numericTolerance,omitzero"`
	// P0 supports only `by-index`.
	//
	// Any of "by-index".
	ArrayMatch string `json:"arrayMatch,omitzero"`
	// JSON Pointer paths to skip during comparison. The asterisk character matches
	// arbitrary object keys / array indices.
	//
	// Example values: /metadata, /lineItems with asterisk segment, etc.
	IgnorePaths []string `json:"ignorePaths,omitzero"`
	// `exact` (default) or `fuzzy`.
	//
	// Any of "exact", "fuzzy".
	StringMatch string `json:"stringMatch,omitzero"`
	// contains filtered or unexported fields
}

Comparator configuration. All fields optional; conservative defaults.

func (EvalScoreNewParamsMatchConfig) MarshalJSON added in v0.21.0

func (r EvalScoreNewParamsMatchConfig) MarshalJSON() (data []byte, err error)

func (*EvalScoreNewParamsMatchConfig) UnmarshalJSON added in v0.21.0

func (r *EvalScoreNewParamsMatchConfig) UnmarshalJSON(data []byte) error

type EvalScoreNewParamsPair added in v0.21.0

type EvalScoreNewParamsPair struct {
	// Expected output for this input, as a JSON value. The comparator walks
	// `expected ∪ actual` and produces a per-leaf classification.
	Expected any `json:"expected,omitzero" api:"required"`
	// A single file input with base64-encoded content.
	//
	// When using the Bem CLI, use `@path/to/file` in the `inputContent` field to
	// automatically read and base64-encode the file:
	// `--input.single-file '{"inputContent": "@file.pdf", "inputType": "pdf"}' --wait`
	Input EvalScoreNewParamsPairInput `json:"input,omitzero" api:"required"`
	// contains filtered or unexported fields
}

One `(input, expected)` pair.

The properties Expected, Input are required.

func (EvalScoreNewParamsPair) MarshalJSON added in v0.21.0

func (r EvalScoreNewParamsPair) MarshalJSON() (data []byte, err error)

func (*EvalScoreNewParamsPair) UnmarshalJSON added in v0.21.0

func (r *EvalScoreNewParamsPair) UnmarshalJSON(data []byte) error

type EvalScoreNewParamsPairInput added in v0.21.0

type EvalScoreNewParamsPairInput struct {
	// Base64-encoded file content. In the Bem CLI, use `@path/to/file` to embed file
	// contents automatically.
	InputContent string `json:"inputContent" api:"required"`
	// The input type of the content you're sending for transformation.
	//
	// Any of "csv", "docx", "email", "heic", "html", "jpeg", "json", "heif", "m4a",
	// "mp3", "pdf", "png", "text", "wav", "webp", "xls", "xlsx", "xml".
	InputType InputType `json:"inputType,omitzero" api:"required"`
	// contains filtered or unexported fields
}

A single file input with base64-encoded content.

When using the Bem CLI, use `@path/to/file` in the `inputContent` field to automatically read and base64-encode the file: `--input.single-file '{"inputContent": "@file.pdf", "inputType": "pdf"}' --wait`

The properties InputContent, InputType are required.

func (EvalScoreNewParamsPairInput) MarshalJSON added in v0.21.0

func (r EvalScoreNewParamsPairInput) MarshalJSON() (data []byte, err error)

func (*EvalScoreNewParamsPairInput) UnmarshalJSON added in v0.21.0

func (r *EvalScoreNewParamsPairInput) UnmarshalJSON(data []byte) error

type EvalScoreNewResponse added in v0.21.0

type EvalScoreNewResponse struct {
	// Run identifier. Use with `GET /v3/eval/score/{scoreRunID}`.
	ScoreRunID string `json:"scoreRunID" api:"required"`
	// Status values for an eval-score run.
	//
	// Any of "pending", "initializing", "running", "completed", "error", "cancelled".
	Status EvalScoreNewResponseStatus `json:"status" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ScoreRunID  respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Returned by `POST /v3/eval/score`.

func (EvalScoreNewResponse) RawJSON added in v0.21.0

func (r EvalScoreNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvalScoreNewResponse) UnmarshalJSON added in v0.21.0

func (r *EvalScoreNewResponse) UnmarshalJSON(data []byte) error

type EvalScoreNewResponseStatus added in v0.21.0

type EvalScoreNewResponseStatus string

Status values for an eval-score run.

const (
	EvalScoreNewResponseStatusPending      EvalScoreNewResponseStatus = "pending"
	EvalScoreNewResponseStatusInitializing EvalScoreNewResponseStatus = "initializing"
	EvalScoreNewResponseStatusRunning      EvalScoreNewResponseStatus = "running"
	EvalScoreNewResponseStatusCompleted    EvalScoreNewResponseStatus = "completed"
	EvalScoreNewResponseStatusError        EvalScoreNewResponseStatus = "error"
	EvalScoreNewResponseStatusCancelled    EvalScoreNewResponseStatus = "cancelled"
)

type EvalScoreService added in v0.21.0

type EvalScoreService struct {
	// contains filtered or unexported fields
}

Monitor, evaluate, and iterate on the quality of every function in your environment. Function Accuracy bundles two complementary loops:

## Evaluations (`/v3/eval`)

Trigger and retrieve per-transformation evaluations. Evaluations run asynchronously and score each transformation's output against the function's schema for confidence, per-field hallucination detection, and relevance. Supported for `extract`, `transform`, `analyze`, and `join` events.

  1. **Trigger** — `POST /v3/eval` queues jobs for a batch of transformation IDs.
  2. **Poll** — `GET /v3/eval/results` returns the current state of each requested ID, partitioned into `results`, `pending`, and `failed`. Accepts either `eventIDs` (preferred) or `transformationIDs` as a comma-separated query parameter, and always keys the response by event KSUID.

Up to 100 IDs may be submitted per request.

## Metrics, review, regression (`/v3/functions/{metrics,review,regression,compare}`)

Roll evaluation results and user corrections up into actionable function-level signal:

  • **`GET /v3/functions/metrics`** — aggregate accuracy, precision, recall, F1, and confusion-matrix counts per function.
  • **`POST /v3/functions/review`** — sample-size estimation, confidence-bucketed distribution, PR-AUC, and per-threshold confidence intervals (Wald or Wilson) for picking review cutoffs.
  • **`POST /v3/functions/regression`** — replay corrected historical inputs against a new function version, producing a labeled regression dataset.
  • **`POST /v3/functions/regression/corrections`** — propagate baseline corrections onto the regression dataset so it can be scored.
  • **`POST /v3/functions/compare`** — compute aggregate and field-level lift between any two versions, optionally scoped to the regression dataset.

All five endpoints support `extract` end-to-end on both the vision and OCR paths, alongside the legacy `transform` / `analyze` / `join` types.

EvalScoreService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEvalScoreService method instead.

func NewEvalScoreService added in v0.21.0

func NewEvalScoreService(opts ...option.RequestOption) (r EvalScoreService)

NewEvalScoreService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EvalScoreService) Cancel added in v0.21.0

func (r *EvalScoreService) Cancel(ctx context.Context, scoreRunID string, opts ...option.RequestOption) (res *EvalScoreCancelResponse, err error)

**Cancel an in-flight score run.**

Transitions the run to `cancelled`. Function calls already in flight are allowed to finish (best-effort cancellation via the job queue); results from completed pairs may still appear in subsequent GETs.

func (*EvalScoreService) Get added in v0.21.0

func (r *EvalScoreService) Get(ctx context.Context, scoreRunID string, opts ...option.RequestOption) (res *EvalScoreGetResponse, err error)

**Get the status and per-pair results of a score run.**

Returns `aggregate` only once `status` reaches `completed`. `perPair` is populated incrementally — each pair's `fieldResults` appears as its underlying function call terminates.

func (*EvalScoreService) New added in v0.21.0

**Score a function against a list of (input, expected) pairs.**

Submits a batch of `(input, expected)` pairs, runs the named function over each input, and returns per-pair + aggregate accuracy metrics comparing the function's actual output to the provided expected JSON.

Scoring runs asynchronously. The response carries a `scoreRunID`; poll `GET /v3/eval/score/{scoreRunID}` until `status` is one of `completed`, `error`, or `cancelled`.

`matchConfig` controls comparator behavior:

- `numericTolerance`: relative tolerance for numeric fields (0 = exact) - `stringMatch`: `exact` (default) or `fuzzy` (Levenshtein ratio) - `arrayMatch`: `by-index` (default; only mode in P0) - `ignorePaths`: JSON Pointer paths to skip, supports `*` wildcards

type EvalService added in v0.10.0

type EvalService struct {

	// Monitor, evaluate, and iterate on the quality of every function in your
	// environment. Function Accuracy bundles two complementary loops:
	//
	// ## Evaluations (`/v3/eval`)
	//
	// Trigger and retrieve per-transformation evaluations. Evaluations run
	// asynchronously and score each transformation's output against the function's
	// schema for confidence, per-field hallucination detection, and relevance.
	// Supported for `extract`, `transform`, `analyze`, and `join` events.
	//
	//  1. **Trigger** — `POST /v3/eval` queues jobs for a batch of transformation IDs.
	//  2. **Poll** — `GET /v3/eval/results` returns the current state of each requested
	//     ID, partitioned into `results`, `pending`, and `failed`. Accepts either
	//     `eventIDs` (preferred) or `transformationIDs` as a comma-separated query
	//     parameter, and always keys the response by event KSUID.
	//
	// Up to 100 IDs may be submitted per request.
	//
	// ## Metrics, review, regression (`/v3/functions/{metrics,review,regression,compare}`)
	//
	// Roll evaluation results and user corrections up into actionable function-level
	// signal:
	//
	//   - **`GET /v3/functions/metrics`** — aggregate accuracy, precision, recall, F1,
	//     and confusion-matrix counts per function.
	//   - **`POST /v3/functions/review`** — sample-size estimation, confidence-bucketed
	//     distribution, PR-AUC, and per-threshold confidence intervals (Wald or Wilson)
	//     for picking review cutoffs.
	//   - **`POST /v3/functions/regression`** — replay corrected historical inputs
	//     against a new function version, producing a labeled regression dataset.
	//   - **`POST /v3/functions/regression/corrections`** — propagate baseline
	//     corrections onto the regression dataset so it can be scored.
	//   - **`POST /v3/functions/compare`** — compute aggregate and field-level lift
	//     between any two versions, optionally scoped to the regression dataset.
	//
	// All five endpoints support `extract` end-to-end on both the vision and OCR
	// paths, alongside the legacy `transform` / `analyze` / `join` types.
	Results EvalResultService
	// Monitor, evaluate, and iterate on the quality of every function in your
	// environment. Function Accuracy bundles two complementary loops:
	//
	// ## Evaluations (`/v3/eval`)
	//
	// Trigger and retrieve per-transformation evaluations. Evaluations run
	// asynchronously and score each transformation's output against the function's
	// schema for confidence, per-field hallucination detection, and relevance.
	// Supported for `extract`, `transform`, `analyze`, and `join` events.
	//
	//  1. **Trigger** — `POST /v3/eval` queues jobs for a batch of transformation IDs.
	//  2. **Poll** — `GET /v3/eval/results` returns the current state of each requested
	//     ID, partitioned into `results`, `pending`, and `failed`. Accepts either
	//     `eventIDs` (preferred) or `transformationIDs` as a comma-separated query
	//     parameter, and always keys the response by event KSUID.
	//
	// Up to 100 IDs may be submitted per request.
	//
	// ## Metrics, review, regression (`/v3/functions/{metrics,review,regression,compare}`)
	//
	// Roll evaluation results and user corrections up into actionable function-level
	// signal:
	//
	//   - **`GET /v3/functions/metrics`** — aggregate accuracy, precision, recall, F1,
	//     and confusion-matrix counts per function.
	//   - **`POST /v3/functions/review`** — sample-size estimation, confidence-bucketed
	//     distribution, PR-AUC, and per-threshold confidence intervals (Wald or Wilson)
	//     for picking review cutoffs.
	//   - **`POST /v3/functions/regression`** — replay corrected historical inputs
	//     against a new function version, producing a labeled regression dataset.
	//   - **`POST /v3/functions/regression/corrections`** — propagate baseline
	//     corrections onto the regression dataset so it can be scored.
	//   - **`POST /v3/functions/compare`** — compute aggregate and field-level lift
	//     between any two versions, optionally scoped to the regression dataset.
	//
	// All five endpoints support `extract` end-to-end on both the vision and OCR
	// paths, alongside the legacy `transform` / `analyze` / `join` types.
	Score EvalScoreService
	// contains filtered or unexported fields
}

Monitor, evaluate, and iterate on the quality of every function in your environment. Function Accuracy bundles two complementary loops:

## Evaluations (`/v3/eval`)

Trigger and retrieve per-transformation evaluations. Evaluations run asynchronously and score each transformation's output against the function's schema for confidence, per-field hallucination detection, and relevance. Supported for `extract`, `transform`, `analyze`, and `join` events.

  1. **Trigger** — `POST /v3/eval` queues jobs for a batch of transformation IDs.
  2. **Poll** — `GET /v3/eval/results` returns the current state of each requested ID, partitioned into `results`, `pending`, and `failed`. Accepts either `eventIDs` (preferred) or `transformationIDs` as a comma-separated query parameter, and always keys the response by event KSUID.

Up to 100 IDs may be submitted per request.

## Metrics, review, regression (`/v3/functions/{metrics,review,regression,compare}`)

Roll evaluation results and user corrections up into actionable function-level signal:

  • **`GET /v3/functions/metrics`** — aggregate accuracy, precision, recall, F1, and confusion-matrix counts per function.
  • **`POST /v3/functions/review`** — sample-size estimation, confidence-bucketed distribution, PR-AUC, and per-threshold confidence intervals (Wald or Wilson) for picking review cutoffs.
  • **`POST /v3/functions/regression`** — replay corrected historical inputs against a new function version, producing a labeled regression dataset.
  • **`POST /v3/functions/regression/corrections`** — propagate baseline corrections onto the regression dataset so it can be scored.
  • **`POST /v3/functions/compare`** — compute aggregate and field-level lift between any two versions, optionally scoped to the regression dataset.

All five endpoints support `extract` end-to-end on both the vision and OCR paths, alongside the legacy `transform` / `analyze` / `join` types.

EvalService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEvalService method instead.

func NewEvalService added in v0.10.0

func NewEvalService(opts ...option.RequestOption) (r EvalService)

NewEvalService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EvalService) TriggerEvaluation added in v0.10.0

**Queue evaluation jobs for a batch of transformations.**

Evaluations run asynchronously and score each transformation's output against the function's schema for confidence, hallucination detection, and relevance. Transformations must belong to events of a supported type: `extract`, `transform`, `analyze`, or `join`.

Returns immediately with a summary of queued vs. skipped transformations and per-transformation errors. Poll `GET /v3/eval/results` to retrieve results once evaluations complete.

type EvalTriggerEvaluationParams added in v0.10.0

type EvalTriggerEvaluationParams struct {
	// Transformation IDs to evaluate. Up to 100 per request.
	TransformationIDs []string `json:"transformationIDs,omitzero" api:"required"`
	// Optional evaluation version (e.g. `0.1.0-gemini`). When omitted the server's
	// default evaluation version is used.
	EvaluationVersion param.Opt[string] `json:"evaluationVersion,omitzero"`
	// contains filtered or unexported fields
}

func (EvalTriggerEvaluationParams) MarshalJSON added in v0.10.0

func (r EvalTriggerEvaluationParams) MarshalJSON() (data []byte, err error)

func (*EvalTriggerEvaluationParams) UnmarshalJSON added in v0.10.0

func (r *EvalTriggerEvaluationParams) UnmarshalJSON(data []byte) error

type EvalTriggerEvaluationResponse added in v0.10.0

type EvalTriggerEvaluationResponse struct {
	// Number of evaluation jobs newly queued.
	Queued int64 `json:"queued" api:"required"`
	// Number of transformations skipped because an evaluation job was already pending
	// or already completed for them.
	Skipped int64 `json:"skipped" api:"required"`
	// Map of transformation ID to human-readable error message for any transformations
	// that could not be queued (e.g. not found, unsupported event type).
	Errors any `json:"errors"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Queued      respjson.Field
		Skipped     respjson.Field
		Errors      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Summary of the trigger call. Evaluations run asynchronously; use `GET /v3/eval/results` to poll for results.

func (EvalTriggerEvaluationResponse) RawJSON added in v0.10.0

Returns the unmodified JSON received from the API

func (*EvalTriggerEvaluationResponse) UnmarshalJSON added in v0.10.0

func (r *EvalTriggerEvaluationResponse) UnmarshalJSON(data []byte) error

type EvaluationResults added in v0.14.0

type EvaluationResults struct {
	// Completed evaluation results, keyed by event KSUID.
	//
	// An event appears here only if its evaluation completed successfully.
	// Still-running evaluations appear in `pending`; failed evaluations appear in
	// `failed`.
	Results any `json:"results" api:"required"`
	// Reserved map of event KSUID to error message for validation failures on the
	// request itself. Populated only in edge cases.
	Errors any `json:"errors"`
	// Events whose evaluation failed or was not found.
	Failed []EvaluationResultsFailed `json:"failed"`
	// Events whose evaluation is still running.
	Pending []EvaluationResultsPending `json:"pending"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Results     respjson.Field
		Errors      respjson.Field
		Failed      respjson.Field
		Pending     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Batched response containing the evaluation state for every requested ID, partitioned into completed `results`, still-running `pending`, and terminal `failed` groups. All identifiers in the response are event KSUIDs regardless of whether the request used `eventIDs` or `transformationIDs`.

func (EvaluationResults) RawJSON added in v0.14.0

func (r EvaluationResults) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvaluationResults) UnmarshalJSON added in v0.14.0

func (r *EvaluationResults) UnmarshalJSON(data []byte) error

type EvaluationResultsFailed added in v0.14.0

type EvaluationResultsFailed struct {
	// Server timestamp associated with the failure.
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Human-readable failure reason.
	ErrorMessage string `json:"errorMessage" api:"required"`
	// Event KSUID.
	EventID string `json:"eventID" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt    respjson.Field
		ErrorMessage respjson.Field
		EventID      respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An event whose evaluation failed or was not found.

func (EvaluationResultsFailed) RawJSON added in v0.14.0

func (r EvaluationResultsFailed) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvaluationResultsFailed) UnmarshalJSON added in v0.14.0

func (r *EvaluationResultsFailed) UnmarshalJSON(data []byte) error

type EvaluationResultsPending added in v0.14.0

type EvaluationResultsPending struct {
	// Server timestamp when the evaluation was queued.
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Event KSUID.
	EventID string `json:"eventID" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		EventID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An event whose evaluation is still running.

func (EvaluationResultsPending) RawJSON added in v0.14.0

func (r EvaluationResultsPending) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvaluationResultsPending) UnmarshalJSON added in v0.14.0

func (r *EvaluationResultsPending) UnmarshalJSON(data []byte) error

type EvaluationWebhookEvent added in v0.14.0

type EvaluationWebhookEvent struct {
	// Version identifier of the evaluation logic that produced this result.
	EvaluationVersion string `json:"evaluationVersion" api:"required"`
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Evaluator output. Shape depends on `evaluationVersion` and includes confidence
	// scores, per-field hallucination flags, and relevance metrics.
	Result any `json:"result" api:"required"`
	// Terminal status of the evaluation run.
	//
	// Any of "success", "failed".
	Status EvaluationWebhookEventStatus `json:"status" api:"required"`
	// Unique ID of the transformation that was evaluated.
	TransformID string `json:"transformId" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Failure reason populated when `status` is `failed`.
	ErrorMessage string `json:"errorMessage"`
	// Any of "evaluation".
	EventType EvaluationWebhookEventEventType `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent              `json:"inboundEmail"`
	Metadata     EvaluationWebhookEventMetadata `json:"metadata"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EvaluationVersion     respjson.Field
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ReferenceID           respjson.Field
		Result                respjson.Field
		Status                respjson.Field
		TransformID           respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		ErrorMessage          respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a function-accuracy evaluation completes for a transformation. Evaluations are scheduled by `POST /v3/eval` and run asynchronously; this event reports the terminal result.

func (EvaluationWebhookEvent) RawJSON added in v0.14.0

func (r EvaluationWebhookEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvaluationWebhookEvent) UnmarshalJSON added in v0.14.0

func (r *EvaluationWebhookEvent) UnmarshalJSON(data []byte) error

type EvaluationWebhookEventEventType added in v0.14.0

type EvaluationWebhookEventEventType string
const (
	EvaluationWebhookEventEventTypeEvaluation EvaluationWebhookEventEventType = "evaluation"
)

type EvaluationWebhookEventMetadata added in v0.14.0

type EvaluationWebhookEventMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvaluationWebhookEventMetadata) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*EvaluationWebhookEventMetadata) UnmarshalJSON added in v0.14.0

func (r *EvaluationWebhookEventMetadata) UnmarshalJSON(data []byte) error

type EvaluationWebhookEventStatus added in v0.14.0

type EvaluationWebhookEventStatus string

Terminal status of the evaluation run.

const (
	EvaluationWebhookEventStatusSuccess EvaluationWebhookEventStatus = "success"
	EvaluationWebhookEventStatusFailed  EvaluationWebhookEventStatus = "failed"
)

type EventAnalyze added in v0.14.0

type EventAnalyze struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// List of properties that were invalid in the input.
	InvalidProperties []string `json:"invalidProperties" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// The extracted content of the input. The structure of this object is defined by
	// the function's `outputSchema`.
	TransformedContent any `json:"transformedContent" api:"required"`
	// Average confidence score across all extracted fields, in the range [0, 1].
	AvgConfidence float64 `json:"avgConfidence" api:"nullable"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "analyze".
	EventType string `json:"eventType"`
	// Per-field bounding boxes. A JSON object mapping RFC 6901 JSON Pointer paths
	// (e.g. `"/invoiceNumber"`, `"/items/0/price"`) to the document regions from which
	// each extracted value was sourced.
	FieldBoundingBoxes any `json:"fieldBoundingBoxes"`
	// Per-field confidence scores. A JSON object mapping RFC 6901 JSON Pointer paths
	// to float values in the range [0, 1] indicating the model's confidence in each
	// extracted field value.
	FieldConfidences any `json:"fieldConfidences"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent    `json:"inboundEmail"`
	Metadata     EventAnalyzeMetadata `json:"metadata"`
	// Presigned S3 URL of the input file that was analyzed.
	S3URL string `json:"s3URL" api:"nullable"`
	// Unique ID for each transformation output generated by bem following Segment's
	// KSUID conventions.
	TransformationID string `json:"transformationID" api:"nullable"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		InvalidProperties     respjson.Field
		ReferenceID           respjson.Field
		TransformedContent    respjson.Field
		AvgConfidence         respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FieldBoundingBoxes    respjson.Field
		FieldConfidences      respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		S3URL                 respjson.Field
		TransformationID      respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted by functions of the legacy `analyze` type (the vision path predecessor of `extract`). Carries the extracted JSON along with per-field bounding-box metadata identifying the document regions each value was extracted from.

func (EventAnalyze) RawJSON added in v0.14.0

func (r EventAnalyze) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventAnalyze) UnmarshalJSON added in v0.14.0

func (r *EventAnalyze) UnmarshalJSON(data []byte) error

type EventAnalyzeMetadata added in v0.14.0

type EventAnalyzeMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventAnalyzeMetadata) RawJSON added in v0.14.0

func (r EventAnalyzeMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventAnalyzeMetadata) UnmarshalJSON added in v0.14.0

func (r *EventAnalyzeMetadata) UnmarshalJSON(data []byte) error

type EventClassify added in v0.10.0

type EventClassify struct {
	// The classification chosen by the classify function.
	Choice string `json:"choice" api:"required"`
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "classify".
	EventType string `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent     `json:"inboundEmail"`
	Metadata     EventClassifyMetadata `json:"metadata"`
	// The presigned S3 URL of the file that was classified.
	S3URL string `json:"s3URL"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Choice                respjson.Field
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ReferenceID           respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		S3URL                 respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventClassify) RawJSON added in v0.10.0

func (r EventClassify) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventClassify) UnmarshalJSON added in v0.10.0

func (r *EventClassify) UnmarshalJSON(data []byte) error

type EventClassifyMetadata added in v0.10.0

type EventClassifyMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventClassifyMetadata) RawJSON added in v0.10.0

func (r EventClassifyMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventClassifyMetadata) UnmarshalJSON added in v0.10.0

func (r *EventClassifyMetadata) UnmarshalJSON(data []byte) error

type EventCollectionProcessing

type EventCollectionProcessing struct {
	// Unique identifier of the collection.
	CollectionID string `json:"collectionID" api:"required"`
	// Name/path of the collection.
	CollectionName string `json:"collectionName" api:"required"`
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// The operation performed (add or update).
	//
	// Any of "add", "update".
	Operation string `json:"operation" api:"required"`
	// Number of items successfully processed.
	ProcessedCount int64 `json:"processedCount" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Processing status (success or failed).
	//
	// Any of "success", "failed".
	Status string `json:"status" api:"required"`
	// Array of collection item KSUIDs that were added or updated.
	CollectionItemIDs []string `json:"collectionItemIDs"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Error message if processing failed.
	ErrorMessage string `json:"errorMessage"`
	// Any of "collection_processing".
	EventType string `json:"eventType"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent                 `json:"inboundEmail"`
	Metadata     EventCollectionProcessingMetadata `json:"metadata"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CollectionID          respjson.Field
		CollectionName        respjson.Field
		EventID               respjson.Field
		Operation             respjson.Field
		ProcessedCount        respjson.Field
		ReferenceID           respjson.Field
		Status                respjson.Field
		CollectionItemIDs     respjson.Field
		CreatedAt             respjson.Field
		ErrorMessage          respjson.Field
		EventType             respjson.Field
		FunctionCallTryNumber respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventCollectionProcessing) RawJSON

func (r EventCollectionProcessing) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventCollectionProcessing) UnmarshalJSON

func (r *EventCollectionProcessing) UnmarshalJSON(data []byte) error

type EventCollectionProcessingMetadata

type EventCollectionProcessingMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventCollectionProcessingMetadata) RawJSON

Returns the unmodified JSON received from the API

func (*EventCollectionProcessingMetadata) UnmarshalJSON

func (r *EventCollectionProcessingMetadata) UnmarshalJSON(data []byte) error

type EventEnrich

type EventEnrich struct {
	// The enriched content produced by the enrich function. Contains the input data
	// augmented with results from semantic search against collections.
	EnrichedContent any `json:"enrichedContent" api:"required"`
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "enrich".
	EventType string `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent   `json:"inboundEmail"`
	Metadata     EventEnrichMetadata `json:"metadata"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EnrichedContent       respjson.Field
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ReferenceID           respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventEnrich) RawJSON

func (r EventEnrich) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventEnrich) UnmarshalJSON

func (r *EventEnrich) UnmarshalJSON(data []byte) error

type EventEnrichMetadata

type EventEnrichMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventEnrichMetadata) RawJSON

func (r EventEnrichMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventEnrichMetadata) UnmarshalJSON

func (r *EventEnrichMetadata) UnmarshalJSON(data []byte) error

type EventEvaluation added in v0.14.0

type EventEvaluation struct {
	// Version identifier of the evaluation logic that produced this result.
	EvaluationVersion string `json:"evaluationVersion" api:"required"`
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Evaluator output. Shape depends on `evaluationVersion` and includes confidence
	// scores, per-field hallucination flags, and relevance metrics.
	Result any `json:"result" api:"required"`
	// Terminal status of the evaluation run.
	//
	// Any of "success", "failed".
	Status string `json:"status" api:"required"`
	// Unique ID of the transformation that was evaluated.
	TransformID string `json:"transformId" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Failure reason populated when `status` is `failed`.
	ErrorMessage string `json:"errorMessage"`
	// Any of "evaluation".
	EventType string `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent       `json:"inboundEmail"`
	Metadata     EventEvaluationMetadata `json:"metadata"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EvaluationVersion     respjson.Field
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ReferenceID           respjson.Field
		Result                respjson.Field
		Status                respjson.Field
		TransformID           respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		ErrorMessage          respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a function-accuracy evaluation completes for a transformation. Evaluations are scheduled by `POST /v3/eval` and run asynchronously; this event reports the terminal result.

func (EventEvaluation) RawJSON added in v0.14.0

func (r EventEvaluation) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventEvaluation) UnmarshalJSON added in v0.14.0

func (r *EventEvaluation) UnmarshalJSON(data []byte) error

type EventEvaluationMetadata added in v0.14.0

type EventEvaluationMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventEvaluationMetadata) RawJSON added in v0.14.0

func (r EventEvaluationMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventEvaluationMetadata) UnmarshalJSON added in v0.14.0

func (r *EventEvaluationMetadata) UnmarshalJSON(data []byte) error

type EventExtract added in v0.10.0

type EventExtract struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The number of items that were transformed. Used for batch transformations to
	// indicate how many items were transformed.
	ItemCount int64 `json:"itemCount" api:"required"`
	// The offset of the first item that was transformed. Used for batch
	// transformations to indicate which item in the batch this event corresponds to.
	ItemOffset int64 `json:"itemOffset" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// The transformed content of the input. The structure of this object is defined by
	// the function configuration.
	TransformedContent any `json:"transformedContent" api:"required"`
	// Average confidence score across all extracted fields, in the range [0, 1].
	AvgConfidence float64 `json:"avgConfidence" api:"nullable"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Corrected feedback provided for fine-tuning purposes.
	CorrectedContent EventExtractCorrectedContentUnion `json:"correctedContent" api:"nullable"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "extract".
	EventType string `json:"eventType"`
	// Per-field bounding boxes. A JSON object mapping RFC 6901 JSON Pointer paths
	// (e.g. `"/invoiceNumber"`, `"/items/0/price"`) to the document regions from which
	// each extracted value was sourced.
	FieldBoundingBoxes any `json:"fieldBoundingBoxes"`
	// Per-field confidence scores. A JSON object mapping RFC 6901 JSON Pointer paths
	// (e.g. `"/invoiceNumber"`) to float values in the range [0, 1] indicating the
	// model's confidence in each extracted field value.
	FieldConfidences any `json:"fieldConfidences"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent `json:"inboundEmail"`
	// Array of transformation inputs with their types and S3 URLs.
	Inputs []EventExtractInput `json:"inputs" api:"nullable"`
	// The input type of the content you're sending for transformation.
	//
	// Any of "csv", "docx", "email", "heic", "html", "jpeg", "json", "heif", "m4a",
	// "mp3", "pdf", "png", "text", "wav", "webp", "xls", "xlsx", "xml".
	InputType InputType `json:"inputType"`
	// List of properties that were invalid in the input.
	InvalidProperties []string             `json:"invalidProperties"`
	Metadata          EventExtractMetadata `json:"metadata"`
	// Presigned S3 URL for the input content uploaded to S3.
	S3URL string `json:"s3URL" api:"nullable"`
	// Unique ID for each transformation output generated by bem following Segment's
	// KSUID conventions.
	TransformationID string `json:"transformationID"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ItemCount             respjson.Field
		ItemOffset            respjson.Field
		ReferenceID           respjson.Field
		TransformedContent    respjson.Field
		AvgConfidence         respjson.Field
		CallID                respjson.Field
		CorrectedContent      respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FieldBoundingBoxes    respjson.Field
		FieldConfidences      respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Inputs                respjson.Field
		InputType             respjson.Field
		InvalidProperties     respjson.Field
		Metadata              respjson.Field
		S3URL                 respjson.Field
		TransformationID      respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

V3 event variants that do not exist in the shared `Event` union.

`ExtractEvent` and `ClassifyEvent` are emitted only by V3-era function types (`extract` and `classify`). The shared `Event` union in `specs/events/models.tsp` predates these types and continues to describe V2 / V1-alpha responses verbatim; V3 response payloads add the new variants via the `EventV3` union below while keeping every shared variant intact for backward compatibility.

func (EventExtract) RawJSON added in v0.10.0

func (r EventExtract) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventExtract) UnmarshalJSON added in v0.10.0

func (r *EventExtract) UnmarshalJSON(data []byte) error

type EventExtractCorrectedContentOutput added in v0.10.0

type EventExtractCorrectedContentOutput struct {
	Output []AnyTypeUnion `json:"output"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventExtractCorrectedContentOutput) RawJSON added in v0.10.0

Returns the unmodified JSON received from the API

func (*EventExtractCorrectedContentOutput) UnmarshalJSON added in v0.10.0

func (r *EventExtractCorrectedContentOutput) UnmarshalJSON(data []byte) error

type EventExtractCorrectedContentUnion added in v0.10.0

type EventExtractCorrectedContentUnion struct {
	// This field will be present if the value is a [[]any] instead of an object.
	OfAnyArray []any `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field is from variant [EventExtractCorrectedContentOutput].
	Output []AnyTypeUnion `json:"output"`
	JSON   struct {
		OfAnyArray respjson.Field
		OfString   respjson.Field
		OfFloat    respjson.Field
		OfBool     respjson.Field
		Output     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventExtractCorrectedContentUnion contains all possible properties and values from EventExtractCorrectedContentOutput, [[]any], [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfAnyArray OfString OfFloat OfBool]

func (EventExtractCorrectedContentUnion) AsAnyArray added in v0.10.0

func (u EventExtractCorrectedContentUnion) AsAnyArray() (v []any)

func (EventExtractCorrectedContentUnion) AsBool added in v0.10.0

func (u EventExtractCorrectedContentUnion) AsBool() (v bool)

func (EventExtractCorrectedContentUnion) AsEventExtractCorrectedContentOutput added in v0.10.0

func (u EventExtractCorrectedContentUnion) AsEventExtractCorrectedContentOutput() (v EventExtractCorrectedContentOutput)

func (EventExtractCorrectedContentUnion) AsFloat added in v0.10.0

func (EventExtractCorrectedContentUnion) AsString added in v0.10.0

func (u EventExtractCorrectedContentUnion) AsString() (v string)

func (EventExtractCorrectedContentUnion) RawJSON added in v0.10.0

Returns the unmodified JSON received from the API

func (*EventExtractCorrectedContentUnion) UnmarshalJSON added in v0.10.0

func (r *EventExtractCorrectedContentUnion) UnmarshalJSON(data []byte) error

type EventExtractInput added in v0.10.0

type EventExtractInput struct {
	InputContent     string `json:"inputContent" api:"nullable"`
	InputType        string `json:"inputType" api:"nullable"`
	JsonInputContent any    `json:"jsonInputContent" api:"nullable"`
	S3URL            string `json:"s3URL" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InputContent     respjson.Field
		InputType        respjson.Field
		JsonInputContent respjson.Field
		S3URL            respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventExtractInput) RawJSON added in v0.10.0

func (r EventExtractInput) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventExtractInput) UnmarshalJSON added in v0.10.0

func (r *EventExtractInput) UnmarshalJSON(data []byte) error

type EventExtractMetadata added in v0.10.0

type EventExtractMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventExtractMetadata) RawJSON added in v0.10.0

func (r EventExtractMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventExtractMetadata) UnmarshalJSON added in v0.10.0

func (r *EventExtractMetadata) UnmarshalJSON(data []byte) error

type EventJoin

type EventJoin struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// List of properties that were invalid in the input.
	InvalidProperties []string `json:"invalidProperties" api:"required"`
	// The items that were joined.
	Items []EventJoinItem `json:"items" api:"required"`
	// The type of join that was performed.
	//
	// Any of "standard".
	JoinType string `json:"joinType" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// The transformed content of the input. The structure of this object is defined by
	// the function configuration.
	TransformedContent any `json:"transformedContent" api:"required"`
	// Average confidence score across all extracted fields, in the range [0, 1].
	AvgConfidence float64 `json:"avgConfidence" api:"nullable"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "join".
	EventType string `json:"eventType"`
	// Per-field confidence scores. A JSON object mapping RFC 6901 JSON Pointer paths
	// (e.g. `"/invoiceNumber"`) to float values in the range [0, 1] indicating the
	// model's confidence in each extracted field value.
	FieldConfidences any `json:"fieldConfidences"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent `json:"inboundEmail"`
	Metadata     EventJoinMetadata `json:"metadata"`
	// Unique ID for each transformation output generated by bem following Segment's
	// KSUID conventions.
	TransformationID string `json:"transformationID"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		InvalidProperties     respjson.Field
		Items                 respjson.Field
		JoinType              respjson.Field
		ReferenceID           respjson.Field
		TransformedContent    respjson.Field
		AvgConfidence         respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FieldConfidences      respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		TransformationID      respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventJoin) RawJSON

func (r EventJoin) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventJoin) UnmarshalJSON

func (r *EventJoin) UnmarshalJSON(data []byte) error

type EventJoinItem

type EventJoinItem struct {
	// The number of items that were transformed.
	ItemCount int64 `json:"itemCount" api:"required"`
	// The offset of the first item that was transformed. Used for batch
	// transformations to indicate which item in the batch this event corresponds to.
	ItemOffset int64 `json:"itemOffset" api:"required"`
	// The unique ID you use internally to refer to this data point.
	ItemReferenceID string `json:"itemReferenceID" api:"required"`
	// The presigned S3 URL of the file that was joined.
	S3URL string `json:"s3URL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemCount       respjson.Field
		ItemOffset      respjson.Field
		ItemReferenceID respjson.Field
		S3URL           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventJoinItem) RawJSON

func (r EventJoinItem) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventJoinItem) UnmarshalJSON

func (r *EventJoinItem) UnmarshalJSON(data []byte) error

type EventJoinMetadata

type EventJoinMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventJoinMetadata) RawJSON

func (r EventJoinMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventJoinMetadata) UnmarshalJSON

func (r *EventJoinMetadata) UnmarshalJSON(data []byte) error

type EventParse added in v0.14.0

type EventParse struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The number of items that were parsed. Used for batch parsing to indicate how
	// many items were parsed.
	ItemCount int64 `json:"itemCount" api:"required"`
	// The offset of the first item that was parsed. Used for batch parsing to indicate
	// which item in the batch this event corresponds to.
	ItemOffset int64 `json:"itemOffset" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// The parsed content of the input. Top-level keys are `sections`, `entities`, and
	// `relationships`; the precise shape is determined by the parse function's
	// configuration.
	TransformedContent any `json:"transformedContent" api:"required"`
	// Average confidence score across all parsed fields, in the range [0, 1].
	AvgConfidence float64 `json:"avgConfidence" api:"nullable"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Corrected feedback provided for fine-tuning purposes.
	CorrectedContent EventParseCorrectedContentUnion `json:"correctedContent" api:"nullable"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "parse".
	EventType string `json:"eventType"`
	// Per-field bounding boxes. A JSON object mapping RFC 6901 JSON Pointer paths to
	// the document regions from which each parsed value was sourced.
	FieldBoundingBoxes any `json:"fieldBoundingBoxes"`
	// Per-field confidence scores. A JSON object mapping RFC 6901 JSON Pointer paths
	// to float values in the range [0, 1] indicating the model's confidence in each
	// parsed field value.
	FieldConfidences any `json:"fieldConfidences"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent `json:"inboundEmail"`
	// Array of parse inputs with their types and S3 URLs.
	Inputs []EventParseInput `json:"inputs" api:"nullable"`
	// The input type of the content you're sending for transformation.
	//
	// Any of "csv", "docx", "email", "heic", "html", "jpeg", "json", "heif", "m4a",
	// "mp3", "pdf", "png", "text", "wav", "webp", "xls", "xlsx", "xml".
	InputType InputType `json:"inputType"`
	// List of properties that were invalid in the input.
	InvalidProperties []string           `json:"invalidProperties"`
	Metadata          EventParseMetadata `json:"metadata"`
	// Presigned S3 URL for the input content uploaded to S3.
	S3URL string `json:"s3URL" api:"nullable"`
	// Unique ID for each transformation output generated by bem following Segment's
	// KSUID conventions.
	TransformationID string `json:"transformationID"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ItemCount             respjson.Field
		ItemOffset            respjson.Field
		ReferenceID           respjson.Field
		TransformedContent    respjson.Field
		AvgConfidence         respjson.Field
		CallID                respjson.Field
		CorrectedContent      respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FieldBoundingBoxes    respjson.Field
		FieldConfidences      respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Inputs                respjson.Field
		InputType             respjson.Field
		InvalidProperties     respjson.Field
		Metadata              respjson.Field
		S3URL                 respjson.Field
		TransformationID      respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a `parse` function completes. Reuses the `extract` event shape on the wire — both wrap a Transformation and downstream consumers care about the same `transformedContent` payload — but uses a distinct `eventType` discriminator so receivers can dispatch on the function type that produced it.

func (EventParse) RawJSON added in v0.14.0

func (r EventParse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventParse) UnmarshalJSON added in v0.14.0

func (r *EventParse) UnmarshalJSON(data []byte) error

type EventParseCorrectedContentOutput added in v0.14.0

type EventParseCorrectedContentOutput struct {
	Output []AnyTypeUnion `json:"output"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventParseCorrectedContentOutput) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*EventParseCorrectedContentOutput) UnmarshalJSON added in v0.14.0

func (r *EventParseCorrectedContentOutput) UnmarshalJSON(data []byte) error

type EventParseCorrectedContentUnion added in v0.14.0

type EventParseCorrectedContentUnion struct {
	// This field will be present if the value is a [[]any] instead of an object.
	OfAnyArray []any `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field is from variant [EventParseCorrectedContentOutput].
	Output []AnyTypeUnion `json:"output"`
	JSON   struct {
		OfAnyArray respjson.Field
		OfString   respjson.Field
		OfFloat    respjson.Field
		OfBool     respjson.Field
		Output     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventParseCorrectedContentUnion contains all possible properties and values from EventParseCorrectedContentOutput, [[]any], [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfAnyArray OfString OfFloat OfBool]

func (EventParseCorrectedContentUnion) AsAnyArray added in v0.14.0

func (u EventParseCorrectedContentUnion) AsAnyArray() (v []any)

func (EventParseCorrectedContentUnion) AsBool added in v0.14.0

func (u EventParseCorrectedContentUnion) AsBool() (v bool)

func (EventParseCorrectedContentUnion) AsEventParseCorrectedContentOutput added in v0.14.0

func (u EventParseCorrectedContentUnion) AsEventParseCorrectedContentOutput() (v EventParseCorrectedContentOutput)

func (EventParseCorrectedContentUnion) AsFloat added in v0.14.0

func (u EventParseCorrectedContentUnion) AsFloat() (v float64)

func (EventParseCorrectedContentUnion) AsString added in v0.14.0

func (u EventParseCorrectedContentUnion) AsString() (v string)

func (EventParseCorrectedContentUnion) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*EventParseCorrectedContentUnion) UnmarshalJSON added in v0.14.0

func (r *EventParseCorrectedContentUnion) UnmarshalJSON(data []byte) error

type EventParseInput added in v0.14.0

type EventParseInput struct {
	InputContent     string `json:"inputContent" api:"nullable"`
	InputType        string `json:"inputType" api:"nullable"`
	JsonInputContent any    `json:"jsonInputContent" api:"nullable"`
	S3URL            string `json:"s3URL" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InputContent     respjson.Field
		InputType        respjson.Field
		JsonInputContent respjson.Field
		S3URL            respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventParseInput) RawJSON added in v0.14.0

func (r EventParseInput) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventParseInput) UnmarshalJSON added in v0.14.0

func (r *EventParseInput) UnmarshalJSON(data []byte) error

type EventParseMetadata added in v0.14.0

type EventParseMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventParseMetadata) RawJSON added in v0.14.0

func (r EventParseMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventParseMetadata) UnmarshalJSON added in v0.14.0

func (r *EventParseMetadata) UnmarshalJSON(data []byte) error

type EventPayloadShaping added in v0.14.0

type EventPayloadShaping struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// The reshaped payload produced by applying the function's JMESPath expressions to
	// the input data.
	TransformedContent any `json:"transformedContent" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "payload_shaping".
	EventType string `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent           `json:"inboundEmail"`
	Metadata     EventPayloadShapingMetadata `json:"metadata"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ReferenceID           respjson.Field
		TransformedContent    respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted by `payload_shaping` functions, which restructure JSON payloads using JMESPath expressions configured on the function. The shaped result is carried in `transformedContent`.

func (EventPayloadShaping) RawJSON added in v0.14.0

func (r EventPayloadShaping) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventPayloadShaping) UnmarshalJSON added in v0.14.0

func (r *EventPayloadShaping) UnmarshalJSON(data []byte) error

type EventPayloadShapingMetadata added in v0.14.0

type EventPayloadShapingMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventPayloadShapingMetadata) RawJSON added in v0.14.0

func (r EventPayloadShapingMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventPayloadShapingMetadata) UnmarshalJSON added in v0.14.0

func (r *EventPayloadShapingMetadata) UnmarshalJSON(data []byte) error

type EventRoute

type EventRoute struct {
	// The choice made by the router function.
	Choice string `json:"choice" api:"required"`
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "route".
	EventType string `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent  `json:"inboundEmail"`
	Metadata     EventRouteMetadata `json:"metadata"`
	// The presigned S3 URL of the file that was routed.
	S3URL string `json:"s3URL"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Choice                respjson.Field
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ReferenceID           respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		S3URL                 respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventRoute) RawJSON

func (r EventRoute) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventRoute) UnmarshalJSON

func (r *EventRoute) UnmarshalJSON(data []byte) error

type EventRouteMetadata

type EventRouteMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventRouteMetadata) RawJSON

func (r EventRouteMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventRouteMetadata) UnmarshalJSON

func (r *EventRouteMetadata) UnmarshalJSON(data []byte) error

type EventSend

type EventSend struct {
	// Outcome of a Send function's delivery attempt.
	//
	// Any of "success", "skip".
	DeliveryStatus string `json:"deliveryStatus" api:"required"`
	// Destination type for a Send function.
	//
	// Any of "webhook", "s3", "google_drive".
	DestinationType SendDestinationType `json:"destinationType" api:"required"`
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// The full protocol event JSON that was delivered — identical to what subscription
	// publish would deliver for the same event. For ad-hoc calls with a JSON file
	// input, contains the raw input JSON. For ad-hoc calls with a binary file input,
	// contains {"s3URL": "<presigned-url>"}.
	DeliveredContent any `json:"deliveredContent"`
	// Any of "send".
	EventType string `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// Metadata returned when a Send function delivers to Google Drive.
	GoogleDriveOutput EventSendGoogleDriveOutput `json:"googleDriveOutput"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent `json:"inboundEmail"`
	Metadata     EventSendMetadata `json:"metadata"`
	// Metadata returned when a Send function delivers to an S3 bucket.
	S3Output EventSendS3Output `json:"s3Output"`
	// Metadata returned when a Send function delivers to a webhook.
	WebhookOutput EventSendWebhookOutput `json:"webhookOutput"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DeliveryStatus        respjson.Field
		DestinationType       respjson.Field
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ReferenceID           respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		DeliveredContent      respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		GoogleDriveOutput     respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		S3Output              respjson.Field
		WebhookOutput         respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventSend) RawJSON

func (r EventSend) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventSend) UnmarshalJSON

func (r *EventSend) UnmarshalJSON(data []byte) error

type EventSendGoogleDriveOutput

type EventSendGoogleDriveOutput struct {
	// Name of the file created in Google Drive.
	FileName string `json:"fileName" api:"required"`
	// ID of the Google Drive folder the file was placed in.
	FolderID string `json:"folderID" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FileName    respjson.Field
		FolderID    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Metadata returned when a Send function delivers to Google Drive.

func (EventSendGoogleDriveOutput) RawJSON

func (r EventSendGoogleDriveOutput) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventSendGoogleDriveOutput) UnmarshalJSON

func (r *EventSendGoogleDriveOutput) UnmarshalJSON(data []byte) error

type EventSendMetadata

type EventSendMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventSendMetadata) RawJSON

func (r EventSendMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventSendMetadata) UnmarshalJSON

func (r *EventSendMetadata) UnmarshalJSON(data []byte) error

type EventSendS3Output

type EventSendS3Output struct {
	// Name of the S3 bucket the payload was written to.
	BucketName string `json:"bucketName" api:"required"`
	// Object key under which the payload was stored.
	Key string `json:"key" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BucketName  respjson.Field
		Key         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Metadata returned when a Send function delivers to an S3 bucket.

func (EventSendS3Output) RawJSON

func (r EventSendS3Output) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventSendS3Output) UnmarshalJSON

func (r *EventSendS3Output) UnmarshalJSON(data []byte) error

type EventSendWebhookOutput

type EventSendWebhookOutput struct {
	// Raw HTTP response body returned by the webhook endpoint.
	HTTPResponseBody string `json:"httpResponseBody" api:"required"`
	// HTTP status code returned by the webhook endpoint.
	HTTPStatusCode int64 `json:"httpStatusCode" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		HTTPResponseBody respjson.Field
		HTTPStatusCode   respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Metadata returned when a Send function delivers to a webhook.

func (EventSendWebhookOutput) RawJSON

func (r EventSendWebhookOutput) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventSendWebhookOutput) UnmarshalJSON

func (r *EventSendWebhookOutput) UnmarshalJSON(data []byte) error

type EventService added in v0.9.0

type EventService struct {
	// contains filtered or unexported fields
}

Submit training corrections for `extract`, `classify`, and `join` events.

Feedback is event-centric — each correction is attached to an event by its `eventID`, and the server resolves the correct underlying storage (extract/join transformations or classify route events) from the event's function type.

Split and enrich function types do not support feedback.

EventService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEventService method instead.

func NewEventService added in v0.9.0

func NewEventService(opts ...option.RequestOption) (r EventService)

NewEventService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EventService) SubmitFeedback added in v0.9.0

func (r *EventService) SubmitFeedback(ctx context.Context, eventID string, body EventSubmitFeedbackParams, opts ...option.RequestOption) (res *EventSubmitFeedbackResponse, err error)

**Submit a correction for an event.**

Accepts training corrections for `extract`, `classify`, and `join` events. For extract/join events, `correction` is a JSON object matching the function's output schema. For classify events, `correction` is a JSON string matching one of the function version's declared classifications.

Submitting feedback again for the same event overwrites the previous correction.

Unsupported function types (split, enrich) return `400`.

type EventSplitCollection

type EventSplitCollection struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// Any of "print_page", "semantic_page".
	OutputType      string                              `json:"outputType" api:"required"`
	PrintPageOutput EventSplitCollectionPrintPageOutput `json:"printPageOutput" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID        string                                 `json:"referenceID" api:"required"`
	SemanticPageOutput EventSplitCollectionSemanticPageOutput `json:"semanticPageOutput" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "split_collection".
	EventType string `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent            `json:"inboundEmail"`
	Metadata     EventSplitCollectionMetadata `json:"metadata"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		OutputType            respjson.Field
		PrintPageOutput       respjson.Field
		ReferenceID           respjson.Field
		SemanticPageOutput    respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventSplitCollection) RawJSON

func (r EventSplitCollection) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventSplitCollection) UnmarshalJSON

func (r *EventSplitCollection) UnmarshalJSON(data []byte) error

type EventSplitCollectionMetadata

type EventSplitCollectionMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventSplitCollectionMetadata) RawJSON

Returns the unmodified JSON received from the API

func (*EventSplitCollectionMetadata) UnmarshalJSON

func (r *EventSplitCollectionMetadata) UnmarshalJSON(data []byte) error

type EventSplitCollectionPrintPageOutput

type EventSplitCollectionPrintPageOutput struct {
	ItemCount int64                                     `json:"itemCount"`
	Items     []EventSplitCollectionPrintPageOutputItem `json:"items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemCount   respjson.Field
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventSplitCollectionPrintPageOutput) RawJSON

Returns the unmodified JSON received from the API

func (*EventSplitCollectionPrintPageOutput) UnmarshalJSON

func (r *EventSplitCollectionPrintPageOutput) UnmarshalJSON(data []byte) error

type EventSplitCollectionPrintPageOutputItem

type EventSplitCollectionPrintPageOutputItem struct {
	ItemOffset      int64  `json:"itemOffset"`
	ItemReferenceID string `json:"itemReferenceID"`
	S3URL           string `json:"s3URL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemOffset      respjson.Field
		ItemReferenceID respjson.Field
		S3URL           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventSplitCollectionPrintPageOutputItem) RawJSON

Returns the unmodified JSON received from the API

func (*EventSplitCollectionPrintPageOutputItem) UnmarshalJSON

func (r *EventSplitCollectionPrintPageOutputItem) UnmarshalJSON(data []byte) error

type EventSplitCollectionSemanticPageOutput

type EventSplitCollectionSemanticPageOutput struct {
	ItemCount int64                                        `json:"itemCount"`
	Items     []EventSplitCollectionSemanticPageOutputItem `json:"items"`
	PageCount int64                                        `json:"pageCount"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemCount   respjson.Field
		Items       respjson.Field
		PageCount   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventSplitCollectionSemanticPageOutput) RawJSON

Returns the unmodified JSON received from the API

func (*EventSplitCollectionSemanticPageOutput) UnmarshalJSON

func (r *EventSplitCollectionSemanticPageOutput) UnmarshalJSON(data []byte) error

type EventSplitCollectionSemanticPageOutputItem

type EventSplitCollectionSemanticPageOutputItem struct {
	ItemClass       string `json:"itemClass"`
	ItemClassCount  int64  `json:"itemClassCount"`
	ItemClassOffset int64  `json:"itemClassOffset"`
	ItemOffset      int64  `json:"itemOffset"`
	ItemReferenceID string `json:"itemReferenceID"`
	PageEnd         int64  `json:"pageEnd"`
	PageStart       int64  `json:"pageStart"`
	S3URL           string `json:"s3URL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemClass       respjson.Field
		ItemClassCount  respjson.Field
		ItemClassOffset respjson.Field
		ItemOffset      respjson.Field
		ItemReferenceID respjson.Field
		PageEnd         respjson.Field
		PageStart       respjson.Field
		S3URL           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventSplitCollectionSemanticPageOutputItem) RawJSON

Returns the unmodified JSON received from the API

func (*EventSplitCollectionSemanticPageOutputItem) UnmarshalJSON

func (r *EventSplitCollectionSemanticPageOutputItem) UnmarshalJSON(data []byte) error

type EventSplitItem

type EventSplitItem struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// Any of "print_page", "semantic_page".
	OutputType string `json:"outputType" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "split_item".
	EventType string `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail       InboundEmailEvent                `json:"inboundEmail"`
	Metadata           EventSplitItemMetadata           `json:"metadata"`
	PrintPageOutput    EventSplitItemPrintPageOutput    `json:"printPageOutput"`
	SemanticPageOutput EventSplitItemSemanticPageOutput `json:"semanticPageOutput"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		OutputType            respjson.Field
		ReferenceID           respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		PrintPageOutput       respjson.Field
		SemanticPageOutput    respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventSplitItem) RawJSON

func (r EventSplitItem) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventSplitItem) UnmarshalJSON

func (r *EventSplitItem) UnmarshalJSON(data []byte) error

type EventSplitItemMetadata

type EventSplitItemMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventSplitItemMetadata) RawJSON

func (r EventSplitItemMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventSplitItemMetadata) UnmarshalJSON

func (r *EventSplitItemMetadata) UnmarshalJSON(data []byte) error

type EventSplitItemPrintPageOutput

type EventSplitItemPrintPageOutput struct {
	CollectionReferenceID string `json:"collectionReferenceID"`
	ItemCount             int64  `json:"itemCount"`
	ItemOffset            int64  `json:"itemOffset"`
	S3URL                 string `json:"s3URL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CollectionReferenceID respjson.Field
		ItemCount             respjson.Field
		ItemOffset            respjson.Field
		S3URL                 respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventSplitItemPrintPageOutput) RawJSON

Returns the unmodified JSON received from the API

func (*EventSplitItemPrintPageOutput) UnmarshalJSON

func (r *EventSplitItemPrintPageOutput) UnmarshalJSON(data []byte) error

type EventSplitItemSemanticPageOutput

type EventSplitItemSemanticPageOutput struct {
	CollectionReferenceID string `json:"collectionReferenceID"`
	ItemClass             string `json:"itemClass"`
	ItemClassCount        int64  `json:"itemClassCount"`
	ItemClassOffset       int64  `json:"itemClassOffset"`
	ItemCount             int64  `json:"itemCount"`
	ItemOffset            int64  `json:"itemOffset"`
	PageCount             int64  `json:"pageCount"`
	PageEnd               int64  `json:"pageEnd"`
	PageStart             int64  `json:"pageStart"`
	S3URL                 string `json:"s3URL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CollectionReferenceID respjson.Field
		ItemClass             respjson.Field
		ItemClassCount        respjson.Field
		ItemClassOffset       respjson.Field
		ItemCount             respjson.Field
		ItemOffset            respjson.Field
		PageCount             respjson.Field
		PageEnd               respjson.Field
		PageStart             respjson.Field
		S3URL                 respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventSplitItemSemanticPageOutput) RawJSON

Returns the unmodified JSON received from the API

func (*EventSplitItemSemanticPageOutput) UnmarshalJSON

func (r *EventSplitItemSemanticPageOutput) UnmarshalJSON(data []byte) error

type EventSubmitFeedbackParams added in v0.9.0

type EventSubmitFeedbackParams struct {
	Correction    any             `json:"correction,omitzero" api:"required"`
	OrderMatching param.Opt[bool] `json:"orderMatching,omitzero"`
	// contains filtered or unexported fields
}

func (EventSubmitFeedbackParams) MarshalJSON added in v0.9.0

func (r EventSubmitFeedbackParams) MarshalJSON() (data []byte, err error)

func (*EventSubmitFeedbackParams) UnmarshalJSON added in v0.9.0

func (r *EventSubmitFeedbackParams) UnmarshalJSON(data []byte) error

type EventSubmitFeedbackResponse added in v0.9.0

type EventSubmitFeedbackResponse struct {
	Correction any `json:"correction" api:"required"`
	// Server timestamp when the correction was persisted (RFC 3339).
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	EventID   string    `json:"eventID" api:"required"`
	// Function types that support feedback submission.
	//
	// Any of "extract", "classify", "join".
	FunctionType EventSubmitFeedbackResponseFunctionType `json:"functionType" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Correction   respjson.Field
		CreatedAt    respjson.Field
		EventID      respjson.Field
		FunctionType respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Echoed response after a correction is recorded.

func (EventSubmitFeedbackResponse) RawJSON added in v0.9.0

func (r EventSubmitFeedbackResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventSubmitFeedbackResponse) UnmarshalJSON added in v0.9.0

func (r *EventSubmitFeedbackResponse) UnmarshalJSON(data []byte) error

type EventSubmitFeedbackResponseFunctionType added in v0.9.0

type EventSubmitFeedbackResponseFunctionType string

Function types that support feedback submission.

const (
	EventSubmitFeedbackResponseFunctionTypeExtract  EventSubmitFeedbackResponseFunctionType = "extract"
	EventSubmitFeedbackResponseFunctionTypeClassify EventSubmitFeedbackResponseFunctionType = "classify"
	EventSubmitFeedbackResponseFunctionTypeJoin     EventSubmitFeedbackResponseFunctionType = "join"
)

type EventTransform

type EventTransform struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The number of items that were transformed. Used for batch transformations to
	// indicate how many items were transformed.
	ItemCount int64 `json:"itemCount" api:"required"`
	// The offset of the first item that was transformed. Used for batch
	// transformations to indicate which item in the batch this event corresponds to.
	ItemOffset int64 `json:"itemOffset" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// The transformed content of the input. The structure of this object is defined by
	// the function configuration.
	TransformedContent any `json:"transformedContent" api:"required"`
	// Average confidence score across all extracted fields, in the range [0, 1].
	AvgConfidence float64 `json:"avgConfidence" api:"nullable"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Corrected feedback provided for fine-tuning purposes.
	CorrectedContent EventTransformCorrectedContentUnion `json:"correctedContent" api:"nullable"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "transform".
	EventType string `json:"eventType"`
	// Per-field confidence scores. A JSON object mapping RFC 6901 JSON Pointer paths
	// (e.g. `"/invoiceNumber"`) to float values in the range [0, 1] indicating the
	// model's confidence in each extracted field value.
	FieldConfidences any `json:"fieldConfidences"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent `json:"inboundEmail"`
	// Array of transformation inputs with their types and S3 URLs.
	Inputs []EventTransformInput `json:"inputs" api:"nullable"`
	// The input type of the content you're sending for transformation.
	//
	// Any of "csv", "docx", "email", "heic", "html", "jpeg", "json", "heif", "m4a",
	// "mp3", "pdf", "png", "text", "wav", "webp", "xls", "xlsx", "xml".
	InputType InputType `json:"inputType"`
	// List of properties that were invalid in the input.
	InvalidProperties []string `json:"invalidProperties"`
	// Indicates whether this transformation was created as part of a regression test.
	IsRegression bool `json:"isRegression"`
	// Last timestamp indicating when the transform was published via webhook and
	// received a non-200 response. Set to `null` on a subsequent retry if the webhook
	// service receives a 200 response.
	LastPublishErrorAt string                 `json:"lastPublishErrorAt" api:"nullable"`
	Metadata           EventTransformMetadata `json:"metadata"`
	// Accuracy, precision, recall, and F1 score when corrected JSON is provided.
	Metrics EventTransformMetrics `json:"metrics" api:"nullable"`
	// Indicates whether array order matters when comparing corrected JSON with
	// extracted JSON.
	OrderMatching bool `json:"orderMatching"`
	// ID of pipeline that transformed the original input data.
	PipelineID string `json:"pipelineID"`
	// Timestamp indicating when the transform was published via webhook and received a
	// successful 200 response. Value is `null` if the transformation hasn't been sent.
	PublishedAt time.Time `json:"publishedAt" format:"date-time"`
	// Presigned S3 URL for the input content uploaded to S3.
	S3URL string `json:"s3URL" api:"nullable"`
	// Unique ID for each transformation output generated by bem following Segment's
	// KSUID conventions.
	TransformationID string `json:"transformationID"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ItemCount             respjson.Field
		ItemOffset            respjson.Field
		ReferenceID           respjson.Field
		TransformedContent    respjson.Field
		AvgConfidence         respjson.Field
		CallID                respjson.Field
		CorrectedContent      respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FieldConfidences      respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Inputs                respjson.Field
		InputType             respjson.Field
		InvalidProperties     respjson.Field
		IsRegression          respjson.Field
		LastPublishErrorAt    respjson.Field
		Metadata              respjson.Field
		Metrics               respjson.Field
		OrderMatching         respjson.Field
		PipelineID            respjson.Field
		PublishedAt           respjson.Field
		S3URL                 respjson.Field
		TransformationID      respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventTransform) RawJSON

func (r EventTransform) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventTransform) UnmarshalJSON

func (r *EventTransform) UnmarshalJSON(data []byte) error

type EventTransformCorrectedContentOutput

type EventTransformCorrectedContentOutput struct {
	Output []AnyTypeUnion `json:"output"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventTransformCorrectedContentOutput) RawJSON

Returns the unmodified JSON received from the API

func (*EventTransformCorrectedContentOutput) UnmarshalJSON

func (r *EventTransformCorrectedContentOutput) UnmarshalJSON(data []byte) error

type EventTransformCorrectedContentUnion

type EventTransformCorrectedContentUnion struct {
	// This field will be present if the value is a [[]any] instead of an object.
	OfAnyArray []any `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field is from variant [EventTransformCorrectedContentOutput].
	Output []AnyTypeUnion `json:"output"`
	JSON   struct {
		OfAnyArray respjson.Field
		OfString   respjson.Field
		OfFloat    respjson.Field
		OfBool     respjson.Field
		Output     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventTransformCorrectedContentUnion contains all possible properties and values from EventTransformCorrectedContentOutput, [[]any], [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfAnyArray OfString OfFloat OfBool]

func (EventTransformCorrectedContentUnion) AsAnyArray

func (u EventTransformCorrectedContentUnion) AsAnyArray() (v []any)

func (EventTransformCorrectedContentUnion) AsBool

func (EventTransformCorrectedContentUnion) AsEventTransformCorrectedContentOutput

func (u EventTransformCorrectedContentUnion) AsEventTransformCorrectedContentOutput() (v EventTransformCorrectedContentOutput)

func (EventTransformCorrectedContentUnion) AsFloat

func (EventTransformCorrectedContentUnion) AsString

func (EventTransformCorrectedContentUnion) RawJSON

Returns the unmodified JSON received from the API

func (*EventTransformCorrectedContentUnion) UnmarshalJSON

func (r *EventTransformCorrectedContentUnion) UnmarshalJSON(data []byte) error

type EventTransformInput

type EventTransformInput struct {
	InputContent     string `json:"inputContent" api:"nullable"`
	InputType        string `json:"inputType" api:"nullable"`
	JsonInputContent any    `json:"jsonInputContent" api:"nullable"`
	S3URL            string `json:"s3URL" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InputContent     respjson.Field
		InputType        respjson.Field
		JsonInputContent respjson.Field
		S3URL            respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventTransformInput) RawJSON

func (r EventTransformInput) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventTransformInput) UnmarshalJSON

func (r *EventTransformInput) UnmarshalJSON(data []byte) error

type EventTransformMetadata

type EventTransformMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventTransformMetadata) RawJSON

func (r EventTransformMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventTransformMetadata) UnmarshalJSON

func (r *EventTransformMetadata) UnmarshalJSON(data []byte) error

type EventTransformMetrics

type EventTransformMetrics struct {
	Differences []EventTransformMetricsDifference `json:"differences"`
	Metrics     EventTransformMetricsMetrics      `json:"metrics"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Differences respjson.Field
		Metrics     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Accuracy, precision, recall, and F1 score when corrected JSON is provided.

func (EventTransformMetrics) RawJSON

func (r EventTransformMetrics) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventTransformMetrics) UnmarshalJSON

func (r *EventTransformMetrics) UnmarshalJSON(data []byte) error

type EventTransformMetricsDifference

type EventTransformMetricsDifference struct {
	Category     string `json:"category"`
	CorrectedVal any    `json:"correctedVal"`
	ExtractedVal any    `json:"extractedVal"`
	JsonPointer  string `json:"jsonPointer"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Category     respjson.Field
		CorrectedVal respjson.Field
		ExtractedVal respjson.Field
		JsonPointer  respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventTransformMetricsDifference) RawJSON

Returns the unmodified JSON received from the API

func (*EventTransformMetricsDifference) UnmarshalJSON

func (r *EventTransformMetricsDifference) UnmarshalJSON(data []byte) error

type EventTransformMetricsMetrics

type EventTransformMetricsMetrics struct {
	Accuracy  float64 `json:"accuracy"`
	F1Score   float64 `json:"f1Score"`
	Precision float64 `json:"precision"`
	Recall    float64 `json:"recall"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accuracy    respjson.Field
		F1Score     respjson.Field
		Precision   respjson.Field
		Recall      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventTransformMetricsMetrics) RawJSON

Returns the unmodified JSON received from the API

func (*EventTransformMetricsMetrics) UnmarshalJSON

func (r *EventTransformMetricsMetrics) UnmarshalJSON(data []byte) error

type EventUnion

type EventUnion struct {
	EventID            string  `json:"eventID"`
	FunctionID         string  `json:"functionID"`
	FunctionName       string  `json:"functionName"`
	ItemCount          int64   `json:"itemCount"`
	ItemOffset         int64   `json:"itemOffset"`
	ReferenceID        string  `json:"referenceID"`
	TransformedContent any     `json:"transformedContent"`
	AvgConfidence      float64 `json:"avgConfidence"`
	CallID             string  `json:"callID"`
	// This field is a union of [EventTransformCorrectedContentUnion],
	// [EventExtractCorrectedContentUnion], [EventParseCorrectedContentUnion]
	CorrectedContent EventUnionCorrectedContent `json:"correctedContent"`
	CreatedAt        time.Time                  `json:"createdAt"`
	// Any of "transform", "extract", "parse", "analyze", "route", "classify",
	// "split_collection", "split_item", "error", "join", "enrich", "payload_shaping",
	// "evaluation", "collection_processing", "send".
	EventType             string `json:"eventType"`
	FieldConfidences      any    `json:"fieldConfidences"`
	FunctionCallID        string `json:"functionCallID"`
	FunctionCallTryNumber int64  `json:"functionCallTryNumber"`
	FunctionVersionNum    int64  `json:"functionVersionNum"`
	// This field is from variant [EventTransform].
	InboundEmail InboundEmailEvent `json:"inboundEmail"`
	// This field is a union of [[]EventTransformInput], [[]EventExtractInput],
	// [[]EventParseInput]
	Inputs EventUnionInputs `json:"inputs"`
	// This field is from variant [EventTransform].
	InputType         InputType `json:"inputType"`
	InvalidProperties []string  `json:"invalidProperties"`
	// This field is from variant [EventTransform].
	IsRegression bool `json:"isRegression"`
	// This field is from variant [EventTransform].
	LastPublishErrorAt string `json:"lastPublishErrorAt"`
	// This field is a union of [EventTransformMetadata], [EventExtractMetadata],
	// [EventParseMetadata], [EventAnalyzeMetadata], [EventRouteMetadata],
	// [EventClassifyMetadata], [EventSplitCollectionMetadata],
	// [EventSplitItemMetadata], [ErrorEventMetadata], [EventJoinMetadata],
	// [EventEnrichMetadata], [EventPayloadShapingMetadata], [EventEvaluationMetadata],
	// [EventCollectionProcessingMetadata], [EventSendMetadata]
	Metadata EventUnionMetadata `json:"metadata"`
	// This field is from variant [EventTransform].
	Metrics EventTransformMetrics `json:"metrics"`
	// This field is from variant [EventTransform].
	OrderMatching bool `json:"orderMatching"`
	// This field is from variant [EventTransform].
	PipelineID string `json:"pipelineID"`
	// This field is from variant [EventTransform].
	PublishedAt        time.Time `json:"publishedAt"`
	S3URL              string    `json:"s3URL"`
	TransformationID   string    `json:"transformationID"`
	WorkflowID         string    `json:"workflowID"`
	WorkflowName       string    `json:"workflowName"`
	WorkflowVersionNum int64     `json:"workflowVersionNum"`
	FieldBoundingBoxes any       `json:"fieldBoundingBoxes"`
	Choice             string    `json:"choice"`
	OutputType         string    `json:"outputType"`
	// This field is a union of [EventSplitCollectionPrintPageOutput],
	// [EventSplitItemPrintPageOutput]
	PrintPageOutput EventUnionPrintPageOutput `json:"printPageOutput"`
	// This field is a union of [EventSplitCollectionSemanticPageOutput],
	// [EventSplitItemSemanticPageOutput]
	SemanticPageOutput EventUnionSemanticPageOutput `json:"semanticPageOutput"`
	// This field is from variant [ErrorEvent].
	Message string `json:"message"`
	// This field is from variant [EventJoin].
	Items []EventJoinItem `json:"items"`
	// This field is from variant [EventJoin].
	JoinType string `json:"joinType"`
	// This field is from variant [EventEnrich].
	EnrichedContent any `json:"enrichedContent"`
	// This field is from variant [EventEvaluation].
	EvaluationVersion string `json:"evaluationVersion"`
	// This field is from variant [EventEvaluation].
	Result any    `json:"result"`
	Status string `json:"status"`
	// This field is from variant [EventEvaluation].
	TransformID  string `json:"transformId"`
	ErrorMessage string `json:"errorMessage"`
	// This field is from variant [EventCollectionProcessing].
	CollectionID string `json:"collectionID"`
	// This field is from variant [EventCollectionProcessing].
	CollectionName string `json:"collectionName"`
	// This field is from variant [EventCollectionProcessing].
	Operation string `json:"operation"`
	// This field is from variant [EventCollectionProcessing].
	ProcessedCount int64 `json:"processedCount"`
	// This field is from variant [EventCollectionProcessing].
	CollectionItemIDs []string `json:"collectionItemIDs"`
	// This field is from variant [EventSend].
	DeliveryStatus string `json:"deliveryStatus"`
	// This field is from variant [EventSend].
	DestinationType SendDestinationType `json:"destinationType"`
	// This field is from variant [EventSend].
	DeliveredContent any `json:"deliveredContent"`
	// This field is from variant [EventSend].
	GoogleDriveOutput EventSendGoogleDriveOutput `json:"googleDriveOutput"`
	// This field is from variant [EventSend].
	S3Output EventSendS3Output `json:"s3Output"`
	// This field is from variant [EventSend].
	WebhookOutput EventSendWebhookOutput `json:"webhookOutput"`
	JSON          struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ItemCount             respjson.Field
		ItemOffset            respjson.Field
		ReferenceID           respjson.Field
		TransformedContent    respjson.Field
		AvgConfidence         respjson.Field
		CallID                respjson.Field
		CorrectedContent      respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FieldConfidences      respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Inputs                respjson.Field
		InputType             respjson.Field
		InvalidProperties     respjson.Field
		IsRegression          respjson.Field
		LastPublishErrorAt    respjson.Field
		Metadata              respjson.Field
		Metrics               respjson.Field
		OrderMatching         respjson.Field
		PipelineID            respjson.Field
		PublishedAt           respjson.Field
		S3URL                 respjson.Field
		TransformationID      respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		FieldBoundingBoxes    respjson.Field
		Choice                respjson.Field
		OutputType            respjson.Field
		PrintPageOutput       respjson.Field
		SemanticPageOutput    respjson.Field
		Message               respjson.Field
		Items                 respjson.Field
		JoinType              respjson.Field
		EnrichedContent       respjson.Field
		EvaluationVersion     respjson.Field
		Result                respjson.Field
		Status                respjson.Field
		TransformID           respjson.Field
		ErrorMessage          respjson.Field
		CollectionID          respjson.Field
		CollectionName        respjson.Field
		Operation             respjson.Field
		ProcessedCount        respjson.Field
		CollectionItemIDs     respjson.Field
		DeliveryStatus        respjson.Field
		DestinationType       respjson.Field
		DeliveredContent      respjson.Field
		GoogleDriveOutput     respjson.Field
		S3Output              respjson.Field
		WebhookOutput         respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventUnion contains all possible properties and values from EventTransform, EventExtract, EventParse, EventAnalyze, EventRoute, EventClassify, EventSplitCollection, EventSplitItem, ErrorEvent, EventJoin, EventEnrich, EventPayloadShaping, EventEvaluation, EventCollectionProcessing, EventSend.

Use the EventUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (EventUnion) AsAnalyze added in v0.14.0

func (u EventUnion) AsAnalyze() (v EventAnalyze)

func (EventUnion) AsAny

func (u EventUnion) AsAny() anyEvent

Use the following switch statement to find the correct variant

switch variant := EventUnion.AsAny().(type) {
case bem.EventTransform:
case bem.EventExtract:
case bem.EventParse:
case bem.EventAnalyze:
case bem.EventRoute:
case bem.EventClassify:
case bem.EventSplitCollection:
case bem.EventSplitItem:
case bem.ErrorEvent:
case bem.EventJoin:
case bem.EventEnrich:
case bem.EventPayloadShaping:
case bem.EventEvaluation:
case bem.EventCollectionProcessing:
case bem.EventSend:
default:
  fmt.Errorf("no variant present")
}

func (EventUnion) AsClassify added in v0.10.0

func (u EventUnion) AsClassify() (v EventClassify)

func (EventUnion) AsCollectionProcessing

func (u EventUnion) AsCollectionProcessing() (v EventCollectionProcessing)

func (EventUnion) AsEnrich

func (u EventUnion) AsEnrich() (v EventEnrich)

func (EventUnion) AsError

func (u EventUnion) AsError() (v ErrorEvent)

func (EventUnion) AsEvaluation added in v0.14.0

func (u EventUnion) AsEvaluation() (v EventEvaluation)

func (EventUnion) AsExtract added in v0.10.0

func (u EventUnion) AsExtract() (v EventExtract)

func (EventUnion) AsJoin

func (u EventUnion) AsJoin() (v EventJoin)

func (EventUnion) AsParse added in v0.14.0

func (u EventUnion) AsParse() (v EventParse)

func (EventUnion) AsPayloadShaping added in v0.14.0

func (u EventUnion) AsPayloadShaping() (v EventPayloadShaping)

func (EventUnion) AsRoute

func (u EventUnion) AsRoute() (v EventRoute)

func (EventUnion) AsSend

func (u EventUnion) AsSend() (v EventSend)

func (EventUnion) AsSplitCollection

func (u EventUnion) AsSplitCollection() (v EventSplitCollection)

func (EventUnion) AsSplitItem

func (u EventUnion) AsSplitItem() (v EventSplitItem)

func (EventUnion) AsTransform

func (u EventUnion) AsTransform() (v EventTransform)

func (EventUnion) RawJSON

func (u EventUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventUnion) UnmarshalJSON

func (r *EventUnion) UnmarshalJSON(data []byte) error

type EventUnionCorrectedContent added in v0.10.0

type EventUnionCorrectedContent struct {
	// This field will be present if the value is a [[]any] instead of an object.
	OfAnyArray []any `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool           `json:",inline"`
	Output []AnyTypeUnion `json:"output"`
	JSON   struct {
		OfAnyArray respjson.Field
		OfString   respjson.Field
		OfFloat    respjson.Field
		OfBool     respjson.Field
		Output     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventUnionCorrectedContent is an implicit subunion of EventUnion. EventUnionCorrectedContent provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the EventUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfAnyArray OfString OfFloat OfBool]

func (*EventUnionCorrectedContent) UnmarshalJSON added in v0.10.0

func (r *EventUnionCorrectedContent) UnmarshalJSON(data []byte) error

type EventUnionInputs added in v0.10.0

type EventUnionInputs struct {
	// This field will be present if the value is a [[]EventTransformInput] instead of
	// an object.
	OfEventTransformInputs []EventTransformInput `json:",inline"`
	// This field will be present if the value is a [[]EventExtractInput] instead of an
	// object.
	OfEventExtractInputs []EventExtractInput `json:",inline"`
	// This field will be present if the value is a [[]EventParseInput] instead of an
	// object.
	OfEventParseInputs []EventParseInput `json:",inline"`
	JSON               struct {
		OfEventTransformInputs respjson.Field
		OfEventExtractInputs   respjson.Field
		OfEventParseInputs     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventUnionInputs is an implicit subunion of EventUnion. EventUnionInputs provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the EventUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfEventTransformInputs OfEventExtractInputs OfEventParseInputs]

func (*EventUnionInputs) UnmarshalJSON added in v0.10.0

func (r *EventUnionInputs) UnmarshalJSON(data []byte) error

type EventUnionMetadata

type EventUnionMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	JSON                           struct {
		DurationFunctionToEventSeconds respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventUnionMetadata is an implicit subunion of EventUnion. EventUnionMetadata provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the EventUnion.

func (*EventUnionMetadata) UnmarshalJSON

func (r *EventUnionMetadata) UnmarshalJSON(data []byte) error

type EventUnionPrintPageOutput

type EventUnionPrintPageOutput struct {
	ItemCount int64 `json:"itemCount"`
	// This field is from variant [EventSplitCollectionPrintPageOutput].
	Items []EventSplitCollectionPrintPageOutputItem `json:"items"`
	// This field is from variant [EventSplitItemPrintPageOutput].
	CollectionReferenceID string `json:"collectionReferenceID"`
	// This field is from variant [EventSplitItemPrintPageOutput].
	ItemOffset int64 `json:"itemOffset"`
	// This field is from variant [EventSplitItemPrintPageOutput].
	S3URL string `json:"s3URL"`
	JSON  struct {
		ItemCount             respjson.Field
		Items                 respjson.Field
		CollectionReferenceID respjson.Field
		ItemOffset            respjson.Field
		S3URL                 respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventUnionPrintPageOutput is an implicit subunion of EventUnion. EventUnionPrintPageOutput provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the EventUnion.

func (*EventUnionPrintPageOutput) UnmarshalJSON

func (r *EventUnionPrintPageOutput) UnmarshalJSON(data []byte) error

type EventUnionSemanticPageOutput

type EventUnionSemanticPageOutput struct {
	ItemCount int64 `json:"itemCount"`
	// This field is from variant [EventSplitCollectionSemanticPageOutput].
	Items     []EventSplitCollectionSemanticPageOutputItem `json:"items"`
	PageCount int64                                        `json:"pageCount"`
	// This field is from variant [EventSplitItemSemanticPageOutput].
	CollectionReferenceID string `json:"collectionReferenceID"`
	// This field is from variant [EventSplitItemSemanticPageOutput].
	ItemClass string `json:"itemClass"`
	// This field is from variant [EventSplitItemSemanticPageOutput].
	ItemClassCount int64 `json:"itemClassCount"`
	// This field is from variant [EventSplitItemSemanticPageOutput].
	ItemClassOffset int64 `json:"itemClassOffset"`
	// This field is from variant [EventSplitItemSemanticPageOutput].
	ItemOffset int64 `json:"itemOffset"`
	// This field is from variant [EventSplitItemSemanticPageOutput].
	PageEnd int64 `json:"pageEnd"`
	// This field is from variant [EventSplitItemSemanticPageOutput].
	PageStart int64 `json:"pageStart"`
	// This field is from variant [EventSplitItemSemanticPageOutput].
	S3URL string `json:"s3URL"`
	JSON  struct {
		ItemCount             respjson.Field
		Items                 respjson.Field
		PageCount             respjson.Field
		CollectionReferenceID respjson.Field
		ItemClass             respjson.Field
		ItemClassCount        respjson.Field
		ItemClassOffset       respjson.Field
		ItemOffset            respjson.Field
		PageEnd               respjson.Field
		PageStart             respjson.Field
		S3URL                 respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventUnionSemanticPageOutput is an implicit subunion of EventUnion. EventUnionSemanticPageOutput provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the EventUnion.

func (*EventUnionSemanticPageOutput) UnmarshalJSON

func (r *EventUnionSemanticPageOutput) UnmarshalJSON(data []byte) error

type ExtractWebhookEvent added in v0.14.0

type ExtractWebhookEvent struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The number of items that were transformed. Used for batch transformations to
	// indicate how many items were transformed.
	ItemCount int64 `json:"itemCount" api:"required"`
	// The offset of the first item that was transformed. Used for batch
	// transformations to indicate which item in the batch this event corresponds to.
	ItemOffset int64 `json:"itemOffset" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// The transformed content of the input. The structure of this object is defined by
	// the function configuration.
	TransformedContent any `json:"transformedContent" api:"required"`
	// Average confidence score across all extracted fields, in the range [0, 1].
	AvgConfidence float64 `json:"avgConfidence" api:"nullable"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Corrected feedback provided for fine-tuning purposes.
	CorrectedContent ExtractWebhookEventCorrectedContentUnion `json:"correctedContent" api:"nullable"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "extract".
	EventType ExtractWebhookEventEventType `json:"eventType"`
	// Per-field bounding boxes. A JSON object mapping RFC 6901 JSON Pointer paths
	// (e.g. `"/invoiceNumber"`, `"/items/0/price"`) to the document regions from which
	// each extracted value was sourced.
	FieldBoundingBoxes any `json:"fieldBoundingBoxes"`
	// Per-field confidence scores. A JSON object mapping RFC 6901 JSON Pointer paths
	// (e.g. `"/invoiceNumber"`) to float values in the range [0, 1] indicating the
	// model's confidence in each extracted field value.
	FieldConfidences any `json:"fieldConfidences"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent `json:"inboundEmail"`
	// Array of transformation inputs with their types and S3 URLs.
	Inputs []ExtractWebhookEventInput `json:"inputs" api:"nullable"`
	// The input type of the content you're sending for transformation.
	//
	// Any of "csv", "docx", "email", "heic", "html", "jpeg", "json", "heif", "m4a",
	// "mp3", "pdf", "png", "text", "wav", "webp", "xls", "xlsx", "xml".
	InputType InputType `json:"inputType"`
	// List of properties that were invalid in the input.
	InvalidProperties []string                    `json:"invalidProperties"`
	Metadata          ExtractWebhookEventMetadata `json:"metadata"`
	// Presigned S3 URL for the input content uploaded to S3.
	S3URL string `json:"s3URL" api:"nullable"`
	// Unique ID for each transformation output generated by bem following Segment's
	// KSUID conventions.
	TransformationID string `json:"transformationID"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ItemCount             respjson.Field
		ItemOffset            respjson.Field
		ReferenceID           respjson.Field
		TransformedContent    respjson.Field
		AvgConfidence         respjson.Field
		CallID                respjson.Field
		CorrectedContent      respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FieldBoundingBoxes    respjson.Field
		FieldConfidences      respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Inputs                respjson.Field
		InputType             respjson.Field
		InvalidProperties     respjson.Field
		Metadata              respjson.Field
		S3URL                 respjson.Field
		TransformationID      respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

V3 event variants that do not exist in the shared `Event` union.

`ExtractEvent` and `ClassifyEvent` are emitted only by V3-era function types (`extract` and `classify`). The shared `Event` union in `specs/events/models.tsp` predates these types and continues to describe V2 / V1-alpha responses verbatim; V3 response payloads add the new variants via the `EventV3` union below while keeping every shared variant intact for backward compatibility.

func (ExtractWebhookEvent) RawJSON added in v0.14.0

func (r ExtractWebhookEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ExtractWebhookEvent) UnmarshalJSON added in v0.14.0

func (r *ExtractWebhookEvent) UnmarshalJSON(data []byte) error

type ExtractWebhookEventCorrectedContentOutput added in v0.14.0

type ExtractWebhookEventCorrectedContentOutput struct {
	Output []AnyTypeUnion `json:"output"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ExtractWebhookEventCorrectedContentOutput) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*ExtractWebhookEventCorrectedContentOutput) UnmarshalJSON added in v0.14.0

func (r *ExtractWebhookEventCorrectedContentOutput) UnmarshalJSON(data []byte) error

type ExtractWebhookEventCorrectedContentUnion added in v0.14.0

type ExtractWebhookEventCorrectedContentUnion struct {
	// This field will be present if the value is a [[]any] instead of an object.
	OfAnyArray []any `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field is from variant [ExtractWebhookEventCorrectedContentOutput].
	Output []AnyTypeUnion `json:"output"`
	JSON   struct {
		OfAnyArray respjson.Field
		OfString   respjson.Field
		OfFloat    respjson.Field
		OfBool     respjson.Field
		Output     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ExtractWebhookEventCorrectedContentUnion contains all possible properties and values from ExtractWebhookEventCorrectedContentOutput, [[]any], [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfAnyArray OfString OfFloat OfBool]

func (ExtractWebhookEventCorrectedContentUnion) AsAnyArray added in v0.14.0

func (u ExtractWebhookEventCorrectedContentUnion) AsAnyArray() (v []any)

func (ExtractWebhookEventCorrectedContentUnion) AsBool added in v0.14.0

func (ExtractWebhookEventCorrectedContentUnion) AsExtractWebhookEventCorrectedContentOutput added in v0.14.0

func (u ExtractWebhookEventCorrectedContentUnion) AsExtractWebhookEventCorrectedContentOutput() (v ExtractWebhookEventCorrectedContentOutput)

func (ExtractWebhookEventCorrectedContentUnion) AsFloat added in v0.14.0

func (ExtractWebhookEventCorrectedContentUnion) AsString added in v0.14.0

func (ExtractWebhookEventCorrectedContentUnion) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*ExtractWebhookEventCorrectedContentUnion) UnmarshalJSON added in v0.14.0

func (r *ExtractWebhookEventCorrectedContentUnion) UnmarshalJSON(data []byte) error

type ExtractWebhookEventEventType added in v0.14.0

type ExtractWebhookEventEventType string
const (
	ExtractWebhookEventEventTypeExtract ExtractWebhookEventEventType = "extract"
)

type ExtractWebhookEventInput added in v0.14.0

type ExtractWebhookEventInput struct {
	InputContent     string `json:"inputContent" api:"nullable"`
	InputType        string `json:"inputType" api:"nullable"`
	JsonInputContent any    `json:"jsonInputContent" api:"nullable"`
	S3URL            string `json:"s3URL" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InputContent     respjson.Field
		InputType        respjson.Field
		JsonInputContent respjson.Field
		S3URL            respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ExtractWebhookEventInput) RawJSON added in v0.14.0

func (r ExtractWebhookEventInput) RawJSON() string

Returns the unmodified JSON received from the API

func (*ExtractWebhookEventInput) UnmarshalJSON added in v0.14.0

func (r *ExtractWebhookEventInput) UnmarshalJSON(data []byte) error

type ExtractWebhookEventMetadata added in v0.14.0

type ExtractWebhookEventMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ExtractWebhookEventMetadata) RawJSON added in v0.14.0

func (r ExtractWebhookEventMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*ExtractWebhookEventMetadata) UnmarshalJSON added in v0.14.0

func (r *ExtractWebhookEventMetadata) UnmarshalJSON(data []byte) error

type FNavigateParams added in v0.10.0

type FNavigateParams struct {
	// Operations exposed by `POST /v3/fs`.
	//
	// The verbs and their flag names mirror Unix tools so an LLM agent's existing
	// vocabulary maps directly:
	//
	// - `ls` — list parsed documents
	// - `cat` — read one parsed doc (optionally sliced by range / projected by select)
	// - `grep` — substring or regex search across parse outputs
	// - `head` — first N sections of one doc
	// - `stat` — metadata only (page count, section count, parsed at, ...)
	// - `find` — list canonical entities (cross-doc memory)
	// - `open` — entity + mentions
	// - `xref` — entity → sections across docs that mention it
	//
	// Doc-level ops (ls, cat, grep, head, stat) work on every parsed document,
	// regardless of how the parse function was configured.
	//
	// Memory-level ops (find, open, xref) operate on the global entities table which
	// is only populated when the parse function had `linkAcrossDocuments: true`. On
	// environments with no memory-linked docs they return empty data with a hint
	// pointing at the toggle.
	//
	// Any of "ls", "find", "open", "cat", "grep", "xref", "stat", "head".
	Op FsOp `json:"op,omitzero" api:"required"`
	// When true, return only the hit count without snippet payload. Cheaper than
	// fetching matches when the agent only wants a yes/no.
	CountOnly param.Opt[bool] `json:"countOnly,omitzero"`
	// Pagination cursor. Pass the last item's ID from a previous response
	// (`nextCursor`) to fetch the next page.
	Cursor param.Opt[string] `json:"cursor,omitzero"`
	// When true (default), substring/regex matching is case-insensitive.
	IgnoreCase param.Opt[bool] `json:"ignoreCase,omitzero"`
	// Maximum results to return. Defaults vary per op (25–50).
	Limit param.Opt[int64] `json:"limit,omitzero"`
	// First-N count for `op=head`. Defaults to 10.
	N param.Opt[int64] `json:"n,omitzero"`
	// Identifier for ops that operate on a single resource:
	//
	// - cat / head / stat: a parsed document, by `referenceID` or `transformationID`.
	// - open / xref / stat: an entity, by `entityID`.
	Path param.Opt[string] `json:"path,omitzero"`
	// Substring or regex pattern for `op=grep`.
	Pattern param.Opt[string] `json:"pattern,omitzero"`
	// When true, `pattern` is interpreted as a Go regex. Default false.
	Regex param.Opt[bool] `json:"regex,omitzero"`
	// Restricts grep to one part of the parse output. One of `"sections"`,
	// `"entities"`, `"relationships"`, `"all"` (default).
	Scope param.Opt[string] `json:"scope,omitzero"`
	// Request-scoping concerns that are orthogonal to the op itself. Carried on a
	// `context` object so future scoping hints (e.g. as-of timestamps, read
	// consistency) can slot in without reshaping the op-specific fields.
	Context FNavigateParamsContext `json:"context,omitzero"`
	// Filter options for `op=ls` and `op=find`.
	Filter FNavigateParamsFilter `json:"filter,omitzero"`
	// Slice the parse output along page or section dimensions. Used with `op=cat`.
	Range FNavigateParamsRange `json:"range,omitzero"`
	// Project the parse output to specific dotted paths (e.g.
	// `["sections.label", "sections.page"]`), letting an agent map a doc's structure
	// cheaply before reading content. Used with `op=cat`.
	Select []string `json:"select,omitzero"`
	// contains filtered or unexported fields
}

func (FNavigateParams) MarshalJSON added in v0.10.0

func (r FNavigateParams) MarshalJSON() (data []byte, err error)

func (*FNavigateParams) UnmarshalJSON added in v0.10.0

func (r *FNavigateParams) UnmarshalJSON(data []byte) error

type FNavigateParamsContext added in v0.21.0

type FNavigateParamsContext struct {
	// Bucket KSUID (prefix `bkt_`) to scope the request to — a named partition of the
	// knowledge graph within the caller's account+environment.
	//
	// **Optional.** Omitting it (or passing an empty value) leaves the request
	// UNSCOPED: memory-level reads (`find` / `open` / `xref`) return entities across
	// every bucket in the account+environment, so pre-bucket callers keep their
	// original all-entities behavior unchanged. (Writes are different: a parse call
	// with no bucket targets the account default bucket.) When a bucket IS supplied,
	// memory-level ops return only entities in that bucket; doc-level ops
	// (`ls`/`cat`/`head`/`stat`/`grep`) are unaffected either way — documents are not
	// bucket-partitioned. A bucket that does not belong to the caller's
	// account+environment is rejected.
	Bucket param.Opt[string] `json:"bucket,omitzero"`
	// contains filtered or unexported fields
}

Request-scoping concerns that are orthogonal to the op itself. Carried on a `context` object so future scoping hints (e.g. as-of timestamps, read consistency) can slot in without reshaping the op-specific fields.

func (FNavigateParamsContext) MarshalJSON added in v0.21.0

func (r FNavigateParamsContext) MarshalJSON() (data []byte, err error)

func (*FNavigateParamsContext) UnmarshalJSON added in v0.21.0

func (r *FNavigateParamsContext) UnmarshalJSON(data []byte) error

type FNavigateParamsFilter added in v0.10.0

type FNavigateParamsFilter struct {
	// Match a parsed doc's source function name exactly.
	FunctionName param.Opt[string] `json:"functionName,omitzero"`
	// Substring match on canonical name (entities) or `referenceID` (parsed docs).
	// Case-insensitive.
	Search param.Opt[string] `json:"search,omitzero"`
	// Restrict to resources created at or after this timestamp.
	Since param.Opt[time.Time] `json:"since,omitzero" format:"date-time"`
	// Match an entity's `type` field exactly (e.g. `"drug"`, `"study"`).
	Type param.Opt[string] `json:"type,omitzero"`
	// contains filtered or unexported fields
}

Filter options for `op=ls` and `op=find`.

func (FNavigateParamsFilter) MarshalJSON added in v0.10.0

func (r FNavigateParamsFilter) MarshalJSON() (data []byte, err error)

func (*FNavigateParamsFilter) UnmarshalJSON added in v0.10.0

func (r *FNavigateParamsFilter) UnmarshalJSON(data []byte) error

type FNavigateParamsRange added in v0.10.0

type FNavigateParamsRange struct {
	// Restrict sections to one page (1-indexed).
	Page param.Opt[int64] `json:"page,omitzero"`
	// Restrict sections to an inclusive page range. Two-element array of `[from, to]`
	// (both 1-indexed).
	PageRange []int64 `json:"pageRange,omitzero"`
	// Keep only sections whose `type` matches one of these (e.g. `["table", "list"]`).
	SectionTypes []string `json:"sectionTypes,omitzero"`
	// contains filtered or unexported fields
}

Slice the parse output along page or section dimensions. Used with `op=cat`.

func (FNavigateParamsRange) MarshalJSON added in v0.10.0

func (r FNavigateParamsRange) MarshalJSON() (data []byte, err error)

func (*FNavigateParamsRange) UnmarshalJSON added in v0.10.0

func (r *FNavigateParamsRange) UnmarshalJSON(data []byte) error

type FNavigateResponse added in v0.10.0

type FNavigateResponse struct {
	// Op-specific payload. See per-op shapes below.
	Data any `json:"data" api:"required"`
	// Operations exposed by `POST /v3/fs`.
	//
	// The verbs and their flag names mirror Unix tools so an LLM agent's existing
	// vocabulary maps directly:
	//
	// - `ls` — list parsed documents
	// - `cat` — read one parsed doc (optionally sliced by range / projected by select)
	// - `grep` — substring or regex search across parse outputs
	// - `head` — first N sections of one doc
	// - `stat` — metadata only (page count, section count, parsed at, ...)
	// - `find` — list canonical entities (cross-doc memory)
	// - `open` — entity + mentions
	// - `xref` — entity → sections across docs that mention it
	//
	// Doc-level ops (ls, cat, grep, head, stat) work on every parsed document,
	// regardless of how the parse function was configured.
	//
	// Memory-level ops (find, open, xref) operate on the global entities table which
	// is only populated when the parse function had `linkAcrossDocuments: true`. On
	// environments with no memory-linked docs they return empty data with a hint
	// pointing at the toggle.
	//
	// Any of "ls", "find", "open", "cat", "grep", "xref", "stat", "head".
	Op FsOp `json:"op" api:"required"`
	// Set for ops that return a count rather than a list (`grep` with
	// `countOnly=true`) or as a sanity check on lists.
	Count int64 `json:"count"`
	// True when more pages exist for cursor-paginated ops.
	HasMore bool `json:"hasMore"`
	// Optional human-readable note. Surfaced on memory-level ops (`find` / `open` /
	// `xref`) when the corpus has no memory-linked docs, pointing users at the
	// `linkAcrossDocuments` toggle on the parse function.
	Hint string `json:"hint"`
	// Cursor to pass as `cursor` in the next request to fetch the next page. Empty
	// when `hasMore=false`.
	NextCursor string `json:"nextCursor"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Op          respjson.Field
		Count       respjson.Field
		HasMore     respjson.Field
		Hint        respjson.Field
		NextCursor  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Uniform response shape returned for every `op`. `data` is op-specific JSON (a list, an object, or a string), but the wrapper is constant so a client only learns one parse path.

func (FNavigateResponse) RawJSON added in v0.10.0

func (r FNavigateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FNavigateResponse) UnmarshalJSON added in v0.10.0

func (r *FNavigateResponse) UnmarshalJSON(data []byte) error

type FService added in v0.10.0

type FService struct {
	// contains filtered or unexported fields
}

Unix-shell-style nav over parsed documents and the cross-doc memory store.

`POST /v3/fs` is a single op-driven endpoint designed for LLM agents and programmatic consumers that want to walk a corpus the way they'd walk a filesystem.

## Doc-level ops (every parsed document)

- `ls` — list parsed documents with rich per-doc metadata. - `cat` — read one doc's parse JSON, sliced (`range`) or projected (`select`). - `head` — first N sections of one doc. - `grep` — substring or regex search; `scope`, `path`, `countOnly` available. - `stat` — metadata only (page/section/entity counts, timestamps).

## Memory-level ops (require `linkAcrossDocuments: true` on the parse function)

- `find` — list canonical entities across the corpus. - `open` — entity + mentions. - `xref` — for one entity, sections across docs that mention it (with content).

Memory ops return an empty list with a `hint` when no docs in this environment have been memory-linked.

## Pagination

List ops paginate by cursor — pass the previous response's `nextCursor` back as `cursor`; `hasMore: false` signals the last page. Same idiom as `/v3/calls` and `/v3/outputs`.

FService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFService method instead.

func NewFService added in v0.10.0

func NewFService(opts ...option.RequestOption) (r FService)

NewFService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FService) Navigate added in v0.10.0

func (r *FService) Navigate(ctx context.Context, body FNavigateParams, opts ...option.RequestOption) (res *FNavigateResponse, err error)

**Navigate parsed documents and the cross-doc memory store via Unix-shell verbs.**

`POST /v3/fs` is a single op-driven endpoint that lets an LLM agent (or any programmatic client) walk a corpus the way it would walk a filesystem — `ls` to list, `cat` to read, `grep` to search, `head` for a quick peek, `stat` for metadata, and `find` / `open` / `xref` for the cross-doc entity memory layer.

The body always carries an `op` field; other fields apply per op. The response envelope is uniform: `{op, data, hasMore?, nextCursor?, count?, hint?}`.

## Quick reference

| Op | `path` | Other fields | What it does | | ------ | ------------------------- | ------------------------------- | ----------------------------------------- | | `ls` | — | `filter`, `limit`, `cursor` | List parsed documents | | `grep` | referenceID _(optional)_ | `pattern`, `scope`, `countOnly` | Search across documents | | `cat` | referenceID | `range`, `select` | Read a document's parsed content | | `head` | referenceID | `n` | First N sections (default 10) | | `stat` | referenceID _or_ entityID | — | Metadata only | | `find` | — | `filter`, `limit`, `cursor` | List canonical entities | | `open` | entityID | — | Entity detail + all mentions | | `xref` | entityID | `limit`, `cursor` | Sections across docs mentioning an entity |

**`path`** is the positional identifier. For doc ops (`cat`, `head`, `stat`), pass a `referenceID` from `ls`. For entity ops (`open`, `xref`), pass an `entityID` from `find`. `grep` optionally takes a `path` to scope search to one document.

## Examples

**List documents:** `{"op": "ls"}`

**Search one document:** `{"op": "grep", "path": "my-doc-001", "pattern": "holiday", "scope": "sections"}`

**Read one page:** `{"op": "cat", "path": "my-doc-001", "range": {"page": 7}}`

**Read a page range:** `{"op": "cat", "path": "my-doc-001", "range": {"pageRange": [5, 10]}}`

**Project section labels and pages only:** `{"op": "cat", "path": "my-doc-001", "select": ["sections.label", "sections.page", "sections.type"]}`

**Preview first 5 sections:** `{"op": "head", "path": "my-doc-001", "n": 5}`

**Document metadata:** `{"op": "stat", "path": "my-doc-001"}`

**List entities:** `{"op": "find"}`

**Entity detail + mentions:** `{"op": "open", "path": "ent_abc123"}`

**Cross-document sections for an entity:** `{"op": "xref", "path": "ent_abc123"}`

## Key details

`range` is an **object** with optional keys: `page` (integer), `pageRange` (two-element array `[from, to]`), `sectionTypes` (array of strings like `["table", "heading"]`).

`select` is an **array of strings** — dotted paths like `["sections.label", "sections.page"]`.

`scope` (grep) is one of `"sections"`, `"entities"`, `"relationships"`, or `"all"` (default).

## Pagination

List ops (`ls`, `find`) paginate by cursor: pass the last item's `nextCursor` from a previous response to fetch the next page; `hasMore: false` signals the last page. Same idiom as `/v3/calls` and `/v3/outputs`.

type FsOp added in v0.14.0

type FsOp string

Operations exposed by `POST /v3/fs`.

The verbs and their flag names mirror Unix tools so an LLM agent's existing vocabulary maps directly:

- `ls` — list parsed documents - `cat` — read one parsed doc (optionally sliced by range / projected by select) - `grep` — substring or regex search across parse outputs - `head` — first N sections of one doc - `stat` — metadata only (page count, section count, parsed at, ...) - `find` — list canonical entities (cross-doc memory) - `open` — entity + mentions - `xref` — entity → sections across docs that mention it

Doc-level ops (ls, cat, grep, head, stat) work on every parsed document, regardless of how the parse function was configured.

Memory-level ops (find, open, xref) operate on the global entities table which is only populated when the parse function had `linkAcrossDocuments: true`. On environments with no memory-linked docs they return empty data with a hint pointing at the toggle.

const (
	FsOpLs   FsOp = "ls"
	FsOpFind FsOp = "find"
	FsOpOpen FsOp = "open"
	FsOpCat  FsOp = "cat"
	FsOpGrep FsOp = "grep"
	FsOpXref FsOp = "xref"
	FsOpStat FsOp = "stat"
	FsOpHead FsOp = "head"
)

type FunctionAnalyze

type FunctionAnalyze struct {
	// Whether bounding box extraction is enabled. Only applicable to analyze and
	// extract functions. When true, the function returns the document regions (page,
	// coordinates) from which each field was extracted.
	EnableBoundingBoxes bool `json:"enableBoundingBoxes" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Desired output structure defined in standard JSON Schema convention.
	OutputSchema any `json:"outputSchema" api:"required"`
	// Name of output schema object.
	OutputSchemaName string `json:"outputSchemaName" api:"required"`
	// Reducing the risk of the model stopping early on long documents. Trade-off:
	// Increases total latency.
	PreCount bool             `json:"preCount" api:"required"`
	Type     constant.Analyze `json:"type" default:"analyze"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function.
	Audit FunctionAudit `json:"audit"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EnableBoundingBoxes respjson.Field
		FunctionID          respjson.Field
		FunctionName        respjson.Field
		OutputSchema        respjson.Field
		OutputSchemaName    respjson.Field
		PreCount            respjson.Field
		Type                respjson.Field
		VersionNum          respjson.Field
		Audit               respjson.Field
		DisplayName         respjson.Field
		Tags                respjson.Field
		UsedInWorkflows     respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionAnalyze) RawJSON

func (r FunctionAnalyze) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionAnalyze) UnmarshalJSON

func (r *FunctionAnalyze) UnmarshalJSON(data []byte) error

type FunctionAudit

type FunctionAudit struct {
	// Information about who created the function.
	FunctionCreatedBy UserActionSummary `json:"functionCreatedBy"`
	// Information about who last updated the function.
	FunctionLastUpdatedBy UserActionSummary `json:"functionLastUpdatedBy"`
	// Information about who created the current version.
	VersionCreatedBy UserActionSummary `json:"versionCreatedBy"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FunctionCreatedBy     respjson.Field
		FunctionLastUpdatedBy respjson.Field
		VersionCreatedBy      respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionAudit) RawJSON

func (r FunctionAudit) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionAudit) UnmarshalJSON

func (r *FunctionAudit) UnmarshalJSON(data []byte) error

type FunctionClassify added in v0.7.0

type FunctionClassify struct {
	// List of classifications a classify function can produce. Shares the underlying
	// route list shape.
	Classifications []ClassificationListItem `json:"classifications" api:"required"`
	// Description of classifier. Can be used to provide additional context on
	// classifier's purpose and expected inputs.
	Description string `json:"description" api:"required"`
	// Email address automatically created by bem. You can forward emails with or
	// without attachments, to be classified.
	EmailAddress string `json:"emailAddress" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string            `json:"functionName" api:"required"`
	Type         constant.Classify `json:"type" default:"classify"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function.
	Audit FunctionAudit `json:"audit"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Classifications respjson.Field
		Description     respjson.Field
		EmailAddress    respjson.Field
		FunctionID      respjson.Field
		FunctionName    respjson.Field
		Type            respjson.Field
		VersionNum      respjson.Field
		Audit           respjson.Field
		DisplayName     respjson.Field
		Tags            respjson.Field
		UsedInWorkflows respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionClassify) RawJSON added in v0.7.0

func (r FunctionClassify) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionClassify) UnmarshalJSON added in v0.7.0

func (r *FunctionClassify) UnmarshalJSON(data []byte) error

type FunctionCompareMetricsParams added in v0.16.0

type FunctionCompareMetricsParams struct {
	// Name of the function to compare versions for
	FunctionName string `json:"functionName" api:"required"`
	// **Baseline version number for comparison**
	//
	// If not provided, defaults to the previous version (current - 1).
	BaselineVersionNum param.Opt[int64] `json:"baselineVersionNum,omitzero"`
	// **Comparison version number**
	//
	// If not provided, defaults to the current version.
	ComparisonVersionNum param.Opt[int64] `json:"comparisonVersionNum,omitzero"`
	// **Whether to compare regression test data only**
	//
	// If true, only compares transformations marked as regression tests.
	IsRegression param.Opt[bool] `json:"isRegression,omitzero"`
	// contains filtered or unexported fields
}

func (FunctionCompareMetricsParams) MarshalJSON added in v0.16.0

func (r FunctionCompareMetricsParams) MarshalJSON() (data []byte, err error)

func (*FunctionCompareMetricsParams) UnmarshalJSON added in v0.16.0

func (r *FunctionCompareMetricsParams) UnmarshalJSON(data []byte) error

type FunctionCompareMetricsResponse added in v0.16.0

type FunctionCompareMetricsResponse struct {
	// Baseline version number used for comparison
	BaselineVersionNum int64 `json:"baselineVersionNum" api:"required"`
	// Comparison version number
	ComparisonVersionNum int64 `json:"comparisonVersionNum" api:"required"`
	// Name of the compared function
	FunctionName string `json:"functionName" api:"required"`
	// Comparison of metrics between two versions
	AggregateComparison FunctionCompareMetricsResponseAggregateComparison `json:"aggregateComparison"`
	// Detailed performance metrics and analysis
	BaselineMetrics FunctionCompareMetricsResponseBaselineMetrics `json:"baselineMetrics"`
	// Number of transformations used to calculate baseline metrics
	BaselineTransformationCount int64 `json:"baselineTransformationCount"`
	// Detailed performance metrics and analysis
	ComparisonMetrics FunctionCompareMetricsResponseComparisonMetrics `json:"comparisonMetrics"`
	// Number of transformations used to calculate comparison metrics
	ComparisonTransformationCount int64 `json:"comparisonTransformationCount"`
	// **Field-level metrics that changed significantly**
	//
	// Only includes fields where metrics changed by more than 1%.
	FieldMetricsChanges []FunctionCompareMetricsResponseFieldMetricsChange `json:"fieldMetricsChanges"`
	// Optional message with additional details
	Message string `json:"message"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BaselineVersionNum            respjson.Field
		ComparisonVersionNum          respjson.Field
		FunctionName                  respjson.Field
		AggregateComparison           respjson.Field
		BaselineMetrics               respjson.Field
		BaselineTransformationCount   respjson.Field
		ComparisonMetrics             respjson.Field
		ComparisonTransformationCount respjson.Field
		FieldMetricsChanges           respjson.Field
		Message                       respjson.Field
		ExtraFields                   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

**Response containing metrics comparison between two function versions**

Shows absolute differences, lift percentages, and field-level changes.

func (FunctionCompareMetricsResponse) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponse) UnmarshalJSON added in v0.16.0

func (r *FunctionCompareMetricsResponse) UnmarshalJSON(data []byte) error

type FunctionCompareMetricsResponseAggregateComparison added in v0.16.0

type FunctionCompareMetricsResponseAggregateComparison struct {
	// Comparison of a single metric between two versions
	Accuracy FunctionCompareMetricsResponseAggregateComparisonAccuracy `json:"accuracy"`
	// Comparison of a single metric between two versions
	F1Score FunctionCompareMetricsResponseAggregateComparisonF1Score `json:"f1Score"`
	// Comparison of a single metric between two versions
	Precision FunctionCompareMetricsResponseAggregateComparisonPrecision `json:"precision"`
	// Comparison of a single metric between two versions
	Recall FunctionCompareMetricsResponseAggregateComparisonRecall `json:"recall"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accuracy    respjson.Field
		F1Score     respjson.Field
		Precision   respjson.Field
		Recall      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comparison of metrics between two versions

func (FunctionCompareMetricsResponseAggregateComparison) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseAggregateComparison) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseAggregateComparisonAccuracy added in v0.16.0

type FunctionCompareMetricsResponseAggregateComparisonAccuracy struct {
	// Value in baseline version (null if not available)
	BaselineValue float64 `json:"baselineValue" api:"nullable"`
	// Value in comparison version (null if not available)
	ComparisonValue float64 `json:"comparisonValue" api:"nullable"`
	// Absolute difference (comparisonValue - baselineValue)
	Difference float64 `json:"difference" api:"nullable"`
	// **Percentage change from baseline to comparison**
	//
	// Formula: ((comparisonValue - baselineValue) / baselineValue) \* 100
	//
	// - Positive values indicate improvement
	// - Negative values indicate regression
	LiftPercent float64 `json:"liftPercent" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BaselineValue   respjson.Field
		ComparisonValue respjson.Field
		Difference      respjson.Field
		LiftPercent     respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comparison of a single metric between two versions

func (FunctionCompareMetricsResponseAggregateComparisonAccuracy) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseAggregateComparisonAccuracy) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseAggregateComparisonF1Score added in v0.16.0

type FunctionCompareMetricsResponseAggregateComparisonF1Score struct {
	// Value in baseline version (null if not available)
	BaselineValue float64 `json:"baselineValue" api:"nullable"`
	// Value in comparison version (null if not available)
	ComparisonValue float64 `json:"comparisonValue" api:"nullable"`
	// Absolute difference (comparisonValue - baselineValue)
	Difference float64 `json:"difference" api:"nullable"`
	// **Percentage change from baseline to comparison**
	//
	// Formula: ((comparisonValue - baselineValue) / baselineValue) \* 100
	//
	// - Positive values indicate improvement
	// - Negative values indicate regression
	LiftPercent float64 `json:"liftPercent" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BaselineValue   respjson.Field
		ComparisonValue respjson.Field
		Difference      respjson.Field
		LiftPercent     respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comparison of a single metric between two versions

func (FunctionCompareMetricsResponseAggregateComparisonF1Score) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseAggregateComparisonF1Score) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseAggregateComparisonPrecision added in v0.16.0

type FunctionCompareMetricsResponseAggregateComparisonPrecision struct {
	// Value in baseline version (null if not available)
	BaselineValue float64 `json:"baselineValue" api:"nullable"`
	// Value in comparison version (null if not available)
	ComparisonValue float64 `json:"comparisonValue" api:"nullable"`
	// Absolute difference (comparisonValue - baselineValue)
	Difference float64 `json:"difference" api:"nullable"`
	// **Percentage change from baseline to comparison**
	//
	// Formula: ((comparisonValue - baselineValue) / baselineValue) \* 100
	//
	// - Positive values indicate improvement
	// - Negative values indicate regression
	LiftPercent float64 `json:"liftPercent" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BaselineValue   respjson.Field
		ComparisonValue respjson.Field
		Difference      respjson.Field
		LiftPercent     respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comparison of a single metric between two versions

func (FunctionCompareMetricsResponseAggregateComparisonPrecision) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseAggregateComparisonPrecision) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseAggregateComparisonRecall added in v0.16.0

type FunctionCompareMetricsResponseAggregateComparisonRecall struct {
	// Value in baseline version (null if not available)
	BaselineValue float64 `json:"baselineValue" api:"nullable"`
	// Value in comparison version (null if not available)
	ComparisonValue float64 `json:"comparisonValue" api:"nullable"`
	// Absolute difference (comparisonValue - baselineValue)
	Difference float64 `json:"difference" api:"nullable"`
	// **Percentage change from baseline to comparison**
	//
	// Formula: ((comparisonValue - baselineValue) / baselineValue) \* 100
	//
	// - Positive values indicate improvement
	// - Negative values indicate regression
	LiftPercent float64 `json:"liftPercent" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BaselineValue   respjson.Field
		ComparisonValue respjson.Field
		Difference      respjson.Field
		LiftPercent     respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comparison of a single metric between two versions

func (FunctionCompareMetricsResponseAggregateComparisonRecall) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseAggregateComparisonRecall) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseBaselineMetrics added in v0.16.0

type FunctionCompareMetricsResponseBaselineMetrics struct {
	// Comprehensive performance metrics
	AggregateMetrics FunctionCompareMetricsResponseBaselineMetricsAggregateMetrics `json:"aggregateMetrics"`
	// Enhanced field metrics with comprehensive analytics
	FieldMetrics []FunctionCompareMetricsResponseBaselineMetricsFieldMetric `json:"fieldMetrics"`
	// Area Under the Precision-Recall Curve
	PrecisionRecallAuc float64 `json:"precisionRecallAuc"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AggregateMetrics   respjson.Field
		FieldMetrics       respjson.Field
		PrecisionRecallAuc respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Detailed performance metrics and analysis

func (FunctionCompareMetricsResponseBaselineMetrics) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseBaselineMetrics) UnmarshalJSON added in v0.16.0

func (r *FunctionCompareMetricsResponseBaselineMetrics) UnmarshalJSON(data []byte) error

type FunctionCompareMetricsResponseBaselineMetricsAggregateMetrics added in v0.16.0

type FunctionCompareMetricsResponseBaselineMetricsAggregateMetrics struct {
	// Overall accuracy
	Accuracy float64 `json:"accuracy" api:"nullable"`
	// F1 Score (harmonic mean of precision and recall)
	F1Score float64 `json:"f1Score" api:"nullable"`
	// False Negatives
	Fn int64 `json:"fn"`
	// False Positives
	Fp int64 `json:"fp"`
	// Precision (TP / (TP + FP))
	Precision float64 `json:"precision" api:"nullable"`
	// Recall (TP / (TP + FN))
	Recall float64 `json:"recall" api:"nullable"`
	// True Negatives
	Tn int64 `json:"tn"`
	// True Positives
	Tp int64 `json:"tp"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accuracy    respjson.Field
		F1Score     respjson.Field
		Fn          respjson.Field
		Fp          respjson.Field
		Precision   respjson.Field
		Recall      respjson.Field
		Tn          respjson.Field
		Tp          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comprehensive performance metrics

func (FunctionCompareMetricsResponseBaselineMetricsAggregateMetrics) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseBaselineMetricsAggregateMetrics) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseBaselineMetricsFieldMetric added in v0.16.0

type FunctionCompareMetricsResponseBaselineMetricsFieldMetric struct {
	// JSON path to the field
	FieldPath string `json:"fieldPath" api:"required"`
	// Comprehensive performance metrics
	Metrics FunctionCompareMetricsResponseBaselineMetricsFieldMetricMetrics `json:"metrics"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FieldPath   respjson.Field
		Metrics     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Enhanced field metrics with comprehensive analytics

func (FunctionCompareMetricsResponseBaselineMetricsFieldMetric) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseBaselineMetricsFieldMetric) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseBaselineMetricsFieldMetricMetrics added in v0.16.0

type FunctionCompareMetricsResponseBaselineMetricsFieldMetricMetrics struct {
	// Overall accuracy
	Accuracy float64 `json:"accuracy" api:"nullable"`
	// F1 Score (harmonic mean of precision and recall)
	F1Score float64 `json:"f1Score" api:"nullable"`
	// False Negatives
	Fn int64 `json:"fn"`
	// False Positives
	Fp int64 `json:"fp"`
	// Precision (TP / (TP + FP))
	Precision float64 `json:"precision" api:"nullable"`
	// Recall (TP / (TP + FN))
	Recall float64 `json:"recall" api:"nullable"`
	// True Negatives
	Tn int64 `json:"tn"`
	// True Positives
	Tp int64 `json:"tp"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accuracy    respjson.Field
		F1Score     respjson.Field
		Fn          respjson.Field
		Fp          respjson.Field
		Precision   respjson.Field
		Recall      respjson.Field
		Tn          respjson.Field
		Tp          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comprehensive performance metrics

func (FunctionCompareMetricsResponseBaselineMetricsFieldMetricMetrics) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseBaselineMetricsFieldMetricMetrics) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseComparisonMetrics added in v0.16.0

type FunctionCompareMetricsResponseComparisonMetrics struct {
	// Comprehensive performance metrics
	AggregateMetrics FunctionCompareMetricsResponseComparisonMetricsAggregateMetrics `json:"aggregateMetrics"`
	// Enhanced field metrics with comprehensive analytics
	FieldMetrics []FunctionCompareMetricsResponseComparisonMetricsFieldMetric `json:"fieldMetrics"`
	// Area Under the Precision-Recall Curve
	PrecisionRecallAuc float64 `json:"precisionRecallAuc"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AggregateMetrics   respjson.Field
		FieldMetrics       respjson.Field
		PrecisionRecallAuc respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Detailed performance metrics and analysis

func (FunctionCompareMetricsResponseComparisonMetrics) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseComparisonMetrics) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseComparisonMetricsAggregateMetrics added in v0.16.0

type FunctionCompareMetricsResponseComparisonMetricsAggregateMetrics struct {
	// Overall accuracy
	Accuracy float64 `json:"accuracy" api:"nullable"`
	// F1 Score (harmonic mean of precision and recall)
	F1Score float64 `json:"f1Score" api:"nullable"`
	// False Negatives
	Fn int64 `json:"fn"`
	// False Positives
	Fp int64 `json:"fp"`
	// Precision (TP / (TP + FP))
	Precision float64 `json:"precision" api:"nullable"`
	// Recall (TP / (TP + FN))
	Recall float64 `json:"recall" api:"nullable"`
	// True Negatives
	Tn int64 `json:"tn"`
	// True Positives
	Tp int64 `json:"tp"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accuracy    respjson.Field
		F1Score     respjson.Field
		Fn          respjson.Field
		Fp          respjson.Field
		Precision   respjson.Field
		Recall      respjson.Field
		Tn          respjson.Field
		Tp          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comprehensive performance metrics

func (FunctionCompareMetricsResponseComparisonMetricsAggregateMetrics) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseComparisonMetricsAggregateMetrics) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseComparisonMetricsFieldMetric added in v0.16.0

type FunctionCompareMetricsResponseComparisonMetricsFieldMetric struct {
	// JSON path to the field
	FieldPath string `json:"fieldPath" api:"required"`
	// Comprehensive performance metrics
	Metrics FunctionCompareMetricsResponseComparisonMetricsFieldMetricMetrics `json:"metrics"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FieldPath   respjson.Field
		Metrics     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Enhanced field metrics with comprehensive analytics

func (FunctionCompareMetricsResponseComparisonMetricsFieldMetric) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseComparisonMetricsFieldMetric) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseComparisonMetricsFieldMetricMetrics added in v0.16.0

type FunctionCompareMetricsResponseComparisonMetricsFieldMetricMetrics struct {
	// Overall accuracy
	Accuracy float64 `json:"accuracy" api:"nullable"`
	// F1 Score (harmonic mean of precision and recall)
	F1Score float64 `json:"f1Score" api:"nullable"`
	// False Negatives
	Fn int64 `json:"fn"`
	// False Positives
	Fp int64 `json:"fp"`
	// Precision (TP / (TP + FP))
	Precision float64 `json:"precision" api:"nullable"`
	// Recall (TP / (TP + FN))
	Recall float64 `json:"recall" api:"nullable"`
	// True Negatives
	Tn int64 `json:"tn"`
	// True Positives
	Tp int64 `json:"tp"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accuracy    respjson.Field
		F1Score     respjson.Field
		Fn          respjson.Field
		Fp          respjson.Field
		Precision   respjson.Field
		Recall      respjson.Field
		Tn          respjson.Field
		Tp          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comprehensive performance metrics

func (FunctionCompareMetricsResponseComparisonMetricsFieldMetricMetrics) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseComparisonMetricsFieldMetricMetrics) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseFieldMetricsChange added in v0.16.0

type FunctionCompareMetricsResponseFieldMetricsChange struct {
	// Comparison of metrics between two versions
	Comparison FunctionCompareMetricsResponseFieldMetricsChangeComparison `json:"comparison" api:"required"`
	// JSON pointer path to the field
	FieldPath string `json:"fieldPath" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Comparison  respjson.Field
		FieldPath   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comparison of field-level metrics

func (FunctionCompareMetricsResponseFieldMetricsChange) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseFieldMetricsChange) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseFieldMetricsChangeComparison added in v0.16.0

type FunctionCompareMetricsResponseFieldMetricsChangeComparison struct {
	// Comparison of a single metric between two versions
	Accuracy FunctionCompareMetricsResponseFieldMetricsChangeComparisonAccuracy `json:"accuracy"`
	// Comparison of a single metric between two versions
	F1Score FunctionCompareMetricsResponseFieldMetricsChangeComparisonF1Score `json:"f1Score"`
	// Comparison of a single metric between two versions
	Precision FunctionCompareMetricsResponseFieldMetricsChangeComparisonPrecision `json:"precision"`
	// Comparison of a single metric between two versions
	Recall FunctionCompareMetricsResponseFieldMetricsChangeComparisonRecall `json:"recall"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accuracy    respjson.Field
		F1Score     respjson.Field
		Precision   respjson.Field
		Recall      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comparison of metrics between two versions

func (FunctionCompareMetricsResponseFieldMetricsChangeComparison) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseFieldMetricsChangeComparison) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseFieldMetricsChangeComparisonAccuracy added in v0.16.0

type FunctionCompareMetricsResponseFieldMetricsChangeComparisonAccuracy struct {
	// Value in baseline version (null if not available)
	BaselineValue float64 `json:"baselineValue" api:"nullable"`
	// Value in comparison version (null if not available)
	ComparisonValue float64 `json:"comparisonValue" api:"nullable"`
	// Absolute difference (comparisonValue - baselineValue)
	Difference float64 `json:"difference" api:"nullable"`
	// **Percentage change from baseline to comparison**
	//
	// Formula: ((comparisonValue - baselineValue) / baselineValue) \* 100
	//
	// - Positive values indicate improvement
	// - Negative values indicate regression
	LiftPercent float64 `json:"liftPercent" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BaselineValue   respjson.Field
		ComparisonValue respjson.Field
		Difference      respjson.Field
		LiftPercent     respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comparison of a single metric between two versions

func (FunctionCompareMetricsResponseFieldMetricsChangeComparisonAccuracy) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseFieldMetricsChangeComparisonAccuracy) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseFieldMetricsChangeComparisonF1Score added in v0.16.0

type FunctionCompareMetricsResponseFieldMetricsChangeComparisonF1Score struct {
	// Value in baseline version (null if not available)
	BaselineValue float64 `json:"baselineValue" api:"nullable"`
	// Value in comparison version (null if not available)
	ComparisonValue float64 `json:"comparisonValue" api:"nullable"`
	// Absolute difference (comparisonValue - baselineValue)
	Difference float64 `json:"difference" api:"nullable"`
	// **Percentage change from baseline to comparison**
	//
	// Formula: ((comparisonValue - baselineValue) / baselineValue) \* 100
	//
	// - Positive values indicate improvement
	// - Negative values indicate regression
	LiftPercent float64 `json:"liftPercent" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BaselineValue   respjson.Field
		ComparisonValue respjson.Field
		Difference      respjson.Field
		LiftPercent     respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comparison of a single metric between two versions

func (FunctionCompareMetricsResponseFieldMetricsChangeComparisonF1Score) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseFieldMetricsChangeComparisonF1Score) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseFieldMetricsChangeComparisonPrecision added in v0.16.0

type FunctionCompareMetricsResponseFieldMetricsChangeComparisonPrecision struct {
	// Value in baseline version (null if not available)
	BaselineValue float64 `json:"baselineValue" api:"nullable"`
	// Value in comparison version (null if not available)
	ComparisonValue float64 `json:"comparisonValue" api:"nullable"`
	// Absolute difference (comparisonValue - baselineValue)
	Difference float64 `json:"difference" api:"nullable"`
	// **Percentage change from baseline to comparison**
	//
	// Formula: ((comparisonValue - baselineValue) / baselineValue) \* 100
	//
	// - Positive values indicate improvement
	// - Negative values indicate regression
	LiftPercent float64 `json:"liftPercent" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BaselineValue   respjson.Field
		ComparisonValue respjson.Field
		Difference      respjson.Field
		LiftPercent     respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comparison of a single metric between two versions

func (FunctionCompareMetricsResponseFieldMetricsChangeComparisonPrecision) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseFieldMetricsChangeComparisonPrecision) UnmarshalJSON added in v0.16.0

type FunctionCompareMetricsResponseFieldMetricsChangeComparisonRecall added in v0.16.0

type FunctionCompareMetricsResponseFieldMetricsChangeComparisonRecall struct {
	// Value in baseline version (null if not available)
	BaselineValue float64 `json:"baselineValue" api:"nullable"`
	// Value in comparison version (null if not available)
	ComparisonValue float64 `json:"comparisonValue" api:"nullable"`
	// Absolute difference (comparisonValue - baselineValue)
	Difference float64 `json:"difference" api:"nullable"`
	// **Percentage change from baseline to comparison**
	//
	// Formula: ((comparisonValue - baselineValue) / baselineValue) \* 100
	//
	// - Positive values indicate improvement
	// - Negative values indicate regression
	LiftPercent float64 `json:"liftPercent" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BaselineValue   respjson.Field
		ComparisonValue respjson.Field
		Difference      respjson.Field
		LiftPercent     respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comparison of a single metric between two versions

func (FunctionCompareMetricsResponseFieldMetricsChangeComparisonRecall) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionCompareMetricsResponseFieldMetricsChangeComparisonRecall) UnmarshalJSON added in v0.16.0

type FunctionCopyNewParams

type FunctionCopyNewParams struct {
	// Request to copy an existing function with a new name and optional
	// customizations.
	FunctionCopyRequest FunctionCopyRequestParam
	// contains filtered or unexported fields
}

func (FunctionCopyNewParams) MarshalJSON

func (r FunctionCopyNewParams) MarshalJSON() (data []byte, err error)

func (*FunctionCopyNewParams) UnmarshalJSON

func (r *FunctionCopyNewParams) UnmarshalJSON(data []byte) error

type FunctionCopyRequestParam

type FunctionCopyRequestParam struct {
	// Name of the function to copy from. Must be a valid existing function name.
	SourceFunctionName string `json:"sourceFunctionName" api:"required"`
	// Name for the new copied function. Must be unique within the target environment.
	TargetFunctionName string `json:"targetFunctionName" api:"required"`
	// Optional display name for the copied function. If not provided, defaults to the
	// source function's display name with " (Copy)" appended.
	TargetDisplayName param.Opt[string] `json:"targetDisplayName,omitzero"`
	// Optional environment name to copy the function to. If not provided, the function
	// will be copied within the same environment.
	TargetEnvironment param.Opt[string] `json:"targetEnvironment,omitzero"`
	// Optional array of tags for the copied function. If not provided, defaults to the
	// source function's tags.
	Tags []string `json:"tags,omitzero"`
	// contains filtered or unexported fields
}

Request to copy an existing function with a new name and optional customizations.

The properties SourceFunctionName, TargetFunctionName are required.

func (FunctionCopyRequestParam) MarshalJSON

func (r FunctionCopyRequestParam) MarshalJSON() (data []byte, err error)

func (*FunctionCopyRequestParam) UnmarshalJSON

func (r *FunctionCopyRequestParam) UnmarshalJSON(data []byte) error

type FunctionCopyService

type FunctionCopyService struct {
	// contains filtered or unexported fields
}

Functions are the core building blocks of data transformation in Bem. Each function type serves a specific purpose:

  • **Extract**: Extract structured JSON data from unstructured documents (PDFs, emails, images, spreadsheets), with optional layout-aware bounding-box extraction
  • **Route**: Direct data to different processing paths based on conditions
  • **Split**: Break multi-page documents into individual pages for parallel processing
  • **Join**: Combine outputs from multiple function calls into a single result
  • **Parse**: Render documents into a navigable structure of page-aware sections, named entities, and relationships — designed to be walked by an LLM agent via the [File System API](/api/v3/file-system) (`POST /v3/fs`). Two toggles, both `true` by default: `extractEntities` controls per-document entity and relationship extraction; `linkAcrossDocuments` merges entities into one canonical record per real-world thing across the environment, populating cross-document memory.
  • **Payload Shaping**: Transform and restructure data using JMESPath expressions
  • **Enrich**: Enhance data with semantic search against collections
  • **Send**: Deliver workflow outputs to downstream destinations

Use these endpoints to create, update, list, and manage your functions.

FunctionCopyService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFunctionCopyService method instead.

func NewFunctionCopyService

func NewFunctionCopyService(opts ...option.RequestOption) (r FunctionCopyService)

NewFunctionCopyService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FunctionCopyService) New

**Copy a function to a new name within the same environment.**

Forks the source function's current configuration into a brand-new function. The copy starts at `versionNum: 1` regardless of how many versions the source has — version history is not carried over.

Useful for experimenting with schema or prompt changes against a stable production function without disturbing existing callers.

The destination name must be unique in the environment. A copy does not migrate workflows: existing workflow nodes continue to reference the original function.

type FunctionEnrich

type FunctionEnrich struct {
	// Configuration for an enrich function.
	//
	// **How Enrich Functions Work:**
	//
	// Enrich functions augment JSON input with data from external sources. They take
	// JSON input (typically from a previous function), extract specified fields, fetch
	// or search for matching data, and inject the results back into the JSON.
	//
	// **Data Sources:**
	//
	//   - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
	//     collection. Best for semantic matching against pre-indexed documents.
	//   - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
	//     Best for looking up live data from CRMs, ERPs, or other external systems.
	//     Optionally uses LLM agent reasoning to rank candidates returned by the
	//     endpoint.
	//
	// **Input Requirements:**
	//
	// - Must receive JSON input (typically from a previous function's output)
	//
	// **Example Use Cases:**
	//
	//   - Match product descriptions to SKU codes from a product catalog collection
	//   - Enrich customer data with account details from a CRM endpoint
	//   - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
	//     products
	//
	// **Configuration:**
	//
	// - Define named endpoints (for endpoint-source steps)
	// - Define one or more enrichment steps; steps are executed sequentially
	Config EnrichConfig `json:"config" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string          `json:"functionName" api:"required"`
	Type         constant.Enrich `json:"type" default:"enrich"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function.
	Audit FunctionAudit `json:"audit"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Config          respjson.Field
		FunctionID      respjson.Field
		FunctionName    respjson.Field
		Type            respjson.Field
		VersionNum      respjson.Field
		Audit           respjson.Field
		DisplayName     respjson.Field
		Tags            respjson.Field
		UsedInWorkflows respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionEnrich) RawJSON

func (r FunctionEnrich) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionEnrich) UnmarshalJSON

func (r *FunctionEnrich) UnmarshalJSON(data []byte) error

type FunctionEstimateReviewRequirementsParams added in v0.16.0

type FunctionEstimateReviewRequirementsParams struct {
	// Name of the function to analyze
	FunctionName string `json:"functionName" api:"required"`
	// Optional function version number to analyze. If not provided, uses the
	// latest/current version of the function.
	FunctionVersionNum param.Opt[int64] `json:"functionVersionNum,omitzero"`
	// Internal flag indicating if the request is from a regression test
	IsRegression param.Opt[bool] `json:"isRegression,omitzero"`
	// Margin of error for statistical calculations
	MarginOfError param.Opt[float64] `json:"marginOfError,omitzero"`
	// Maximum confidence threshold to analyze
	ThresholdMax param.Opt[float64] `json:"thresholdMax,omitzero"`
	// Minimum confidence threshold to analyze
	ThresholdMin param.Opt[float64] `json:"thresholdMin,omitzero"`
	// Step size for threshold analysis (smaller = more granular)
	ThresholdStep param.Opt[float64] `json:"thresholdStep,omitzero"`
	// Confidence levels for statistical analysis as integers representing percentages
	// (e.g., [90, 95, 99] for 90%, 95%, 99%). IMPORTANT: Only integers are accepted,
	// floats like 0.95 will be rejected.
	ConfidenceLevels []int64 `json:"confidenceLevels,omitzero"`
	// Confidence interval calculation method (default "wald").
	//
	// - "wald": Normal approximation method (faster, standard)
	// - "wilson": Wilson score interval (more robust for extreme rates)
	//
	// Any of "wald", "wilson".
	ConfidenceMethod FunctionEstimateReviewRequirementsParamsConfidenceMethod `json:"confidenceMethod,omitzero"`
	// Optional evaluation version to filter evaluations by. Must be one of the
	// supported versions. If not provided, defaults to "0.1.0-gemini".
	//
	// Any of "0.1.0-gemini".
	EvaluationVersion FunctionEstimateReviewRequirementsParamsEvaluationVersion `json:"evaluationVersion,omitzero"`
	// contains filtered or unexported fields
}

func (FunctionEstimateReviewRequirementsParams) MarshalJSON added in v0.16.0

func (r FunctionEstimateReviewRequirementsParams) MarshalJSON() (data []byte, err error)

func (*FunctionEstimateReviewRequirementsParams) UnmarshalJSON added in v0.16.0

func (r *FunctionEstimateReviewRequirementsParams) UnmarshalJSON(data []byte) error

type FunctionEstimateReviewRequirementsParamsConfidenceMethod added in v0.16.0

type FunctionEstimateReviewRequirementsParamsConfidenceMethod string

Confidence interval calculation method (default "wald").

- "wald": Normal approximation method (faster, standard) - "wilson": Wilson score interval (more robust for extreme rates)

const (
	FunctionEstimateReviewRequirementsParamsConfidenceMethodWald   FunctionEstimateReviewRequirementsParamsConfidenceMethod = "wald"
	FunctionEstimateReviewRequirementsParamsConfidenceMethodWilson FunctionEstimateReviewRequirementsParamsConfidenceMethod = "wilson"
)

type FunctionEstimateReviewRequirementsParamsEvaluationVersion added in v0.16.0

type FunctionEstimateReviewRequirementsParamsEvaluationVersion string

Optional evaluation version to filter evaluations by. Must be one of the supported versions. If not provided, defaults to "0.1.0-gemini".

const (
	FunctionEstimateReviewRequirementsParamsEvaluationVersion0_1_0Gemini FunctionEstimateReviewRequirementsParamsEvaluationVersion = "0.1.0-gemini"
)

type FunctionEstimateReviewRequirementsResponse added in v0.16.0

type FunctionEstimateReviewRequirementsResponse struct {
	// Detailed review requirements estimate
	Estimate FunctionEstimateReviewRequirementsResponseEstimate `json:"estimate" api:"required"`
	// Name of the analyzed function
	FunctionName string `json:"functionName" api:"required"`
	// Version number of the function that was analyzed
	FunctionVersionNum int64 `json:"functionVersionNum" api:"required"`
	// Detailed performance metrics and analysis
	Metrics FunctionEstimateReviewRequirementsResponseMetrics `json:"metrics"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Estimate           respjson.Field
		FunctionName       respjson.Field
		FunctionVersionNum respjson.Field
		Metrics            respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response containing review requirements estimate

func (FunctionEstimateReviewRequirementsResponse) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponse) UnmarshalJSON added in v0.16.0

func (r *FunctionEstimateReviewRequirementsResponse) UnmarshalJSON(data []byte) error

type FunctionEstimateReviewRequirementsResponseEstimate added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimate struct {
	// Distribution of confidence levels
	ConfidenceDistribution FunctionEstimateReviewRequirementsResponseEstimateConfidenceDistribution `json:"confidenceDistribution" api:"required"`
	// Number of transformations already labeled
	LabeledTransformations int64 `json:"labeledTransformations" api:"required"`
	// Number of transformations without evaluation data
	MissingEvaluations int64 `json:"missingEvaluations" api:"required"`
	// Statistical analysis across confidence thresholds
	ThresholdMatrix []FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrix `json:"thresholdMatrix" api:"required"`
	// Total number of transformations analyzed
	TotalTransformations int64 `json:"totalTransformations" api:"required"`
	// Number of transformations not yet labeled
	UnlabeledTransformations int64 `json:"unlabeledTransformations" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConfidenceDistribution   respjson.Field
		LabeledTransformations   respjson.Field
		MissingEvaluations       respjson.Field
		ThresholdMatrix          respjson.Field
		TotalTransformations     respjson.Field
		UnlabeledTransformations respjson.Field
		ExtraFields              map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Detailed review requirements estimate

func (FunctionEstimateReviewRequirementsResponseEstimate) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseEstimate) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateConfidenceDistribution added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateConfidenceDistribution struct {
	High   int64 `json:"high"`
	Low    int64 `json:"low"`
	Medium int64 `json:"medium"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		High        respjson.Field
		Low         respjson.Field
		Medium      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Distribution of confidence levels

func (FunctionEstimateReviewRequirementsResponseEstimateConfidenceDistribution) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseEstimateConfidenceDistribution) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrix added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrix struct {
	// False Negatives
	Fn int64 `json:"fn" api:"required"`
	// False Positives
	Fp int64 `json:"fp" api:"required"`
	// Confidence threshold value
	Threshold float64 `json:"threshold" api:"required"`
	// True Negatives
	Tn int64 `json:"tn" api:"required"`
	// True Positives
	Tp int64 `json:"tp" api:"required"`
	// Accuracy confidence intervals for samples above threshold, by confidence level.
	// Keys are confidence levels as strings ("90", "95", "99"). Values contain
	// statistical confidence intervals.
	AccuracyAboveThreshold FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixAccuracyAboveThreshold `json:"accuracyAboveThreshold"`
	// False Discovery Rate confidence intervals by confidence level. Keys are
	// confidence levels as strings ("90", "95", "99"). Values contain statistical
	// confidence intervals.
	FalseDiscoveryRate FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalseDiscoveryRate `json:"falseDiscoveryRate"`
	// False Positive Rate confidence intervals by confidence level. Keys are
	// confidence levels as strings ("90", "95", "99"). Values contain statistical
	// confidence intervals.
	FalsePositiveRate FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalsePositiveRate `json:"falsePositiveRate"`
	// Precision confidence intervals by confidence level. Keys are confidence levels
	// as strings ("90", "95", "99"). Values contain statistical confidence intervals.
	Precision FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixPrecision `json:"precision"`
	// Recall confidence intervals by confidence level. Keys are confidence levels as
	// strings ("90", "95", "99"). Values contain statistical confidence intervals.
	Recall FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixRecall `json:"recall"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Fn                     respjson.Field
		Fp                     respjson.Field
		Threshold              respjson.Field
		Tn                     respjson.Field
		Tp                     respjson.Field
		AccuracyAboveThreshold respjson.Field
		FalseDiscoveryRate     respjson.Field
		FalsePositiveRate      respjson.Field
		Precision              respjson.Field
		Recall                 respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Results for a specific confidence threshold analysis

func (FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrix) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrix) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixAccuracyAboveThreshold added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixAccuracyAboveThreshold struct {
	// Confidence interval for a rate/proportion using Wald (normal approximation)
	// method by default.
	//
	// Wald confidence intervals use the normal approximation to the binomial
	// distribution. For extreme rates or small sample sizes, Wilson confidence
	// intervals may be more appropriate.
	Number95 FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixAccuracyAboveThreshold95 `json:"95"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Number95    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Accuracy confidence intervals for samples above threshold, by confidence level. Keys are confidence levels as strings ("90", "95", "99"). Values contain statistical confidence intervals.

func (FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixAccuracyAboveThreshold) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixAccuracyAboveThreshold) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixAccuracyAboveThreshold95 added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixAccuracyAboveThreshold95 struct {
	// Current number of samples/observations available
	CurrentSample int64 `json:"currentSample" api:"required"`
	// Minimum number of samples needed for reliable confidence interval calculation
	SampleNeeded int64 `json:"sampleNeeded" api:"required"`
	// Lower bound of the confidence interval (null if insufficient sample size)
	CiLower float64 `json:"ciLower" api:"nullable"`
	// Upper bound of the confidence interval (null if insufficient sample size)
	CiUpper float64 `json:"ciUpper" api:"nullable"`
	// Point estimate (observed rate) at the center of the interval (null if
	// insufficient sample size)
	Mid float64 `json:"mid" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CurrentSample respjson.Field
		SampleNeeded  respjson.Field
		CiLower       respjson.Field
		CiUpper       respjson.Field
		Mid           respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Confidence interval for a rate/proportion using Wald (normal approximation) method by default.

Wald confidence intervals use the normal approximation to the binomial distribution. For extreme rates or small sample sizes, Wilson confidence intervals may be more appropriate.

func (FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixAccuracyAboveThreshold95) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixAccuracyAboveThreshold95) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalseDiscoveryRate added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalseDiscoveryRate struct {
	// Confidence interval for a rate/proportion using Wald (normal approximation)
	// method by default.
	//
	// Wald confidence intervals use the normal approximation to the binomial
	// distribution. For extreme rates or small sample sizes, Wilson confidence
	// intervals may be more appropriate.
	Number95 FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalseDiscoveryRate95 `json:"95"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Number95    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

False Discovery Rate confidence intervals by confidence level. Keys are confidence levels as strings ("90", "95", "99"). Values contain statistical confidence intervals.

func (FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalseDiscoveryRate) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalseDiscoveryRate) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalseDiscoveryRate95 added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalseDiscoveryRate95 struct {
	// Current number of samples/observations available
	CurrentSample int64 `json:"currentSample" api:"required"`
	// Minimum number of samples needed for reliable confidence interval calculation
	SampleNeeded int64 `json:"sampleNeeded" api:"required"`
	// Lower bound of the confidence interval (null if insufficient sample size)
	CiLower float64 `json:"ciLower" api:"nullable"`
	// Upper bound of the confidence interval (null if insufficient sample size)
	CiUpper float64 `json:"ciUpper" api:"nullable"`
	// Point estimate (observed rate) at the center of the interval (null if
	// insufficient sample size)
	Mid float64 `json:"mid" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CurrentSample respjson.Field
		SampleNeeded  respjson.Field
		CiLower       respjson.Field
		CiUpper       respjson.Field
		Mid           respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Confidence interval for a rate/proportion using Wald (normal approximation) method by default.

Wald confidence intervals use the normal approximation to the binomial distribution. For extreme rates or small sample sizes, Wilson confidence intervals may be more appropriate.

func (FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalseDiscoveryRate95) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalseDiscoveryRate95) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalsePositiveRate added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalsePositiveRate struct {
	// Confidence interval for a rate/proportion using Wald (normal approximation)
	// method by default.
	//
	// Wald confidence intervals use the normal approximation to the binomial
	// distribution. For extreme rates or small sample sizes, Wilson confidence
	// intervals may be more appropriate.
	Number95 FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalsePositiveRate95 `json:"95"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Number95    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

False Positive Rate confidence intervals by confidence level. Keys are confidence levels as strings ("90", "95", "99"). Values contain statistical confidence intervals.

func (FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalsePositiveRate) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalsePositiveRate) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalsePositiveRate95 added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalsePositiveRate95 struct {
	// Current number of samples/observations available
	CurrentSample int64 `json:"currentSample" api:"required"`
	// Minimum number of samples needed for reliable confidence interval calculation
	SampleNeeded int64 `json:"sampleNeeded" api:"required"`
	// Lower bound of the confidence interval (null if insufficient sample size)
	CiLower float64 `json:"ciLower" api:"nullable"`
	// Upper bound of the confidence interval (null if insufficient sample size)
	CiUpper float64 `json:"ciUpper" api:"nullable"`
	// Point estimate (observed rate) at the center of the interval (null if
	// insufficient sample size)
	Mid float64 `json:"mid" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CurrentSample respjson.Field
		SampleNeeded  respjson.Field
		CiLower       respjson.Field
		CiUpper       respjson.Field
		Mid           respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Confidence interval for a rate/proportion using Wald (normal approximation) method by default.

Wald confidence intervals use the normal approximation to the binomial distribution. For extreme rates or small sample sizes, Wilson confidence intervals may be more appropriate.

func (FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalsePositiveRate95) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixFalsePositiveRate95) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixPrecision added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixPrecision struct {
	// Confidence interval for a rate/proportion using Wald (normal approximation)
	// method by default.
	//
	// Wald confidence intervals use the normal approximation to the binomial
	// distribution. For extreme rates or small sample sizes, Wilson confidence
	// intervals may be more appropriate.
	Number95 FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixPrecision95 `json:"95"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Number95    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Precision confidence intervals by confidence level. Keys are confidence levels as strings ("90", "95", "99"). Values contain statistical confidence intervals.

func (FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixPrecision) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixPrecision) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixPrecision95 added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixPrecision95 struct {
	// Current number of samples/observations available
	CurrentSample int64 `json:"currentSample" api:"required"`
	// Minimum number of samples needed for reliable confidence interval calculation
	SampleNeeded int64 `json:"sampleNeeded" api:"required"`
	// Lower bound of the confidence interval (null if insufficient sample size)
	CiLower float64 `json:"ciLower" api:"nullable"`
	// Upper bound of the confidence interval (null if insufficient sample size)
	CiUpper float64 `json:"ciUpper" api:"nullable"`
	// Point estimate (observed rate) at the center of the interval (null if
	// insufficient sample size)
	Mid float64 `json:"mid" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CurrentSample respjson.Field
		SampleNeeded  respjson.Field
		CiLower       respjson.Field
		CiUpper       respjson.Field
		Mid           respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Confidence interval for a rate/proportion using Wald (normal approximation) method by default.

Wald confidence intervals use the normal approximation to the binomial distribution. For extreme rates or small sample sizes, Wilson confidence intervals may be more appropriate.

func (FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixPrecision95) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixPrecision95) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixRecall added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixRecall struct {
	// Confidence interval for a rate/proportion using Wald (normal approximation)
	// method by default.
	//
	// Wald confidence intervals use the normal approximation to the binomial
	// distribution. For extreme rates or small sample sizes, Wilson confidence
	// intervals may be more appropriate.
	Number95 FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixRecall95 `json:"95"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Number95    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Recall confidence intervals by confidence level. Keys are confidence levels as strings ("90", "95", "99"). Values contain statistical confidence intervals.

func (FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixRecall) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixRecall) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixRecall95 added in v0.16.0

type FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixRecall95 struct {
	// Current number of samples/observations available
	CurrentSample int64 `json:"currentSample" api:"required"`
	// Minimum number of samples needed for reliable confidence interval calculation
	SampleNeeded int64 `json:"sampleNeeded" api:"required"`
	// Lower bound of the confidence interval (null if insufficient sample size)
	CiLower float64 `json:"ciLower" api:"nullable"`
	// Upper bound of the confidence interval (null if insufficient sample size)
	CiUpper float64 `json:"ciUpper" api:"nullable"`
	// Point estimate (observed rate) at the center of the interval (null if
	// insufficient sample size)
	Mid float64 `json:"mid" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CurrentSample respjson.Field
		SampleNeeded  respjson.Field
		CiLower       respjson.Field
		CiUpper       respjson.Field
		Mid           respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Confidence interval for a rate/proportion using Wald (normal approximation) method by default.

Wald confidence intervals use the normal approximation to the binomial distribution. For extreme rates or small sample sizes, Wilson confidence intervals may be more appropriate.

func (FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixRecall95) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseEstimateThresholdMatrixRecall95) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseMetrics added in v0.16.0

type FunctionEstimateReviewRequirementsResponseMetrics struct {
	// Comprehensive performance metrics
	AggregateMetrics FunctionEstimateReviewRequirementsResponseMetricsAggregateMetrics `json:"aggregateMetrics"`
	// Enhanced field metrics with comprehensive analytics
	FieldMetrics []FunctionEstimateReviewRequirementsResponseMetricsFieldMetric `json:"fieldMetrics"`
	// Area Under the Precision-Recall Curve
	PrecisionRecallAuc float64 `json:"precisionRecallAuc"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AggregateMetrics   respjson.Field
		FieldMetrics       respjson.Field
		PrecisionRecallAuc respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Detailed performance metrics and analysis

func (FunctionEstimateReviewRequirementsResponseMetrics) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseMetrics) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseMetricsAggregateMetrics added in v0.16.0

type FunctionEstimateReviewRequirementsResponseMetricsAggregateMetrics struct {
	// Overall accuracy
	Accuracy float64 `json:"accuracy" api:"nullable"`
	// F1 Score (harmonic mean of precision and recall)
	F1Score float64 `json:"f1Score" api:"nullable"`
	// False Negatives
	Fn int64 `json:"fn"`
	// False Positives
	Fp int64 `json:"fp"`
	// Precision (TP / (TP + FP))
	Precision float64 `json:"precision" api:"nullable"`
	// Recall (TP / (TP + FN))
	Recall float64 `json:"recall" api:"nullable"`
	// True Negatives
	Tn int64 `json:"tn"`
	// True Positives
	Tp int64 `json:"tp"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accuracy    respjson.Field
		F1Score     respjson.Field
		Fn          respjson.Field
		Fp          respjson.Field
		Precision   respjson.Field
		Recall      respjson.Field
		Tn          respjson.Field
		Tp          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comprehensive performance metrics

func (FunctionEstimateReviewRequirementsResponseMetricsAggregateMetrics) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseMetricsAggregateMetrics) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseMetricsFieldMetric added in v0.16.0

type FunctionEstimateReviewRequirementsResponseMetricsFieldMetric struct {
	// JSON path to the field
	FieldPath string `json:"fieldPath" api:"required"`
	// Comprehensive performance metrics
	Metrics FunctionEstimateReviewRequirementsResponseMetricsFieldMetricMetrics `json:"metrics"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FieldPath   respjson.Field
		Metrics     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Enhanced field metrics with comprehensive analytics

func (FunctionEstimateReviewRequirementsResponseMetricsFieldMetric) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseMetricsFieldMetric) UnmarshalJSON added in v0.16.0

type FunctionEstimateReviewRequirementsResponseMetricsFieldMetricMetrics added in v0.16.0

type FunctionEstimateReviewRequirementsResponseMetricsFieldMetricMetrics struct {
	// Overall accuracy
	Accuracy float64 `json:"accuracy" api:"nullable"`
	// F1 Score (harmonic mean of precision and recall)
	F1Score float64 `json:"f1Score" api:"nullable"`
	// False Negatives
	Fn int64 `json:"fn"`
	// False Positives
	Fp int64 `json:"fp"`
	// Precision (TP / (TP + FP))
	Precision float64 `json:"precision" api:"nullable"`
	// Recall (TP / (TP + FN))
	Recall float64 `json:"recall" api:"nullable"`
	// True Negatives
	Tn int64 `json:"tn"`
	// True Positives
	Tp int64 `json:"tp"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accuracy    respjson.Field
		F1Score     respjson.Field
		Fn          respjson.Field
		Fp          respjson.Field
		Precision   respjson.Field
		Recall      respjson.Field
		Tn          respjson.Field
		Tp          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comprehensive performance metrics

func (FunctionEstimateReviewRequirementsResponseMetricsFieldMetricMetrics) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionEstimateReviewRequirementsResponseMetricsFieldMetricMetrics) UnmarshalJSON added in v0.16.0

type FunctionExtract added in v0.2.0

type FunctionExtract struct {
	// Whether bounding box extraction is enabled. Applies to vision input types (pdf,
	// png, jpeg, heic, heif, webp) that dispatch through the analyze path. When true,
	// the function returns the document regions (page, coordinates) from which each
	// field was extracted.
	EnableBoundingBoxes bool `json:"enableBoundingBoxes" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Desired output structure defined in standard JSON Schema convention.
	OutputSchema any `json:"outputSchema" api:"required"`
	// Name of output schema object.
	OutputSchemaName string `json:"outputSchemaName" api:"required"`
	// Reducing the risk of the model stopping early on long documents. Trade-off:
	// Increases total latency.
	PreCount bool             `json:"preCount" api:"required"`
	Type     constant.Extract `json:"type" default:"extract"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function.
	Audit FunctionAudit `json:"audit"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EnableBoundingBoxes respjson.Field
		FunctionID          respjson.Field
		FunctionName        respjson.Field
		OutputSchema        respjson.Field
		OutputSchemaName    respjson.Field
		PreCount            respjson.Field
		Type                respjson.Field
		VersionNum          respjson.Field
		Audit               respjson.Field
		DisplayName         respjson.Field
		Tags                respjson.Field
		UsedInWorkflows     respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A function that extracts structured JSON from documents and images. Accepts a wide range of input types including PDFs, images, spreadsheets, emails, and more.

func (FunctionExtract) RawJSON added in v0.2.0

func (r FunctionExtract) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionExtract) UnmarshalJSON added in v0.2.0

func (r *FunctionExtract) UnmarshalJSON(data []byte) error

type FunctionGetMetricsParams added in v0.16.0

type FunctionGetMetricsParams struct {
	// Cursor — a `functionID` defining your place in the list.
	EndingBefore param.Opt[string] `query:"endingBefore,omitzero" json:"-"`
	Limit        param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// Cursor — a `functionID` defining your place in the list.
	StartingAfter param.Opt[string] `query:"startingAfter,omitzero" json:"-"`
	FunctionIDs   []string          `query:"functionIDs,omitzero" json:"-"`
	FunctionNames []string          `query:"functionNames,omitzero" json:"-"`
	// Sort direction over the result set (default `asc`). Pagination works
	// symmetrically in both directions via `startingAfter` / `endingBefore`.
	//
	// Any of "asc", "desc".
	SortOrder FunctionGetMetricsParamsSortOrder `query:"sortOrder,omitzero" json:"-"`
	Types     []FunctionType                    `query:"types,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (FunctionGetMetricsParams) URLQuery added in v0.16.0

func (r FunctionGetMetricsParams) URLQuery() (v url.Values, err error)

URLQuery serializes FunctionGetMetricsParams's query parameters as `url.Values`.

type FunctionGetMetricsParamsSortOrder added in v0.16.0

type FunctionGetMetricsParamsSortOrder string

Sort direction over the result set (default `asc`). Pagination works symmetrically in both directions via `startingAfter` / `endingBefore`.

const (
	FunctionGetMetricsParamsSortOrderAsc  FunctionGetMetricsParamsSortOrder = "asc"
	FunctionGetMetricsParamsSortOrderDesc FunctionGetMetricsParamsSortOrder = "desc"
)

type FunctionGetMetricsResponse added in v0.16.0

type FunctionGetMetricsResponse struct {
	Functions []FunctionGetMetricsResponseFunction `json:"functions" api:"required"`
	// Total number of functions
	TotalCount int64 `json:"totalCount" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Functions   respjson.Field
		TotalCount  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionGetMetricsResponse) RawJSON added in v0.16.0

func (r FunctionGetMetricsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionGetMetricsResponse) UnmarshalJSON added in v0.16.0

func (r *FunctionGetMetricsResponse) UnmarshalJSON(data []byte) error

type FunctionGetMetricsResponseFunction added in v0.16.0

type FunctionGetMetricsResponseFunction struct {
	// The function name
	FunctionName string                                    `json:"functionName" api:"required"`
	Metrics      FunctionGetMetricsResponseFunctionMetrics `json:"metrics" api:"required"`
	// Number of transformations that have been labeled/evaluated for metrics
	// calculation
	TotalLabeledResults int64 `json:"totalLabeledResults" api:"required"`
	// Total number of results processed by the function
	TotalResults int64 `json:"totalResults" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FunctionName        respjson.Field
		Metrics             respjson.Field
		TotalLabeledResults respjson.Field
		TotalResults        respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionGetMetricsResponseFunction) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionGetMetricsResponseFunction) UnmarshalJSON added in v0.16.0

func (r *FunctionGetMetricsResponseFunction) UnmarshalJSON(data []byte) error

type FunctionGetMetricsResponseFunctionMetrics added in v0.16.0

type FunctionGetMetricsResponseFunctionMetrics struct {
	Accuracy  float64 `json:"accuracy" api:"required"`
	F1Score   float64 `json:"f1Score" api:"required"`
	Fn        int64   `json:"fn" api:"required"`
	Fp        int64   `json:"fp" api:"required"`
	Precision float64 `json:"precision" api:"required"`
	Recall    float64 `json:"recall" api:"required"`
	Tn        int64   `json:"tn" api:"required"`
	Tp        int64   `json:"tp" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accuracy    respjson.Field
		F1Score     respjson.Field
		Fn          respjson.Field
		Fp          respjson.Field
		Precision   respjson.Field
		Recall      respjson.Field
		Tn          respjson.Field
		Tp          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionGetMetricsResponseFunctionMetrics) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionGetMetricsResponseFunctionMetrics) UnmarshalJSON added in v0.16.0

func (r *FunctionGetMetricsResponseFunctionMetrics) UnmarshalJSON(data []byte) error

type FunctionJoin

type FunctionJoin struct {
	// Description of join function.
	Description string `json:"description" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// The type of join to perform.
	//
	// Any of "standard".
	JoinType string `json:"joinType" api:"required"`
	// Desired output structure defined in standard JSON Schema convention.
	OutputSchema any `json:"outputSchema" api:"required"`
	// Name of output schema object.
	OutputSchemaName string        `json:"outputSchemaName" api:"required"`
	Type             constant.Join `json:"type" default:"join"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function.
	Audit FunctionAudit `json:"audit"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Description      respjson.Field
		FunctionID       respjson.Field
		FunctionName     respjson.Field
		JoinType         respjson.Field
		OutputSchema     respjson.Field
		OutputSchemaName respjson.Field
		Type             respjson.Field
		VersionNum       respjson.Field
		Audit            respjson.Field
		DisplayName      respjson.Field
		Tags             respjson.Field
		UsedInWorkflows  respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionJoin) RawJSON

func (r FunctionJoin) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionJoin) UnmarshalJSON

func (r *FunctionJoin) UnmarshalJSON(data []byte) error

type FunctionListParams

type FunctionListParams struct {
	DisplayName   param.Opt[string] `query:"displayName,omitzero" json:"-"`
	EndingBefore  param.Opt[string] `query:"endingBefore,omitzero" json:"-"`
	Limit         param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	StartingAfter param.Opt[string] `query:"startingAfter,omitzero" json:"-"`
	FunctionIDs   []string          `query:"functionIDs,omitzero" json:"-"`
	FunctionNames []string          `query:"functionNames,omitzero" json:"-"`
	// Any of "asc", "desc".
	SortOrder     FunctionListParamsSortOrder `query:"sortOrder,omitzero" json:"-"`
	Tags          []string                    `query:"tags,omitzero" json:"-"`
	Types         []FunctionType              `query:"types,omitzero" json:"-"`
	WorkflowIDs   []string                    `query:"workflowIDs,omitzero" json:"-"`
	WorkflowNames []string                    `query:"workflowNames,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (FunctionListParams) URLQuery

func (r FunctionListParams) URLQuery() (v url.Values, err error)

URLQuery serializes FunctionListParams's query parameters as `url.Values`.

type FunctionListParamsSortOrder

type FunctionListParamsSortOrder string
const (
	FunctionListParamsSortOrderAsc  FunctionListParamsSortOrder = "asc"
	FunctionListParamsSortOrderDesc FunctionListParamsSortOrder = "desc"
)

type FunctionNewParams

type FunctionNewParams struct {
	// V3 wire form of the classify function create payload.
	CreateFunction CreateFunctionUnionParam
	// contains filtered or unexported fields
}

func (FunctionNewParams) MarshalJSON

func (r FunctionNewParams) MarshalJSON() (data []byte, err error)

func (*FunctionNewParams) UnmarshalJSON

func (r *FunctionNewParams) UnmarshalJSON(data []byte) error

type FunctionParse added in v0.10.0

type FunctionParse struct {
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string         `json:"functionName" api:"required"`
	Type         constant.Parse `json:"type" default:"parse"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function.
	Audit FunctionAudit `json:"audit"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
	// Extract / Join — separated from `parseConfig` so the per-call Parse output shape
	// stays distinct from operator-level execution flags.
	ExtraConfig FunctionParseExtraConfig `json:"extraConfig"`
	// Per-version configuration for a Parse function.
	//
	// Parse renders document pages (PDF, image) via vision LLM and emits structured
	// JSON. The two toggles below independently control entity extraction (a per-call
	// output concern) and cross-document memory linking (an environment-wide concern).
	ParseConfig ParseConfig `json:"parseConfig"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FunctionID      respjson.Field
		FunctionName    respjson.Field
		Type            respjson.Field
		VersionNum      respjson.Field
		Audit           respjson.Field
		DisplayName     respjson.Field
		ExtraConfig     respjson.Field
		ParseConfig     respjson.Field
		Tags            respjson.Field
		UsedInWorkflows respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionParse) RawJSON added in v0.10.0

func (r FunctionParse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionParse) UnmarshalJSON added in v0.10.0

func (r *FunctionParse) UnmarshalJSON(data []byte) error

type FunctionParseExtraConfig added in v0.19.0

type FunctionParseExtraConfig struct {
	// When true, return per-section and per-entity-mention coordinates in the parse
	// event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
	// array of `{page, left, top, width, height}` with coordinates normalized to [0,
	// 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
	// output. Only applies to the open-ended discovery path (no `schema`) and to
	// vision input types. Bedrock-backed parse functions silently return an empty map
	// (no native bbox support). Defaults to false.
	EnableBoundingBoxes bool `json:"enableBoundingBoxes"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EnableBoundingBoxes respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on Extract / Join — separated from `parseConfig` so the per-call Parse output shape stays distinct from operator-level execution flags.

func (FunctionParseExtraConfig) RawJSON added in v0.19.0

func (r FunctionParseExtraConfig) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionParseExtraConfig) UnmarshalJSON added in v0.19.0

func (r *FunctionParseExtraConfig) UnmarshalJSON(data []byte) error

type FunctionPayloadShaping

type FunctionPayloadShaping struct {
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// JMESPath expression that defines how to transform and customize the input
	// payload structure. Payload shaping allows you to extract, reshape, and
	// reorganize data from complex input payloads into a simplified, standardized
	// output format. Use JMESPath syntax to select specific fields, perform
	// calculations, and create new data structures tailored to your needs.
	ShapingSchema string                  `json:"shapingSchema" api:"required"`
	Type          constant.PayloadShaping `json:"type" default:"payload_shaping"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function.
	Audit FunctionAudit `json:"audit"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FunctionID      respjson.Field
		FunctionName    respjson.Field
		ShapingSchema   respjson.Field
		Type            respjson.Field
		VersionNum      respjson.Field
		Audit           respjson.Field
		DisplayName     respjson.Field
		Tags            respjson.Field
		UsedInWorkflows respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A function that transforms and customizes input payloads using JMESPath expressions. Payload shaping allows you to extract specific data, perform calculations, and reshape complex input structures into simplified, standardized output formats tailored to your downstream systems or business requirements.

func (FunctionPayloadShaping) RawJSON

func (r FunctionPayloadShaping) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionPayloadShaping) UnmarshalJSON

func (r *FunctionPayloadShaping) UnmarshalJSON(data []byte) error

type FunctionRegressionApplyCorrectionsParams added in v0.16.0

type FunctionRegressionApplyCorrectionsParams struct {
	// **Baseline version number (source of corrected data)**
	//
	// The function version number that contains transformations with corrected JSON
	// that should be copied to regression transformations.
	BaselineVersionNum int64 `json:"baselineVersionNum" api:"required"`
	// **Comparison version number (target for applying corrections)**
	//
	// The function version number of regression transformations that should receive
	// the corrected JSON from the baseline version.
	ComparisonVersionNum int64 `json:"comparisonVersionNum" api:"required"`
	// **Name of the function to apply corrections for**
	//
	// Must be an existing function with both baseline and regression transformation
	// data.
	FunctionName string `json:"functionName" api:"required"`
	// contains filtered or unexported fields
}

func (FunctionRegressionApplyCorrectionsParams) MarshalJSON added in v0.16.0

func (r FunctionRegressionApplyCorrectionsParams) MarshalJSON() (data []byte, err error)

func (*FunctionRegressionApplyCorrectionsParams) UnmarshalJSON added in v0.16.0

func (r *FunctionRegressionApplyCorrectionsParams) UnmarshalJSON(data []byte) error

type FunctionRegressionApplyCorrectionsResponse added in v0.16.0

type FunctionRegressionApplyCorrectionsResponse struct {
	// Number of corrections that were applied successfully.
	Applied int64 `json:"applied" api:"required"`
	// Event KSUIDs whose underlying regression transformation had a baseline
	// correction copied onto it.
	AppliedEventIDs []string `json:"appliedEventIDs" api:"required"`
	// Map of event KSUID to error message for any regression rows where the correction
	// could not be applied (e.g. baseline transformation not found for the row's
	// reference ID).
	Errors any `json:"errors" api:"required"`
	// Number of regression transformations that were skipped — typically because they
	// already had a correction or did not have a usable reference ID.
	Skipped int64 `json:"skipped" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Applied         respjson.Field
		AppliedEventIDs respjson.Field
		Errors          respjson.Field
		Skipped         respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

V3 response from applying baseline corrections to regression transformations. Identifiers are surfaced as event KSUIDs — the externally-stable IDs used everywhere else in V3 — in place of the internal transformation IDs returned by the V2 endpoint.

func (FunctionRegressionApplyCorrectionsResponse) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionRegressionApplyCorrectionsResponse) UnmarshalJSON added in v0.16.0

func (r *FunctionRegressionApplyCorrectionsResponse) UnmarshalJSON(data []byte) error

type FunctionRegressionRunParams added in v0.16.0

type FunctionRegressionRunParams struct {
	// **Name of the function to test for regressions**
	//
	// Must be an existing function with historical transformation data containing user
	// corrections. The function must be currently active and callable.
	FunctionName string `json:"functionName" api:"required"`
	// **Function version number to use as baseline for comparison**
	//
	// - Defaults to `currentVersionNum - 1` (previous version)
	// - Must be a valid, existing version number for the function
	// - Used to retrieve historical transformation data for comparison
	// - Cannot be the same as `comparisonVersionNum`
	BaselineVersionNum param.Opt[int64] `json:"baselineVersionNum,omitzero"`
	// **Function version number to test against the baseline**
	//
	// - Defaults to current version number (latest version)
	// - Must be a valid, existing version number for the function
	// - This version will be used to create new function calls for testing
	// - Cannot be the same as `baselineVersionNum`
	ComparisonVersionNum param.Opt[int64] `json:"comparisonVersionNum,omitzero"`
	// **Whether to only test transformations with user corrections**
	//
	// - Defaults to `true` (recommended)
	// - When `true`: Only uses transformations with `correctedJSON` as ground truth
	// - When `false`: May include transformations without corrections (less reliable)
	// - Corrected data provides the most accurate regression testing results
	OnlyCorrectedData param.Opt[bool] `json:"onlyCorrectedData,omitzero"`
	// **Number of historical samples to test**
	//
	// - Defaults to 50 samples
	// - Minimum: 1, Maximum: 1000
	// - Only transformations with `correctedJSON` (user corrections) are eligible
	// - Actual sample size may be smaller if insufficient corrected data exists
	// - Larger samples provide more statistical confidence but take longer to process
	SampleSize param.Opt[int64] `json:"sampleSize,omitzero"`
	// contains filtered or unexported fields
}

func (FunctionRegressionRunParams) MarshalJSON added in v0.16.0

func (r FunctionRegressionRunParams) MarshalJSON() (data []byte, err error)

func (*FunctionRegressionRunParams) UnmarshalJSON added in v0.16.0

func (r *FunctionRegressionRunParams) UnmarshalJSON(data []byte) error

type FunctionRegressionRunResponse added in v0.16.0

type FunctionRegressionRunResponse struct {
	// **Name of the function being tested**
	//
	// Echoes back the function name from the request for confirmation.
	FunctionName string `json:"functionName" api:"required"`
	// **Detailed regression test results and tracking information**
	//
	// Contains function call IDs for monitoring progress. When all function calls
	// complete, use the transformation endpoints to retrieve and analyze the actual
	// results.
	Result FunctionRegressionRunResponseResult `json:"result" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FunctionName respjson.Field
		Result       respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

**Response from initiating a regression test**

Contains the function call IDs created for async processing and tracking information. Use the returned function call IDs to monitor progress and retrieve results.

func (FunctionRegressionRunResponse) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionRegressionRunResponse) UnmarshalJSON added in v0.16.0

func (r *FunctionRegressionRunResponse) UnmarshalJSON(data []byte) error

type FunctionRegressionRunResponseResult added in v0.16.0

type FunctionRegressionRunResponseResult struct {
	// **Name of the function being tested**
	//
	// The function for which regression testing was initiated.
	FunctionName string `json:"functionName" api:"required"`
	// **Total number of samples being tested**
	//
	// This represents the number of historical transformations found with corrections
	// that will be retested with the latest function version.
	TotalSamples int64 `json:"totalSamples" api:"required"`
	// **Calls created for regression testing**
	//
	// Each object contains the original reference ID and the new call ID created for
	// testing. Use these call IDs with standard call endpoints to monitor progress:
	//
	// - `GET /v2/calls/{callID}` - Check individual status
	// - `GET /v2/calls?referenceIDs=regression-*` - List all regression calls
	Calls []FunctionRegressionRunResponseResultCall `json:"calls"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FunctionName respjson.Field
		TotalSamples respjson.Field
		Calls        respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

**Detailed regression test results and tracking information**

Contains function call IDs for monitoring progress. When all function calls complete, use the transformation endpoints to retrieve and analyze the actual results.

func (FunctionRegressionRunResponseResult) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionRegressionRunResponseResult) UnmarshalJSON added in v0.16.0

func (r *FunctionRegressionRunResponseResult) UnmarshalJSON(data []byte) error

type FunctionRegressionRunResponseResultCall added in v0.16.0

type FunctionRegressionRunResponseResultCall struct {
	// **New call ID created for regression testing**
	//
	// Use this ID with standard call endpoints:
	//
	// - `GET /v2/calls/{callID}` - Check status and retrieve results
	// - The call will have reference ID matching the original transformation
	CallID string `json:"callID" api:"required"`
	// **Original reference ID from historical transformation data**
	//
	// This is the reference ID that was used when the historical transformation was
	// originally created. It provides traceability back to the original business
	// context (e.g., invoice number, document ID).
	OriginalReferenceID string `json:"originalReferenceID" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CallID              respjson.Field
		OriginalReferenceID respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

**Call created for regression testing**

Links the original historical reference ID to the new call ID created for testing. Use the call ID with standard call endpoints to monitor progress and retrieve results.

func (FunctionRegressionRunResponseResultCall) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*FunctionRegressionRunResponseResultCall) UnmarshalJSON added in v0.16.0

func (r *FunctionRegressionRunResponseResultCall) UnmarshalJSON(data []byte) error

type FunctionRegressionService added in v0.16.0

type FunctionRegressionService struct {
	// contains filtered or unexported fields
}

Monitor, evaluate, and iterate on the quality of every function in your environment. Function Accuracy bundles two complementary loops:

## Evaluations (`/v3/eval`)

Trigger and retrieve per-transformation evaluations. Evaluations run asynchronously and score each transformation's output against the function's schema for confidence, per-field hallucination detection, and relevance. Supported for `extract`, `transform`, `analyze`, and `join` events.

  1. **Trigger** — `POST /v3/eval` queues jobs for a batch of transformation IDs.
  2. **Poll** — `GET /v3/eval/results` returns the current state of each requested ID, partitioned into `results`, `pending`, and `failed`. Accepts either `eventIDs` (preferred) or `transformationIDs` as a comma-separated query parameter, and always keys the response by event KSUID.

Up to 100 IDs may be submitted per request.

## Metrics, review, regression (`/v3/functions/{metrics,review,regression,compare}`)

Roll evaluation results and user corrections up into actionable function-level signal:

  • **`GET /v3/functions/metrics`** — aggregate accuracy, precision, recall, F1, and confusion-matrix counts per function.
  • **`POST /v3/functions/review`** — sample-size estimation, confidence-bucketed distribution, PR-AUC, and per-threshold confidence intervals (Wald or Wilson) for picking review cutoffs.
  • **`POST /v3/functions/regression`** — replay corrected historical inputs against a new function version, producing a labeled regression dataset.
  • **`POST /v3/functions/regression/corrections`** — propagate baseline corrections onto the regression dataset so it can be scored.
  • **`POST /v3/functions/compare`** — compute aggregate and field-level lift between any two versions, optionally scoped to the regression dataset.

All five endpoints support `extract` end-to-end on both the vision and OCR paths, alongside the legacy `transform` / `analyze` / `join` types.

FunctionRegressionService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFunctionRegressionService method instead.

func NewFunctionRegressionService added in v0.16.0

func NewFunctionRegressionService(opts ...option.RequestOption) (r FunctionRegressionService)

NewFunctionRegressionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FunctionRegressionService) ApplyCorrections added in v0.16.0

**Copy baseline corrections onto regression transformations.**

Looks up regression transformations created against the comparison version (`isRegression: true`, `correctedJSON IS NULL`), finds the matching baseline transformation by `referenceID`, and copies the baseline's `correctedJSON` onto the regression row via the same code path used by `POST /v3/events/{eventID}/feedback`. The applied corrections are immediately scored against the regression output, populating the confusion-matrix metrics used by `function-review` and `function-version-compare`.

Works for every function type that produces correctable transformations, including `extract` on both the vision and OCR paths. (Previously the vision path silently dropped `is_regression` during the original regression run, so no rows matched the predicate — that has been fixed.)

Returns counts plus the list of **event KSUIDs** whose underlying regression transformation received a correction. Errors (e.g. baseline transformation missing for a given `referenceID`) are returned per-row in the `errors` map, keyed by event KSUID, rather than aborting the whole call.

func (*FunctionRegressionService) Run added in v0.16.0

**Kick off a regression run between two versions of a function.**

Replays a sample of corrected historical inputs against the comparison version, producing fresh transformations marked `isRegression: true`. Each new run returns the workflow `callID`s you can monitor via `GET /v3/calls/{callID}`.

Supported for every function type that produces correctable transformations: `extract`, `transform`, `analyze`, `join`. For `extract` specifically, the regression sample is dispatched through the same OCR vs. vision path used at original call time (PDF, PNG, JPEG, HEIC, HEIF, WebP go through the vision worker; everything else goes through OCR → transform).

The comparison version must share a schema-compatible output shape with the baseline; structural differences are reported as a 400 with the offending field-level diffs.

## Typical flow

  1. `POST /v3/functions/regression` — queues calls, returns `{ originalReferenceID, callID }` per sample.
  2. Wait (poll `GET /v3/calls/{callID}` or subscribe to webhooks).
  3. `POST /v3/functions/regression/corrections` to copy baseline corrections onto the new regression transformations.
  4. `POST /v3/functions/compare` to compare baseline vs comparison metrics for the regression dataset.

type FunctionResponse

type FunctionResponse struct {
	// V3 read-side union. Same shape as the shared `Function` union but with
	// `classify` in place of `route`. Legacy `transform` and `analyze` functions
	// remain readable via V3.
	Function FunctionUnion `json:"function" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Function    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Single-function response wrapper used by V3 function endpoints. V3 wraps individual function responses in a `{"function": ...}` envelope for consistency with other V3 resource endpoints.

func (FunctionResponse) RawJSON

func (r FunctionResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionResponse) UnmarshalJSON

func (r *FunctionResponse) UnmarshalJSON(data []byte) error

type FunctionSend

type FunctionSend struct {
	// Destination type for a Send function.
	//
	// Any of "webhook", "s3", "google_drive".
	DestinationType SendDestinationType `json:"destinationType" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string        `json:"functionName" api:"required"`
	Type         constant.Send `json:"type" default:"send"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function.
	Audit FunctionAudit `json:"audit"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Google Drive folder ID. Present when destinationType is google_drive. Managed
	// via Paragon OAuth.
	GoogleDriveFolderID string `json:"googleDriveFolderId"`
	// S3 bucket to upload the payload to. Present when destinationType is s3.
	S3Bucket string `json:"s3Bucket"`
	// S3 key prefix (folder path). Optional, present when destinationType is s3.
	S3Prefix string `json:"s3Prefix"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// Whether webhook payloads are signed with an HMAC-SHA256 `bem-signature` header.
	WebhookSigningEnabled bool `json:"webhookSigningEnabled"`
	// Webhook URL to POST the payload to. Present when destinationType is webhook.
	WebhookURL string `json:"webhookUrl"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DestinationType       respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		Type                  respjson.Field
		VersionNum            respjson.Field
		Audit                 respjson.Field
		DisplayName           respjson.Field
		GoogleDriveFolderID   respjson.Field
		S3Bucket              respjson.Field
		S3Prefix              respjson.Field
		Tags                  respjson.Field
		UsedInWorkflows       respjson.Field
		WebhookSigningEnabled respjson.Field
		WebhookURL            respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A function that delivers workflow outputs to an external destination. Send functions receive the output of an upstream workflow node and forward it to a webhook, S3 bucket, or Google Drive folder.

func (FunctionSend) RawJSON

func (r FunctionSend) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionSend) UnmarshalJSON

func (r *FunctionSend) UnmarshalJSON(data []byte) error

type FunctionService

type FunctionService struct {

	// Functions are the core building blocks of data transformation in Bem. Each
	// function type serves a specific purpose:
	//
	//   - **Extract**: Extract structured JSON data from unstructured documents (PDFs,
	//     emails, images, spreadsheets), with optional layout-aware bounding-box
	//     extraction
	//   - **Route**: Direct data to different processing paths based on conditions
	//   - **Split**: Break multi-page documents into individual pages for parallel
	//     processing
	//   - **Join**: Combine outputs from multiple function calls into a single result
	//   - **Parse**: Render documents into a navigable structure of page-aware sections,
	//     named entities, and relationships — designed to be walked by an LLM agent via
	//     the [File System API](/api/v3/file-system) (`POST /v3/fs`). Two toggles, both
	//     `true` by default: `extractEntities` controls per-document entity and
	//     relationship extraction; `linkAcrossDocuments` merges entities into one
	//     canonical record per real-world thing across the environment, populating
	//     cross-document memory.
	//   - **Payload Shaping**: Transform and restructure data using JMESPath expressions
	//   - **Enrich**: Enhance data with semantic search against collections
	//   - **Send**: Deliver workflow outputs to downstream destinations
	//
	// Use these endpoints to create, update, list, and manage your functions.
	Copy FunctionCopyService
	// Functions are the core building blocks of data transformation in Bem. Each
	// function type serves a specific purpose:
	//
	//   - **Extract**: Extract structured JSON data from unstructured documents (PDFs,
	//     emails, images, spreadsheets), with optional layout-aware bounding-box
	//     extraction
	//   - **Route**: Direct data to different processing paths based on conditions
	//   - **Split**: Break multi-page documents into individual pages for parallel
	//     processing
	//   - **Join**: Combine outputs from multiple function calls into a single result
	//   - **Parse**: Render documents into a navigable structure of page-aware sections,
	//     named entities, and relationships — designed to be walked by an LLM agent via
	//     the [File System API](/api/v3/file-system) (`POST /v3/fs`). Two toggles, both
	//     `true` by default: `extractEntities` controls per-document entity and
	//     relationship extraction; `linkAcrossDocuments` merges entities into one
	//     canonical record per real-world thing across the environment, populating
	//     cross-document memory.
	//   - **Payload Shaping**: Transform and restructure data using JMESPath expressions
	//   - **Enrich**: Enhance data with semantic search against collections
	//   - **Send**: Deliver workflow outputs to downstream destinations
	//
	// Use these endpoints to create, update, list, and manage your functions.
	Versions FunctionVersionService
	// Monitor, evaluate, and iterate on the quality of every function in your
	// environment. Function Accuracy bundles two complementary loops:
	//
	// ## Evaluations (`/v3/eval`)
	//
	// Trigger and retrieve per-transformation evaluations. Evaluations run
	// asynchronously and score each transformation's output against the function's
	// schema for confidence, per-field hallucination detection, and relevance.
	// Supported for `extract`, `transform`, `analyze`, and `join` events.
	//
	//  1. **Trigger** — `POST /v3/eval` queues jobs for a batch of transformation IDs.
	//  2. **Poll** — `GET /v3/eval/results` returns the current state of each requested
	//     ID, partitioned into `results`, `pending`, and `failed`. Accepts either
	//     `eventIDs` (preferred) or `transformationIDs` as a comma-separated query
	//     parameter, and always keys the response by event KSUID.
	//
	// Up to 100 IDs may be submitted per request.
	//
	// ## Metrics, review, regression (`/v3/functions/{metrics,review,regression,compare}`)
	//
	// Roll evaluation results and user corrections up into actionable function-level
	// signal:
	//
	//   - **`GET /v3/functions/metrics`** — aggregate accuracy, precision, recall, F1,
	//     and confusion-matrix counts per function.
	//   - **`POST /v3/functions/review`** — sample-size estimation, confidence-bucketed
	//     distribution, PR-AUC, and per-threshold confidence intervals (Wald or Wilson)
	//     for picking review cutoffs.
	//   - **`POST /v3/functions/regression`** — replay corrected historical inputs
	//     against a new function version, producing a labeled regression dataset.
	//   - **`POST /v3/functions/regression/corrections`** — propagate baseline
	//     corrections onto the regression dataset so it can be scored.
	//   - **`POST /v3/functions/compare`** — compute aggregate and field-level lift
	//     between any two versions, optionally scoped to the regression dataset.
	//
	// All five endpoints support `extract` end-to-end on both the vision and OCR
	// paths, alongside the legacy `transform` / `analyze` / `join` types.
	Regression FunctionRegressionService
	// contains filtered or unexported fields
}

FunctionService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFunctionService method instead.

func NewFunctionService

func NewFunctionService(opts ...option.RequestOption) (r FunctionService)

NewFunctionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FunctionService) CompareMetrics added in v0.16.0

**Compare metrics between two function versions.**

Computes aggregate and field-level lift/regression between any two versions of a function: accuracy, precision, recall, F1, and PR-AUC. Field-level changes are returned only for fields whose lift exceeds 1% in either direction.

Supported for every function type that produces labeled transformations: `extract`, `transform`, `analyze`, `join`. Pass `isRegression: true` to compare only the regression dataset (rows produced by `POST /v3/functions/regression`) — the canonical way to judge a candidate version before promoting it.

Defaults: `baselineVersionNum = currentVersionNum - 1`, `comparisonVersionNum = currentVersionNum`.

func (*FunctionService) Delete

func (r *FunctionService) Delete(ctx context.Context, functionName string, opts ...option.RequestOption) (err error)

**Delete a function and every one of its versions.**

Permanent. Running and queued calls that reference this function continue to completion against the version they captured at call time, but no new calls can target it.

## Before deleting

Workflow nodes that reference this function will fail at call time after deletion. List workflows that reference it first:

``` GET /v3/workflows?functionNames=my-function ```

Update or remove those workflows, or create a replacement function and re-point the workflow nodes, before deleting.

func (*FunctionService) EstimateReviewRequirements added in v0.16.0

**Estimate human review requirements for a function.**

Combines confusion-matrix metrics with the per-transformation evaluation scores (confidence / hallucination / relevance produced by the eval service) to compute:

  • A confidence-bucketed distribution of the function's outputs.
  • Sample-size estimates at configurable margin-of-error and confidence levels (Wald or Wilson intervals).
  • A precision-recall AUC and a per-threshold matrix you can use to pick a review cutoff.

Supported for every function type that produces transformations and feeds the auto-evaluation pipeline: `extract`, `transform`, `analyze`, `join`. Extract works on both vision (PDF/PNG/JPEG/HEIC/HEIF/WebP) and OCR-routed inputs.

Pass `isRegression: true` to scope the review to transformations created by a previous regression run (see `POST /v3/functions/regression`).

func (*FunctionService) Get

func (r *FunctionService) Get(ctx context.Context, functionName string, opts ...option.RequestOption) (res *FunctionResponse, err error)

**Retrieve a function's current version by name.**

Returns the function record with its `currentVersionNum` and the configuration of that version. To inspect a historical version, use `GET /v3/functions/{functionName}/versions/{versionNum}`.

func (*FunctionService) GetMetrics added in v0.16.0

**Retrieve performance metrics for functions based on labeled transformation data.**

Calculates accuracy, precision, recall, F1, and the underlying confusion-matrix counts for each matching function by comparing model outputs against user corrections. Metrics are aggregated across every transformation the function has produced, regardless of function type — `extract`, `transform`, `analyze`, and `join` all populate the same `metrics` column on the transformation row, so v3 surfaces all of them uniformly.

## Filtering

Combine `functionIDs` / `functionNames` / `types` to narrow the result set. `types` accepts `extract` alongside the legacy `transform` / `analyze` types (which remain readable). Pagination is cursor-based.

## Requirements

A function only shows non-zero metrics once at least one of its transformations has been labeled — submit corrections via `POST /v3/events/{eventID}/feedback`.

func (*FunctionService) List

**List functions in the current environment.**

Returns each function's current version. Combine filters freely — they AND together.

## Filtering

  • `functionIDs` / `functionNames`: exact-match identity filters.
  • `displayName`: case-insensitive substring match.
  • `types`: one or more of `extract`, `classify`, `split`, `join`, `enrich`, `payload_shaping`. Legacy `transform`, `analyze`, `route`, and `send` types remain readable via this filter.
  • `tags`: returns functions tagged with any of the supplied tags.
  • `workflowIDs` / `workflowNames`: returns only functions referenced by the named workflows. Useful for "what functions does this workflow depend on?" lookups.

## Pagination

Cursor-based with `startingAfter` and `endingBefore` (functionIDs). Default limit 50, maximum 100.

func (*FunctionService) ListAutoPaging

**List functions in the current environment.**

Returns each function's current version. Combine filters freely — they AND together.

## Filtering

  • `functionIDs` / `functionNames`: exact-match identity filters.
  • `displayName`: case-insensitive substring match.
  • `types`: one or more of `extract`, `classify`, `split`, `join`, `enrich`, `payload_shaping`. Legacy `transform`, `analyze`, `route`, and `send` types remain readable via this filter.
  • `tags`: returns functions tagged with any of the supplied tags.
  • `workflowIDs` / `workflowNames`: returns only functions referenced by the named workflows. Useful for "what functions does this workflow depend on?" lookups.

## Pagination

Cursor-based with `startingAfter` and `endingBefore` (functionIDs). Default limit 50, maximum 100.

func (*FunctionService) New

**Create a function.**

The function type (`extract`, `classify`, `split`, `join`, `enrich`, or `payload_shaping`) determines which configuration fields are required — see [Function types overview](/guide/function-types/overview) for the per-type contract.

The response contains both `functionID` and `functionName`. Either is a stable handle you can use elsewhere; most workflows reference functions by `functionName` because it's human-readable.

## Naming rules

  • `functionName` must be unique per environment.
  • Allowed characters: letters, digits, hyphens, and underscores.
  • Names cannot be reused after deletion within the same environment for at least the retention window of the previous record.

The new function is created at `versionNum: 1`. Subsequent `PATCH /v3/functions/{functionName}` calls produce new versions — the version-1 configuration remains immutable and addressable.

func (*FunctionService) Update

func (r *FunctionService) Update(ctx context.Context, pathFunctionName string, body FunctionUpdateParams, opts ...option.RequestOption) (res *FunctionResponse, err error)

**Update a function. Updates create a new version.**

The previous version remains addressable and immutable. Workflow nodes that pinned the function with a `versionNum` continue to use the pinned version; nodes that reference the function by name with no version automatically pick up the new version on their next call.

## What you can change

Any field allowed by the function's type. Most commonly: `outputSchema` (for `extract`/`join`), `classifications` (for `classify`), `displayName`, and `tags`.

## Versioning behaviour

  • Each successful update increments `currentVersionNum` by 1.
  • `displayName`, `tags`, and `functionName` updates also create a new version, so the version history is a complete record of every change.
  • To revert, fetch the previous version and re-submit its configuration as a new update — versions themselves are immutable.

type FunctionSplit

type FunctionSplit struct {
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// The method used to split pages.
	//
	// Any of "print_page", "semantic_page".
	SplitType string         `json:"splitType" api:"required"`
	Type      constant.Split `json:"type" default:"split"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function.
	Audit FunctionAudit `json:"audit"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Configuration for print page splitting.
	PrintPageSplitConfig FunctionSplitPrintPageSplitConfig `json:"printPageSplitConfig"`
	// Configuration for semantic page splitting.
	SemanticPageSplitConfig FunctionSplitSemanticPageSplitConfig `json:"semanticPageSplitConfig"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FunctionID              respjson.Field
		FunctionName            respjson.Field
		SplitType               respjson.Field
		Type                    respjson.Field
		VersionNum              respjson.Field
		Audit                   respjson.Field
		DisplayName             respjson.Field
		PrintPageSplitConfig    respjson.Field
		SemanticPageSplitConfig respjson.Field
		Tags                    respjson.Field
		UsedInWorkflows         respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionSplit) RawJSON

func (r FunctionSplit) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionSplit) UnmarshalJSON

func (r *FunctionSplit) UnmarshalJSON(data []byte) error

type FunctionSplitPrintPageSplitConfig

type FunctionSplitPrintPageSplitConfig struct {
	NextFunctionID string `json:"nextFunctionID"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		NextFunctionID respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for print page splitting.

func (FunctionSplitPrintPageSplitConfig) RawJSON

Returns the unmodified JSON received from the API

func (*FunctionSplitPrintPageSplitConfig) UnmarshalJSON

func (r *FunctionSplitPrintPageSplitConfig) UnmarshalJSON(data []byte) error

type FunctionSplitSemanticPageSplitConfig

type FunctionSplitSemanticPageSplitConfig struct {
	ItemClasses []SplitFunctionSemanticPageItemClass `json:"itemClasses"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemClasses respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for semantic page splitting.

func (FunctionSplitSemanticPageSplitConfig) RawJSON

Returns the unmodified JSON received from the API

func (*FunctionSplitSemanticPageSplitConfig) UnmarshalJSON

func (r *FunctionSplitSemanticPageSplitConfig) UnmarshalJSON(data []byte) error

type FunctionTransform

type FunctionTransform struct {
	// Email address automatically created by bem. You can forward emails with or
	// without attachments, to be transformed.
	EmailAddress string `json:"emailAddress" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Desired output structure defined in standard JSON Schema convention.
	OutputSchema any `json:"outputSchema" api:"required"`
	// Name of output schema object.
	OutputSchemaName string `json:"outputSchemaName" api:"required"`
	// Whether tabular chunking is enabled on the pipeline. This processes tables in
	// CSV/Excel in row batches, rather than all rows at once.
	TabularChunkingEnabled bool               `json:"tabularChunkingEnabled" api:"required"`
	Type                   constant.Transform `json:"type" default:"transform"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function.
	Audit FunctionAudit `json:"audit"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EmailAddress           respjson.Field
		FunctionID             respjson.Field
		FunctionName           respjson.Field
		OutputSchema           respjson.Field
		OutputSchemaName       respjson.Field
		TabularChunkingEnabled respjson.Field
		Type                   respjson.Field
		VersionNum             respjson.Field
		Audit                  respjson.Field
		DisplayName            respjson.Field
		Tags                   respjson.Field
		UsedInWorkflows        respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionTransform) RawJSON

func (r FunctionTransform) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionTransform) UnmarshalJSON

func (r *FunctionTransform) UnmarshalJSON(data []byte) error

type FunctionType

type FunctionType string

The type of the function.

const (
	FunctionTypeTransform      FunctionType = "transform"
	FunctionTypeExtract        FunctionType = "extract"
	FunctionTypeRoute          FunctionType = "route"
	FunctionTypeClassify       FunctionType = "classify"
	FunctionTypeSend           FunctionType = "send"
	FunctionTypeSplit          FunctionType = "split"
	FunctionTypeJoin           FunctionType = "join"
	FunctionTypeAnalyze        FunctionType = "analyze"
	FunctionTypePayloadShaping FunctionType = "payload_shaping"
	FunctionTypeEnrich         FunctionType = "enrich"
	FunctionTypeParse          FunctionType = "parse"
)

type FunctionUnion

type FunctionUnion struct {
	EmailAddress     string `json:"emailAddress"`
	FunctionID       string `json:"functionID"`
	FunctionName     string `json:"functionName"`
	OutputSchema     any    `json:"outputSchema"`
	OutputSchemaName string `json:"outputSchemaName"`
	// This field is from variant [FunctionTransform].
	TabularChunkingEnabled bool `json:"tabularChunkingEnabled"`
	// Any of "transform", "extract", "analyze", "classify", "send", "split", "join",
	// "payload_shaping", "enrich", "parse".
	Type       string `json:"type"`
	VersionNum int64  `json:"versionNum"`
	// This field is from variant [FunctionTransform].
	Audit               FunctionAudit       `json:"audit"`
	DisplayName         string              `json:"displayName"`
	Tags                []string            `json:"tags"`
	UsedInWorkflows     []WorkflowUsageInfo `json:"usedInWorkflows"`
	EnableBoundingBoxes bool                `json:"enableBoundingBoxes"`
	PreCount            bool                `json:"preCount"`
	// This field is from variant [FunctionClassify].
	Classifications []ClassificationListItem `json:"classifications"`
	Description     string                   `json:"description"`
	// This field is from variant [FunctionSend].
	DestinationType SendDestinationType `json:"destinationType"`
	// This field is from variant [FunctionSend].
	GoogleDriveFolderID string `json:"googleDriveFolderId"`
	// This field is from variant [FunctionSend].
	S3Bucket string `json:"s3Bucket"`
	// This field is from variant [FunctionSend].
	S3Prefix string `json:"s3Prefix"`
	// This field is from variant [FunctionSend].
	WebhookSigningEnabled bool `json:"webhookSigningEnabled"`
	// This field is from variant [FunctionSend].
	WebhookURL string `json:"webhookUrl"`
	// This field is from variant [FunctionSplit].
	SplitType string `json:"splitType"`
	// This field is from variant [FunctionSplit].
	PrintPageSplitConfig FunctionSplitPrintPageSplitConfig `json:"printPageSplitConfig"`
	// This field is from variant [FunctionSplit].
	SemanticPageSplitConfig FunctionSplitSemanticPageSplitConfig `json:"semanticPageSplitConfig"`
	// This field is from variant [FunctionJoin].
	JoinType string `json:"joinType"`
	// This field is from variant [FunctionPayloadShaping].
	ShapingSchema string `json:"shapingSchema"`
	// This field is from variant [FunctionEnrich].
	Config EnrichConfig `json:"config"`
	// This field is from variant [FunctionParse].
	ExtraConfig FunctionParseExtraConfig `json:"extraConfig"`
	// This field is from variant [FunctionParse].
	ParseConfig ParseConfig `json:"parseConfig"`
	JSON        struct {
		EmailAddress            respjson.Field
		FunctionID              respjson.Field
		FunctionName            respjson.Field
		OutputSchema            respjson.Field
		OutputSchemaName        respjson.Field
		TabularChunkingEnabled  respjson.Field
		Type                    respjson.Field
		VersionNum              respjson.Field
		Audit                   respjson.Field
		DisplayName             respjson.Field
		Tags                    respjson.Field
		UsedInWorkflows         respjson.Field
		EnableBoundingBoxes     respjson.Field
		PreCount                respjson.Field
		Classifications         respjson.Field
		Description             respjson.Field
		DestinationType         respjson.Field
		GoogleDriveFolderID     respjson.Field
		S3Bucket                respjson.Field
		S3Prefix                respjson.Field
		WebhookSigningEnabled   respjson.Field
		WebhookURL              respjson.Field
		SplitType               respjson.Field
		PrintPageSplitConfig    respjson.Field
		SemanticPageSplitConfig respjson.Field
		JoinType                respjson.Field
		ShapingSchema           respjson.Field
		Config                  respjson.Field
		ExtraConfig             respjson.Field
		ParseConfig             respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FunctionUnion contains all possible properties and values from FunctionTransform, FunctionExtract, FunctionAnalyze, FunctionClassify, FunctionSend, FunctionSplit, FunctionJoin, FunctionPayloadShaping, FunctionEnrich, FunctionParse.

Use the FunctionUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FunctionUnion) AsAnalyze

func (u FunctionUnion) AsAnalyze() (v FunctionAnalyze)

func (FunctionUnion) AsAny

func (u FunctionUnion) AsAny() anyFunction

Use the following switch statement to find the correct variant

switch variant := FunctionUnion.AsAny().(type) {
case bem.FunctionTransform:
case bem.FunctionExtract:
case bem.FunctionAnalyze:
case bem.FunctionClassify:
case bem.FunctionSend:
case bem.FunctionSplit:
case bem.FunctionJoin:
case bem.FunctionPayloadShaping:
case bem.FunctionEnrich:
case bem.FunctionParse:
default:
  fmt.Errorf("no variant present")
}

func (FunctionUnion) AsClassify added in v0.7.0

func (u FunctionUnion) AsClassify() (v FunctionClassify)

func (FunctionUnion) AsEnrich

func (u FunctionUnion) AsEnrich() (v FunctionEnrich)

func (FunctionUnion) AsExtract added in v0.2.0

func (u FunctionUnion) AsExtract() (v FunctionExtract)

func (FunctionUnion) AsJoin

func (u FunctionUnion) AsJoin() (v FunctionJoin)

func (FunctionUnion) AsParse added in v0.10.0

func (u FunctionUnion) AsParse() (v FunctionParse)

func (FunctionUnion) AsPayloadShaping

func (u FunctionUnion) AsPayloadShaping() (v FunctionPayloadShaping)

func (FunctionUnion) AsSend

func (u FunctionUnion) AsSend() (v FunctionSend)

func (FunctionUnion) AsSplit

func (u FunctionUnion) AsSplit() (v FunctionSplit)

func (FunctionUnion) AsTransform

func (u FunctionUnion) AsTransform() (v FunctionTransform)

func (FunctionUnion) RawJSON

func (u FunctionUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionUnion) UnmarshalJSON

func (r *FunctionUnion) UnmarshalJSON(data []byte) error

type FunctionUpdateParams

type FunctionUpdateParams struct {
	// V3 create/update variants of the shared function payloads.
	//
	// The V3 Functions API no longer accepts the legacy `transform` or `analyze`
	// function types when creating new functions or updating existing ones — both have
	// been unified under `extract`. Existing functions of those types remain readable
	// and callable via V3, so the V3 read-side unions still include `transform` and
	// `analyze` variants.
	//
	// The V3 API also exposes `classify` in place of the legacy `route` type on
	// create/update, with `classifications` in place of `routes`. Read-side
	// `ClassifyFunction` / `ClassifyFunctionVersion` / `ClassificationList` are
	// defined in the shared functions models and used by both the V2 and V3 response
	// unions (existing classify functions are returned from V2 GET endpoints
	// verbatim).V3 wire form of the classify function upsert payload.
	UpdateFunction UpdateFunctionUnionParam
	// contains filtered or unexported fields
}

func (FunctionUpdateParams) MarshalJSON

func (r FunctionUpdateParams) MarshalJSON() (data []byte, err error)

func (*FunctionUpdateParams) UnmarshalJSON

func (r *FunctionUpdateParams) UnmarshalJSON(data []byte) error

type FunctionVersionAnalyze

type FunctionVersionAnalyze struct {
	// Whether bounding box extraction is enabled. Only applicable to analyze and
	// extract functions. When true, the function returns the document regions (page,
	// coordinates) from which each field was extracted.
	EnableBoundingBoxes bool `json:"enableBoundingBoxes" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Desired output structure defined in standard JSON Schema convention.
	OutputSchema any `json:"outputSchema" api:"required"`
	// Name of output schema object.
	OutputSchemaName string `json:"outputSchemaName" api:"required"`
	// Reducing the risk of the model stopping early on long documents. Trade-off:
	// Increases total latency.
	PreCount bool             `json:"preCount" api:"required"`
	Type     constant.Analyze `json:"type" default:"analyze"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function version.
	Audit FunctionAudit `json:"audit"`
	// The date and time the function version was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EnableBoundingBoxes respjson.Field
		FunctionID          respjson.Field
		FunctionName        respjson.Field
		OutputSchema        respjson.Field
		OutputSchemaName    respjson.Field
		PreCount            respjson.Field
		Type                respjson.Field
		VersionNum          respjson.Field
		Audit               respjson.Field
		CreatedAt           respjson.Field
		DisplayName         respjson.Field
		Tags                respjson.Field
		UsedInWorkflows     respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionVersionAnalyze) RawJSON

func (r FunctionVersionAnalyze) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionVersionAnalyze) UnmarshalJSON

func (r *FunctionVersionAnalyze) UnmarshalJSON(data []byte) error

type FunctionVersionClassify added in v0.7.0

type FunctionVersionClassify struct {
	// List of classifications a classify function can produce. Shares the underlying
	// route list shape.
	Classifications []ClassificationListItem `json:"classifications" api:"required"`
	// Description of classifier. Can be used to provide additional context on
	// classifier's purpose and expected inputs.
	Description string `json:"description" api:"required"`
	// Email address automatically created by bem. You can forward emails with or
	// without attachments, to be classified.
	EmailAddress string `json:"emailAddress" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string            `json:"functionName" api:"required"`
	Type         constant.Classify `json:"type" default:"classify"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function version.
	Audit FunctionAudit `json:"audit"`
	// The date and time the function version was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Classifications respjson.Field
		Description     respjson.Field
		EmailAddress    respjson.Field
		FunctionID      respjson.Field
		FunctionName    respjson.Field
		Type            respjson.Field
		VersionNum      respjson.Field
		Audit           respjson.Field
		CreatedAt       respjson.Field
		DisplayName     respjson.Field
		Tags            respjson.Field
		UsedInWorkflows respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionVersionClassify) RawJSON added in v0.7.0

func (r FunctionVersionClassify) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionVersionClassify) UnmarshalJSON added in v0.7.0

func (r *FunctionVersionClassify) UnmarshalJSON(data []byte) error

type FunctionVersionEnrich

type FunctionVersionEnrich struct {
	// Configuration for an enrich function.
	//
	// **How Enrich Functions Work:**
	//
	// Enrich functions augment JSON input with data from external sources. They take
	// JSON input (typically from a previous function), extract specified fields, fetch
	// or search for matching data, and inject the results back into the JSON.
	//
	// **Data Sources:**
	//
	//   - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
	//     collection. Best for semantic matching against pre-indexed documents.
	//   - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
	//     Best for looking up live data from CRMs, ERPs, or other external systems.
	//     Optionally uses LLM agent reasoning to rank candidates returned by the
	//     endpoint.
	//
	// **Input Requirements:**
	//
	// - Must receive JSON input (typically from a previous function's output)
	//
	// **Example Use Cases:**
	//
	//   - Match product descriptions to SKU codes from a product catalog collection
	//   - Enrich customer data with account details from a CRM endpoint
	//   - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
	//     products
	//
	// **Configuration:**
	//
	// - Define named endpoints (for endpoint-source steps)
	// - Define one or more enrichment steps; steps are executed sequentially
	Config EnrichConfig `json:"config" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string          `json:"functionName" api:"required"`
	Type         constant.Enrich `json:"type" default:"enrich"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function version.
	Audit FunctionAudit `json:"audit"`
	// The date and time the function version was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Config          respjson.Field
		FunctionID      respjson.Field
		FunctionName    respjson.Field
		Type            respjson.Field
		VersionNum      respjson.Field
		Audit           respjson.Field
		CreatedAt       respjson.Field
		DisplayName     respjson.Field
		Tags            respjson.Field
		UsedInWorkflows respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionVersionEnrich) RawJSON

func (r FunctionVersionEnrich) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionVersionEnrich) UnmarshalJSON

func (r *FunctionVersionEnrich) UnmarshalJSON(data []byte) error

type FunctionVersionExtract added in v0.2.0

type FunctionVersionExtract struct {
	// Whether bounding box extraction is enabled. Applies to vision input types (pdf,
	// png, jpeg, heic, heif, webp) that dispatch through the analyze path. When true,
	// the function returns the document regions (page, coordinates) from which each
	// field was extracted.
	EnableBoundingBoxes bool `json:"enableBoundingBoxes" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Desired output structure defined in standard JSON Schema convention.
	OutputSchema any `json:"outputSchema" api:"required"`
	// Name of output schema object.
	OutputSchemaName string `json:"outputSchemaName" api:"required"`
	// Reducing the risk of the model stopping early on long documents. Trade-off:
	// Increases total latency.
	PreCount bool `json:"preCount" api:"required"`
	// Whether tabular chunking is enabled. When true, tables in CSV/Excel files are
	// processed in row batches rather than all at once.
	TabularChunkingEnabled bool             `json:"tabularChunkingEnabled" api:"required"`
	Type                   constant.Extract `json:"type" default:"extract"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function version.
	Audit FunctionAudit `json:"audit"`
	// The date and time the function version was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EnableBoundingBoxes    respjson.Field
		FunctionID             respjson.Field
		FunctionName           respjson.Field
		OutputSchema           respjson.Field
		OutputSchemaName       respjson.Field
		PreCount               respjson.Field
		TabularChunkingEnabled respjson.Field
		Type                   respjson.Field
		VersionNum             respjson.Field
		Audit                  respjson.Field
		CreatedAt              respjson.Field
		DisplayName            respjson.Field
		Tags                   respjson.Field
		UsedInWorkflows        respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionVersionExtract) RawJSON added in v0.2.0

func (r FunctionVersionExtract) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionVersionExtract) UnmarshalJSON added in v0.2.0

func (r *FunctionVersionExtract) UnmarshalJSON(data []byte) error

type FunctionVersionGetParams

type FunctionVersionGetParams struct {
	FunctionName string `path:"functionName" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type FunctionVersionGetResponse

type FunctionVersionGetResponse struct {
	// V3 read-side union for function versions. Same shape as the shared
	// `FunctionVersion` union but with `classify` in place of `route`.
	Function FunctionVersionUnion `json:"function" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Function    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Single-function-version response wrapper used by V3 endpoints.

func (FunctionVersionGetResponse) RawJSON

func (r FunctionVersionGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionVersionGetResponse) UnmarshalJSON

func (r *FunctionVersionGetResponse) UnmarshalJSON(data []byte) error

type FunctionVersionIdentifier

type FunctionVersionIdentifier struct {
	// Unique identifier of function. Provide either id or name, not both.
	ID string `json:"id"`
	// Name of function. Must be UNIQUE on a per-environment basis. Provide either id
	// or name, not both.
	Name string `json:"name"`
	// Version number of function.
	VersionNum int64 `json:"versionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		VersionNum  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionVersionIdentifier) RawJSON

func (r FunctionVersionIdentifier) RawJSON() string

Returns the unmodified JSON received from the API

func (FunctionVersionIdentifier) ToParam

ToParam converts this FunctionVersionIdentifier to a FunctionVersionIdentifierParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with FunctionVersionIdentifierParam.Overrides()

func (*FunctionVersionIdentifier) UnmarshalJSON

func (r *FunctionVersionIdentifier) UnmarshalJSON(data []byte) error

type FunctionVersionIdentifierParam

type FunctionVersionIdentifierParam struct {
	// Unique identifier of function. Provide either id or name, not both.
	ID param.Opt[string] `json:"id,omitzero"`
	// Name of function. Must be UNIQUE on a per-environment basis. Provide either id
	// or name, not both.
	Name param.Opt[string] `json:"name,omitzero"`
	// Version number of function.
	VersionNum param.Opt[int64] `json:"versionNum,omitzero"`
	// contains filtered or unexported fields
}

func (FunctionVersionIdentifierParam) MarshalJSON

func (r FunctionVersionIdentifierParam) MarshalJSON() (data []byte, err error)

func (*FunctionVersionIdentifierParam) UnmarshalJSON

func (r *FunctionVersionIdentifierParam) UnmarshalJSON(data []byte) error

type FunctionVersionJoin

type FunctionVersionJoin struct {
	// Description of join function.
	Description string `json:"description" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// The type of join to perform.
	//
	// Any of "standard".
	JoinType string `json:"joinType" api:"required"`
	// Desired output structure defined in standard JSON Schema convention.
	OutputSchema any `json:"outputSchema" api:"required"`
	// Name of output schema object.
	OutputSchemaName string        `json:"outputSchemaName" api:"required"`
	Type             constant.Join `json:"type" default:"join"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function version.
	Audit FunctionAudit `json:"audit"`
	// The date and time the function version was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Description      respjson.Field
		FunctionID       respjson.Field
		FunctionName     respjson.Field
		JoinType         respjson.Field
		OutputSchema     respjson.Field
		OutputSchemaName respjson.Field
		Type             respjson.Field
		VersionNum       respjson.Field
		Audit            respjson.Field
		CreatedAt        respjson.Field
		DisplayName      respjson.Field
		Tags             respjson.Field
		UsedInWorkflows  respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionVersionJoin) RawJSON

func (r FunctionVersionJoin) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionVersionJoin) UnmarshalJSON

func (r *FunctionVersionJoin) UnmarshalJSON(data []byte) error

type FunctionVersionParse added in v0.10.0

type FunctionVersionParse struct {
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string         `json:"functionName" api:"required"`
	Type         constant.Parse `json:"type" default:"parse"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function version.
	Audit FunctionAudit `json:"audit"`
	// The date and time the function version was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
	// Extract / Join — separated from `parseConfig` so the per-call Parse output shape
	// stays distinct from operator-level execution flags.
	ExtraConfig FunctionVersionParseExtraConfig `json:"extraConfig"`
	// Per-version configuration for a Parse function.
	//
	// Parse renders document pages (PDF, image) via vision LLM and emits structured
	// JSON. The two toggles below independently control entity extraction (a per-call
	// output concern) and cross-document memory linking (an environment-wide concern).
	ParseConfig ParseConfig `json:"parseConfig"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FunctionID      respjson.Field
		FunctionName    respjson.Field
		Type            respjson.Field
		VersionNum      respjson.Field
		Audit           respjson.Field
		CreatedAt       respjson.Field
		DisplayName     respjson.Field
		ExtraConfig     respjson.Field
		ParseConfig     respjson.Field
		Tags            respjson.Field
		UsedInWorkflows respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionVersionParse) RawJSON added in v0.10.0

func (r FunctionVersionParse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionVersionParse) UnmarshalJSON added in v0.10.0

func (r *FunctionVersionParse) UnmarshalJSON(data []byte) error

type FunctionVersionParseExtraConfig added in v0.19.0

type FunctionVersionParseExtraConfig struct {
	// When true, return per-section and per-entity-mention coordinates in the parse
	// event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
	// array of `{page, left, top, width, height}` with coordinates normalized to [0,
	// 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
	// output. Only applies to the open-ended discovery path (no `schema`) and to
	// vision input types. Bedrock-backed parse functions silently return an empty map
	// (no native bbox support). Defaults to false.
	EnableBoundingBoxes bool `json:"enableBoundingBoxes"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EnableBoundingBoxes respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on Extract / Join — separated from `parseConfig` so the per-call Parse output shape stays distinct from operator-level execution flags.

func (FunctionVersionParseExtraConfig) RawJSON added in v0.19.0

Returns the unmodified JSON received from the API

func (*FunctionVersionParseExtraConfig) UnmarshalJSON added in v0.19.0

func (r *FunctionVersionParseExtraConfig) UnmarshalJSON(data []byte) error

type FunctionVersionPayloadShaping

type FunctionVersionPayloadShaping struct {
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// JMESPath expression that defines how to transform and customize the input
	// payload structure. Payload shaping allows you to extract, reshape, and
	// reorganize data from complex input payloads into a simplified, standardized
	// output format. Use JMESPath syntax to select specific fields, perform
	// calculations, and create new data structures tailored to your needs.
	ShapingSchema string                  `json:"shapingSchema" api:"required"`
	Type          constant.PayloadShaping `json:"type" default:"payload_shaping"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function version.
	Audit FunctionAudit `json:"audit"`
	// The date and time the function version was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FunctionID      respjson.Field
		FunctionName    respjson.Field
		ShapingSchema   respjson.Field
		Type            respjson.Field
		VersionNum      respjson.Field
		Audit           respjson.Field
		CreatedAt       respjson.Field
		DisplayName     respjson.Field
		Tags            respjson.Field
		UsedInWorkflows respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A version of a payload shaping function that transforms and customizes input payloads using JMESPath expressions. Payload shaping allows you to extract specific data, perform calculations, and reshape complex input structures into simplified, standardized output formats tailored to your downstream systems or business requirements.

func (FunctionVersionPayloadShaping) RawJSON

Returns the unmodified JSON received from the API

func (*FunctionVersionPayloadShaping) UnmarshalJSON

func (r *FunctionVersionPayloadShaping) UnmarshalJSON(data []byte) error

type FunctionVersionSend

type FunctionVersionSend struct {
	// Destination type for a Send function.
	//
	// Any of "webhook", "s3", "google_drive".
	DestinationType SendDestinationType `json:"destinationType" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string        `json:"functionName" api:"required"`
	Type         constant.Send `json:"type" default:"send"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function version.
	Audit FunctionAudit `json:"audit"`
	// The date and time the function version was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName         string `json:"displayName"`
	GoogleDriveFolderID string `json:"googleDriveFolderId"`
	S3Bucket            string `json:"s3Bucket"`
	S3Prefix            string `json:"s3Prefix"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// Whether webhook deliveries are signed with an HMAC-SHA256 `bem-signature`
	// header.
	WebhookSigningEnabled bool   `json:"webhookSigningEnabled"`
	WebhookURL            string `json:"webhookUrl"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DestinationType       respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		Type                  respjson.Field
		VersionNum            respjson.Field
		Audit                 respjson.Field
		CreatedAt             respjson.Field
		DisplayName           respjson.Field
		GoogleDriveFolderID   respjson.Field
		S3Bucket              respjson.Field
		S3Prefix              respjson.Field
		Tags                  respjson.Field
		UsedInWorkflows       respjson.Field
		WebhookSigningEnabled respjson.Field
		WebhookURL            respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionVersionSend) RawJSON

func (r FunctionVersionSend) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionVersionSend) UnmarshalJSON

func (r *FunctionVersionSend) UnmarshalJSON(data []byte) error

type FunctionVersionService

type FunctionVersionService struct {
	// contains filtered or unexported fields
}

Functions are the core building blocks of data transformation in Bem. Each function type serves a specific purpose:

  • **Extract**: Extract structured JSON data from unstructured documents (PDFs, emails, images, spreadsheets), with optional layout-aware bounding-box extraction
  • **Route**: Direct data to different processing paths based on conditions
  • **Split**: Break multi-page documents into individual pages for parallel processing
  • **Join**: Combine outputs from multiple function calls into a single result
  • **Parse**: Render documents into a navigable structure of page-aware sections, named entities, and relationships — designed to be walked by an LLM agent via the [File System API](/api/v3/file-system) (`POST /v3/fs`). Two toggles, both `true` by default: `extractEntities` controls per-document entity and relationship extraction; `linkAcrossDocuments` merges entities into one canonical record per real-world thing across the environment, populating cross-document memory.
  • **Payload Shaping**: Transform and restructure data using JMESPath expressions
  • **Enrich**: Enhance data with semantic search against collections
  • **Send**: Deliver workflow outputs to downstream destinations

Use these endpoints to create, update, list, and manage your functions.

FunctionVersionService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFunctionVersionService method instead.

func NewFunctionVersionService

func NewFunctionVersionService(opts ...option.RequestOption) (r FunctionVersionService)

NewFunctionVersionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FunctionVersionService) Get

**Retrieve a specific historical version of a function.**

Versions are immutable. Use this endpoint to inspect what a function looked like at the moment a particular call was made — every event and transformation records the function version it ran against.

func (*FunctionVersionService) List

func (r *FunctionVersionService) List(ctx context.Context, functionName string, opts ...option.RequestOption) (res *ListFunctionVersionsResponse, err error)

**List every version of a function.**

Returns the full version history, newest-first. Each row captures the configuration the function had between updates. Useful for audits ("when did this schema change?") and for diffing two versions before promoting an update to production.

type FunctionVersionSplit

type FunctionVersionSplit struct {
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Any of "print_page", "semantic_page".
	SplitType string         `json:"splitType" api:"required"`
	Type      constant.Split `json:"type" default:"split"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function version.
	Audit FunctionAudit `json:"audit"`
	// The date and time the function version was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName             string                                      `json:"displayName"`
	PrintPageSplitConfig    FunctionVersionSplitPrintPageSplitConfig    `json:"printPageSplitConfig"`
	SemanticPageSplitConfig FunctionVersionSplitSemanticPageSplitConfig `json:"semanticPageSplitConfig"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FunctionID              respjson.Field
		FunctionName            respjson.Field
		SplitType               respjson.Field
		Type                    respjson.Field
		VersionNum              respjson.Field
		Audit                   respjson.Field
		CreatedAt               respjson.Field
		DisplayName             respjson.Field
		PrintPageSplitConfig    respjson.Field
		SemanticPageSplitConfig respjson.Field
		Tags                    respjson.Field
		UsedInWorkflows         respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionVersionSplit) RawJSON

func (r FunctionVersionSplit) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionVersionSplit) UnmarshalJSON

func (r *FunctionVersionSplit) UnmarshalJSON(data []byte) error

type FunctionVersionSplitPrintPageSplitConfig

type FunctionVersionSplitPrintPageSplitConfig struct {
	NextFunctionID string `json:"nextFunctionID"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		NextFunctionID respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionVersionSplitPrintPageSplitConfig) RawJSON

Returns the unmodified JSON received from the API

func (*FunctionVersionSplitPrintPageSplitConfig) UnmarshalJSON

func (r *FunctionVersionSplitPrintPageSplitConfig) UnmarshalJSON(data []byte) error

type FunctionVersionSplitSemanticPageSplitConfig

type FunctionVersionSplitSemanticPageSplitConfig struct {
	ItemClasses []SplitFunctionSemanticPageItemClass `json:"itemClasses"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemClasses respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionVersionSplitSemanticPageSplitConfig) RawJSON

Returns the unmodified JSON received from the API

func (*FunctionVersionSplitSemanticPageSplitConfig) UnmarshalJSON

func (r *FunctionVersionSplitSemanticPageSplitConfig) UnmarshalJSON(data []byte) error

type FunctionVersionTransform

type FunctionVersionTransform struct {
	// Email address automatically created by bem. You can forward emails with or
	// without attachments, to be transformed.
	EmailAddress string `json:"emailAddress" api:"required"`
	// Unique identifier of function.
	FunctionID string `json:"functionID" api:"required"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName string `json:"functionName" api:"required"`
	// Desired output structure defined in standard JSON Schema convention.
	OutputSchema any `json:"outputSchema" api:"required"`
	// Name of output schema object.
	OutputSchemaName string `json:"outputSchemaName" api:"required"`
	// Whether tabular chunking is enabled on the pipeline. This processes tables in
	// CSV/Excel in row batches, rather than all rows at once.
	TabularChunkingEnabled bool               `json:"tabularChunkingEnabled" api:"required"`
	Type                   constant.Transform `json:"type" default:"transform"`
	// Version number of function.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information for the function version.
	Audit FunctionAudit `json:"audit"`
	// The date and time the function version was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName string `json:"displayName"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags"`
	// List of workflows that use this function.
	UsedInWorkflows []WorkflowUsageInfo `json:"usedInWorkflows"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EmailAddress           respjson.Field
		FunctionID             respjson.Field
		FunctionName           respjson.Field
		OutputSchema           respjson.Field
		OutputSchemaName       respjson.Field
		TabularChunkingEnabled respjson.Field
		Type                   respjson.Field
		VersionNum             respjson.Field
		Audit                  respjson.Field
		CreatedAt              respjson.Field
		DisplayName            respjson.Field
		Tags                   respjson.Field
		UsedInWorkflows        respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FunctionVersionTransform) RawJSON

func (r FunctionVersionTransform) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionVersionTransform) UnmarshalJSON

func (r *FunctionVersionTransform) UnmarshalJSON(data []byte) error

type FunctionVersionUnion

type FunctionVersionUnion struct {
	EmailAddress           string `json:"emailAddress"`
	FunctionID             string `json:"functionID"`
	FunctionName           string `json:"functionName"`
	OutputSchema           any    `json:"outputSchema"`
	OutputSchemaName       string `json:"outputSchemaName"`
	TabularChunkingEnabled bool   `json:"tabularChunkingEnabled"`
	// Any of "transform", "extract", "analyze", "classify", "send", "split", "join",
	// "enrich", "payload_shaping", "parse".
	Type       string `json:"type"`
	VersionNum int64  `json:"versionNum"`
	// This field is from variant [FunctionVersionTransform].
	Audit               FunctionAudit       `json:"audit"`
	CreatedAt           time.Time           `json:"createdAt"`
	DisplayName         string              `json:"displayName"`
	Tags                []string            `json:"tags"`
	UsedInWorkflows     []WorkflowUsageInfo `json:"usedInWorkflows"`
	EnableBoundingBoxes bool                `json:"enableBoundingBoxes"`
	PreCount            bool                `json:"preCount"`
	// This field is from variant [FunctionVersionClassify].
	Classifications []ClassificationListItem `json:"classifications"`
	Description     string                   `json:"description"`
	// This field is from variant [FunctionVersionSend].
	DestinationType SendDestinationType `json:"destinationType"`
	// This field is from variant [FunctionVersionSend].
	GoogleDriveFolderID string `json:"googleDriveFolderId"`
	// This field is from variant [FunctionVersionSend].
	S3Bucket string `json:"s3Bucket"`
	// This field is from variant [FunctionVersionSend].
	S3Prefix string `json:"s3Prefix"`
	// This field is from variant [FunctionVersionSend].
	WebhookSigningEnabled bool `json:"webhookSigningEnabled"`
	// This field is from variant [FunctionVersionSend].
	WebhookURL string `json:"webhookUrl"`
	// This field is from variant [FunctionVersionSplit].
	SplitType string `json:"splitType"`
	// This field is from variant [FunctionVersionSplit].
	PrintPageSplitConfig FunctionVersionSplitPrintPageSplitConfig `json:"printPageSplitConfig"`
	// This field is from variant [FunctionVersionSplit].
	SemanticPageSplitConfig FunctionVersionSplitSemanticPageSplitConfig `json:"semanticPageSplitConfig"`
	// This field is from variant [FunctionVersionJoin].
	JoinType string `json:"joinType"`
	// This field is from variant [FunctionVersionEnrich].
	Config EnrichConfig `json:"config"`
	// This field is from variant [FunctionVersionPayloadShaping].
	ShapingSchema string `json:"shapingSchema"`
	// This field is from variant [FunctionVersionParse].
	ExtraConfig FunctionVersionParseExtraConfig `json:"extraConfig"`
	// This field is from variant [FunctionVersionParse].
	ParseConfig ParseConfig `json:"parseConfig"`
	JSON        struct {
		EmailAddress            respjson.Field
		FunctionID              respjson.Field
		FunctionName            respjson.Field
		OutputSchema            respjson.Field
		OutputSchemaName        respjson.Field
		TabularChunkingEnabled  respjson.Field
		Type                    respjson.Field
		VersionNum              respjson.Field
		Audit                   respjson.Field
		CreatedAt               respjson.Field
		DisplayName             respjson.Field
		Tags                    respjson.Field
		UsedInWorkflows         respjson.Field
		EnableBoundingBoxes     respjson.Field
		PreCount                respjson.Field
		Classifications         respjson.Field
		Description             respjson.Field
		DestinationType         respjson.Field
		GoogleDriveFolderID     respjson.Field
		S3Bucket                respjson.Field
		S3Prefix                respjson.Field
		WebhookSigningEnabled   respjson.Field
		WebhookURL              respjson.Field
		SplitType               respjson.Field
		PrintPageSplitConfig    respjson.Field
		SemanticPageSplitConfig respjson.Field
		JoinType                respjson.Field
		Config                  respjson.Field
		ShapingSchema           respjson.Field
		ExtraConfig             respjson.Field
		ParseConfig             respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FunctionVersionUnion contains all possible properties and values from FunctionVersionTransform, FunctionVersionExtract, FunctionVersionAnalyze, FunctionVersionClassify, FunctionVersionSend, FunctionVersionSplit, FunctionVersionJoin, FunctionVersionEnrich, FunctionVersionPayloadShaping, FunctionVersionParse.

Use the FunctionVersionUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FunctionVersionUnion) AsAnalyze

func (u FunctionVersionUnion) AsAnalyze() (v FunctionVersionAnalyze)

func (FunctionVersionUnion) AsAny

func (u FunctionVersionUnion) AsAny() anyFunctionVersion

Use the following switch statement to find the correct variant

switch variant := FunctionVersionUnion.AsAny().(type) {
case bem.FunctionVersionTransform:
case bem.FunctionVersionExtract:
case bem.FunctionVersionAnalyze:
case bem.FunctionVersionClassify:
case bem.FunctionVersionSend:
case bem.FunctionVersionSplit:
case bem.FunctionVersionJoin:
case bem.FunctionVersionEnrich:
case bem.FunctionVersionPayloadShaping:
case bem.FunctionVersionParse:
default:
  fmt.Errorf("no variant present")
}

func (FunctionVersionUnion) AsClassify added in v0.7.0

func (u FunctionVersionUnion) AsClassify() (v FunctionVersionClassify)

func (FunctionVersionUnion) AsEnrich

func (FunctionVersionUnion) AsExtract added in v0.2.0

func (u FunctionVersionUnion) AsExtract() (v FunctionVersionExtract)

func (FunctionVersionUnion) AsJoin

func (FunctionVersionUnion) AsParse added in v0.10.0

func (FunctionVersionUnion) AsPayloadShaping

func (u FunctionVersionUnion) AsPayloadShaping() (v FunctionVersionPayloadShaping)

func (FunctionVersionUnion) AsSend

func (FunctionVersionUnion) AsSplit

func (FunctionVersionUnion) AsTransform

func (u FunctionVersionUnion) AsTransform() (v FunctionVersionTransform)

func (FunctionVersionUnion) RawJSON

func (u FunctionVersionUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*FunctionVersionUnion) UnmarshalJSON

func (r *FunctionVersionUnion) UnmarshalJSON(data []byte) error

type InboundEmailEvent

type InboundEmailEvent struct {
	// The email address of the sender.
	From string `json:"from" api:"required"`
	// The subject of the email.
	Subject string `json:"subject" api:"required"`
	// The email address of the recipient.
	To string `json:"to" api:"required"`
	// The email address of the original intended recipient if the email itself was
	// forwarded.
	DeliveredTo string `json:"deliveredTo"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		From        respjson.Field
		Subject     respjson.Field
		To          respjson.Field
		DeliveredTo respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboundEmailEvent) RawJSON

func (r InboundEmailEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*InboundEmailEvent) UnmarshalJSON

func (r *InboundEmailEvent) UnmarshalJSON(data []byte) error

type InferSchemaNewParams

type InferSchemaNewParams struct {
	// The file to analyze and infer a JSON schema from.
	File any `json:"file,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (InferSchemaNewParams) MarshalMultipart

func (r InferSchemaNewParams) MarshalMultipart() (data []byte, contentType string, err error)

type InferSchemaNewResponse

type InferSchemaNewResponse struct {
	// Analysis result returned by the infer-schema endpoint.
	Analysis InferSchemaNewResponseAnalysis `json:"analysis" api:"required"`
	// Original filename of the uploaded file.
	Filename string `json:"filename" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Analysis    respjson.Field
		Filename    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response from the infer-schema endpoint.

func (InferSchemaNewResponse) RawJSON

func (r InferSchemaNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InferSchemaNewResponse) UnmarshalJSON

func (r *InferSchemaNewResponse) UnmarshalJSON(data []byte) error

type InferSchemaNewResponseAnalysis

type InferSchemaNewResponseAnalysis struct {
	// Classification of the primary content. One of: `textual`, `visual`, `audio`,
	// `video`, `mixed`.
	ContentNature string `json:"contentNature" api:"required"`
	// MIME content type of the uploaded file.
	ContentType string `json:"contentType" api:"required"`
	// 2-3 sentence description of what the file contains.
	Description string `json:"description" api:"required"`
	// List of distinct document types found in the file with counts.
	DocumentTypes []InferSchemaNewResponseAnalysisDocumentType `json:"documentTypes" api:"required"`
	// Original filename of the uploaded file.
	FileName string `json:"fileName" api:"required"`
	// High-level file category (e.g. "document", "image", "spreadsheet", "email").
	FileType string `json:"fileType" api:"required"`
	// Whether the file contains multiple separate documents bundled together.
	IsMultiDocument bool `json:"isMultiDocument" api:"required"`
	// Size of the uploaded file in bytes.
	SizeBytes int64 `json:"sizeBytes" api:"required"`
	// Inferred JSON Schema representing all extractable data fields.
	Schema any `json:"schema"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ContentNature   respjson.Field
		ContentType     respjson.Field
		Description     respjson.Field
		DocumentTypes   respjson.Field
		FileName        respjson.Field
		FileType        respjson.Field
		IsMultiDocument respjson.Field
		SizeBytes       respjson.Field
		Schema          respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Analysis result returned by the infer-schema endpoint.

func (InferSchemaNewResponseAnalysis) RawJSON

Returns the unmodified JSON received from the API

func (*InferSchemaNewResponseAnalysis) UnmarshalJSON

func (r *InferSchemaNewResponseAnalysis) UnmarshalJSON(data []byte) error

type InferSchemaNewResponseAnalysisDocumentType

type InferSchemaNewResponseAnalysisDocumentType struct {
	// Number of instances of this document type in the file.
	Count int64 `json:"count" api:"required"`
	// Brief description of this document type.
	Description string `json:"description" api:"required"`
	// Short snake_case name (e.g. "invoice", "receipt", "utility_bill").
	Name string `json:"name" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Description respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Describes a distinct document type found in the file.

func (InferSchemaNewResponseAnalysisDocumentType) RawJSON

Returns the unmodified JSON received from the API

func (*InferSchemaNewResponseAnalysisDocumentType) UnmarshalJSON

func (r *InferSchemaNewResponseAnalysisDocumentType) UnmarshalJSON(data []byte) error

type InferSchemaService

type InferSchemaService struct {
	// contains filtered or unexported fields
}

Infer JSON Schemas from uploaded documents using AI.

Upload a file (PDF, image, spreadsheet, email, etc.) and receive a general-purpose JSON Schema that captures the document's structure. The inferred schema can be used directly as the `outputSchema` when creating Extract functions.

The schema is designed to be broadly applicable to documents of the same type, not just the specific file uploaded.

InferSchemaService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewInferSchemaService method instead.

func NewInferSchemaService

func NewInferSchemaService(opts ...option.RequestOption) (r InferSchemaService)

NewInferSchemaService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*InferSchemaService) New

**Analyze a file and infer a JSON Schema from its contents.**

Accepts a file via multipart form upload and uses Gemini to analyze the document, returning a description of its contents, an inferred JSON Schema capturing all extractable fields, and document classification metadata.

The returned schema is designed to be reusable across many similar documents of the same type, not just the specific file uploaded. It can be used directly as the `outputSchema` when creating a Transform function.

The endpoint also detects whether the file contains multiple bundled documents and classifies the content nature (textual, visual, audio, video, or mixed).

## Supported file types

PDF, PNG, JPEG, HEIC, HEIF, WebP, CSV, XLS, XLSX, DOCX, JSON, HTML, XML, EML, plain text, WAV, MP3, M4A, MP4.

## File size limit

Maximum file size is **20 MB**.

## Examples

Using curl:

```bash

curl -X POST https://api.bem.ai/v3/infer-schema \
  -H "x-api-key: YOUR_API_KEY" \
  -F "file=@invoice.pdf"

```

Using the Bem CLI:

```bash bem infer-schema create --file @invoice.pdf ```

type InputType added in v0.14.0

type InputType string

The input type of the content you're sending for transformation.

const (
	InputTypeCsv   InputType = "csv"
	InputTypeDocx  InputType = "docx"
	InputTypeEmail InputType = "email"
	InputTypeHeic  InputType = "heic"
	InputTypeHTML  InputType = "html"
	InputTypeJpeg  InputType = "jpeg"
	InputTypeJson  InputType = "json"
	InputTypeHeif  InputType = "heif"
	InputTypeM4a   InputType = "m4a"
	InputTypeMP3   InputType = "mp3"
	InputTypePdf   InputType = "pdf"
	InputTypePng   InputType = "png"
	InputTypeText  InputType = "text"
	InputTypeWav   InputType = "wav"
	InputTypeWebp  InputType = "webp"
	InputTypeXls   InputType = "xls"
	InputTypeXlsx  InputType = "xlsx"
	InputTypeXml   InputType = "xml"
)

type JoinWebhookEvent added in v0.14.0

type JoinWebhookEvent struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// List of properties that were invalid in the input.
	InvalidProperties []string `json:"invalidProperties" api:"required"`
	// The items that were joined.
	Items []JoinWebhookEventItem `json:"items" api:"required"`
	// The type of join that was performed.
	//
	// Any of "standard".
	JoinType JoinWebhookEventJoinType `json:"joinType" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// The transformed content of the input. The structure of this object is defined by
	// the function configuration.
	TransformedContent any `json:"transformedContent" api:"required"`
	// Average confidence score across all extracted fields, in the range [0, 1].
	AvgConfidence float64 `json:"avgConfidence" api:"nullable"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "join".
	EventType JoinWebhookEventEventType `json:"eventType"`
	// Per-field confidence scores. A JSON object mapping RFC 6901 JSON Pointer paths
	// (e.g. `"/invoiceNumber"`) to float values in the range [0, 1] indicating the
	// model's confidence in each extracted field value.
	FieldConfidences any `json:"fieldConfidences"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent        `json:"inboundEmail"`
	Metadata     JoinWebhookEventMetadata `json:"metadata"`
	// Unique ID for each transformation output generated by bem following Segment's
	// KSUID conventions.
	TransformationID string `json:"transformationID"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		InvalidProperties     respjson.Field
		Items                 respjson.Field
		JoinType              respjson.Field
		ReferenceID           respjson.Field
		TransformedContent    respjson.Field
		AvgConfidence         respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FieldConfidences      respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		TransformationID      respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (JoinWebhookEvent) RawJSON added in v0.14.0

func (r JoinWebhookEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*JoinWebhookEvent) UnmarshalJSON added in v0.14.0

func (r *JoinWebhookEvent) UnmarshalJSON(data []byte) error

type JoinWebhookEventEventType added in v0.14.0

type JoinWebhookEventEventType string
const (
	JoinWebhookEventEventTypeJoin JoinWebhookEventEventType = "join"
)

type JoinWebhookEventItem added in v0.14.0

type JoinWebhookEventItem struct {
	// The number of items that were transformed.
	ItemCount int64 `json:"itemCount" api:"required"`
	// The offset of the first item that was transformed. Used for batch
	// transformations to indicate which item in the batch this event corresponds to.
	ItemOffset int64 `json:"itemOffset" api:"required"`
	// The unique ID you use internally to refer to this data point.
	ItemReferenceID string `json:"itemReferenceID" api:"required"`
	// The presigned S3 URL of the file that was joined.
	S3URL string `json:"s3URL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemCount       respjson.Field
		ItemOffset      respjson.Field
		ItemReferenceID respjson.Field
		S3URL           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (JoinWebhookEventItem) RawJSON added in v0.14.0

func (r JoinWebhookEventItem) RawJSON() string

Returns the unmodified JSON received from the API

func (*JoinWebhookEventItem) UnmarshalJSON added in v0.14.0

func (r *JoinWebhookEventItem) UnmarshalJSON(data []byte) error

type JoinWebhookEventJoinType added in v0.14.0

type JoinWebhookEventJoinType string

The type of join that was performed.

const (
	JoinWebhookEventJoinTypeStandard JoinWebhookEventJoinType = "standard"
)

type JoinWebhookEventMetadata added in v0.14.0

type JoinWebhookEventMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (JoinWebhookEventMetadata) RawJSON added in v0.14.0

func (r JoinWebhookEventMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*JoinWebhookEventMetadata) UnmarshalJSON added in v0.14.0

func (r *JoinWebhookEventMetadata) UnmarshalJSON(data []byte) error

type KnowledgeGraphGetParams added in v0.21.0

type KnowledgeGraphGetParams struct {
	// Optional bucket public ID (`bkt_...`) to scope the read to one bucket. Omit for
	// the unscoped (all account+environment) view.
	Bucket param.Opt[string] `query:"bucket,omitzero" json:"-"`
	// Cursor: return edges whose KSUID sorts after this value.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Maximum number of edges per page (default 50, max 200).
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Case-insensitive substring match on canonical names. Both endpoints of an edge
	// must match for the edge (and its nodes) to be returned.
	Search param.Opt[string] `query:"search,omitzero" json:"-"`
	// Only edges created at/after this RFC 3339 timestamp.
	Since param.Opt[time.Time] `query:"since,omitzero" format:"date-time" json:"-"`
	// Restrict to entities of these types. An edge is returned only when BOTH of its
	// endpoints survive the type filter.
	Type []string `query:"type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (KnowledgeGraphGetParams) URLQuery added in v0.21.0

func (r KnowledgeGraphGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes KnowledgeGraphGetParams's query parameters as `url.Values`.

type KnowledgeGraphGetResponse added in v0.21.0

type KnowledgeGraphGetResponse struct {
	// The page of edges.
	Edges []KnowledgeGraphGetResponseEdge `json:"edges" api:"required"`
	// Distinct endpoint entities of the returned edge page.
	Nodes []KnowledgeGraphGetResponseNode `json:"nodes" api:"required"`
	// Opaque cursor for the next page of edges, or absent on the last page. Pass it
	// back as `cursor`.
	NextCursor string `json:"nextCursor"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Edges       respjson.Field
		Nodes       respjson.Field
		NextCursor  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response body for `GET /v3/knowledge-graph`. Pagination is over edges; `nodes` are the distinct endpoint entities of the returned edge page (both endpoints of every edge are included).

func (KnowledgeGraphGetResponse) RawJSON added in v0.21.0

func (r KnowledgeGraphGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*KnowledgeGraphGetResponse) UnmarshalJSON added in v0.21.0

func (r *KnowledgeGraphGetResponse) UnmarshalJSON(data []byte) error

type KnowledgeGraphGetResponseEdge added in v0.21.0

type KnowledgeGraphGetResponseEdge struct {
	// How many times this edge has been observed.
	MentionCount int64 `json:"mentionCount" api:"required"`
	// Free-form relation label.
	RelationType string `json:"relationType" api:"required"`
	// Source entity public id (`ent_...`).
	SourceID string `json:"sourceId" api:"required"`
	// Target entity public id (`ent_...`).
	TargetID string `json:"targetId" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MentionCount respjson.Field
		RelationType respjson.Field
		SourceID     respjson.Field
		TargetID     respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

One directed edge between two entities, addressed by their public ids.

func (KnowledgeGraphGetResponseEdge) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*KnowledgeGraphGetResponseEdge) UnmarshalJSON added in v0.21.0

func (r *KnowledgeGraphGetResponseEdge) UnmarshalJSON(data []byte) error

type KnowledgeGraphGetResponseNode added in v0.21.0

type KnowledgeGraphGetResponseNode struct {
	// Stable public identifier for the entity (`ent_...`).
	ID string `json:"id" api:"required"`
	// Canonical (most descriptive) surface form.
	Canonical string `json:"canonical" api:"required"`
	// Total mentions of this entity across all parsed documents.
	MentionCount int64 `json:"mentionCount" api:"required"`
	// Effective entity type.
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		Canonical    respjson.Field
		MentionCount respjson.Field
		Type         respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

One entity node in the knowledge graph.

func (KnowledgeGraphGetResponseNode) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*KnowledgeGraphGetResponseNode) UnmarshalJSON added in v0.21.0

func (r *KnowledgeGraphGetResponseNode) UnmarshalJSON(data []byte) error

type KnowledgeGraphService added in v0.21.0

type KnowledgeGraphService struct {
	// contains filtered or unexported fields
}

Read the cross-document knowledge graph — the canonical entities and the directed relations between them that the Parse pipeline populates when `linkAcrossDocuments` is enabled.

  • **`GET /v3/entities/{id}/relations`** returns the inbound and outbound edges incident to one entity, split by direction. Supports `direction`, an exact `relationType` filter, and cursor pagination over edges. A merged-away entity id transparently resolves to its surviving canonical entity.
  • **`GET /v3/knowledge-graph`** returns the graph as `{ nodes, edges }`, paginating over edges. The `nodes` for a page are the distinct endpoint entities of that page's edges (both endpoints of every edge are included). Filter with `type[]`, `since`, and `search`; an edge is returned only when both of its endpoints survive the entity filters.

Both endpoints take an optional `bucket` (`bkt_...`) to scope the read to a single bucket; omit it for the unscoped account+environment view.

KnowledgeGraphService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewKnowledgeGraphService method instead.

func NewKnowledgeGraphService added in v0.21.0

func NewKnowledgeGraphService(opts ...option.RequestOption) (r KnowledgeGraphService)

NewKnowledgeGraphService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*KnowledgeGraphService) Get added in v0.21.0

Retrieve the Knowledge Graph

type ListFunctionVersionsResponse

type ListFunctionVersionsResponse struct {
	// The total number of results available.
	TotalCount int64                  `json:"totalCount"`
	Versions   []FunctionVersionUnion `json:"versions"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		TotalCount  respjson.Field
		Versions    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListFunctionVersionsResponse) RawJSON

Returns the unmodified JSON received from the API

func (*ListFunctionVersionsResponse) UnmarshalJSON

func (r *ListFunctionVersionsResponse) UnmarshalJSON(data []byte) error

type ListFunctionsResponse

type ListFunctionsResponse struct {
	Functions []FunctionUnion `json:"functions"`
	// The total number of results available.
	TotalCount int64 `json:"totalCount"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Functions   respjson.Field
		TotalCount  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListFunctionsResponse) RawJSON

func (r ListFunctionsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListFunctionsResponse) UnmarshalJSON

func (r *ListFunctionsResponse) UnmarshalJSON(data []byte) error

type OutputGetResponse

type OutputGetResponse struct {
	// V3 read-side event union. Superset of the shared `Event` union: it contains
	// every shared variant verbatim (backward compatible) and adds the V3-only
	// `extract`, `parse`, `classify`, `analyze`, `payload_shaping`, and `evaluation`
	// variants. This is also the union delivered as the body of outbound webhook
	// payloads.
	Output EventUnion `json:"output" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OutputGetResponse) RawJSON

func (r OutputGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*OutputGetResponse) UnmarshalJSON

func (r *OutputGetResponse) UnmarshalJSON(data []byte) error

type OutputListParams

type OutputListParams struct {
	EndingBefore param.Opt[string] `query:"endingBefore,omitzero" json:"-"`
	// When `true`, includes intermediate events (those that spawned a downstream
	// function call). Default: `false`.
	IncludeIntermediate param.Opt[bool] `query:"includeIntermediate,omitzero" json:"-"`
	// If `true`, only outputs with a corrected (labelled) payload. If `false`, only
	// outputs that are not labelled. If omitted, no filter is applied.
	IsLabelled param.Opt[bool] `query:"isLabelled,omitzero" json:"-"`
	// If `true`, only regression-marked outputs. If `false`, only non-regression
	// outputs. If omitted, no filter is applied.
	//
	// Note: clients migrating from `/v1-beta/transformations` should pass
	// `isRegression=false` explicitly to preserve the legacy default (regressions
	// hidden unless explicitly requested).
	IsRegression param.Opt[bool]  `query:"isRegression,omitzero" json:"-"`
	Limit        param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Case-insensitive substring match against `referenceID`.
	ReferenceIDSubstring param.Opt[string] `query:"referenceIDSubstring,omitzero" json:"-"`
	StartingAfter        param.Opt[string] `query:"startingAfter,omitzero" json:"-"`
	// Filter to outputs from specific calls.
	CallIDs []string `query:"callIDs,omitzero" json:"-"`
	// Filter to specific output events by their event IDs (KSUIDs).
	EventIDs []string `query:"eventIDs,omitzero" json:"-"`
	// Filter to specific non-error output event types, e.g. `classify` or `extract`.
	EventTypes    []string `query:"eventTypes,omitzero" json:"-"`
	FunctionIDs   []string `query:"functionIDs,omitzero" json:"-"`
	FunctionNames []string `query:"functionNames,omitzero" json:"-"`
	// Filter to specific function version numbers.
	FunctionVersionNums []int64  `query:"functionVersionNums,omitzero" json:"-"`
	ReferenceIDs        []string `query:"referenceIDs,omitzero" json:"-"`
	// Any of "asc", "desc".
	SortOrder OutputListParamsSortOrder `query:"sortOrder,omitzero" json:"-"`
	// Filter by legacy transformation IDs. Provided for backwards compatibility with
	// clients migrating from `/v1-beta/transformations`.
	TransformationIDs []string `query:"transformationIDs,omitzero" json:"-"`
	WorkflowIDs       []string `query:"workflowIDs,omitzero" json:"-"`
	WorkflowNames     []string `query:"workflowNames,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (OutputListParams) URLQuery

func (r OutputListParams) URLQuery() (v url.Values, err error)

URLQuery serializes OutputListParams's query parameters as `url.Values`.

type OutputListParamsSortOrder

type OutputListParamsSortOrder string
const (
	OutputListParamsSortOrderAsc  OutputListParamsSortOrder = "asc"
	OutputListParamsSortOrderDesc OutputListParamsSortOrder = "desc"
)

type OutputService

type OutputService struct {
	// contains filtered or unexported fields
}

Retrieve terminal non-error output events from workflow calls.

Outputs are events produced by successful terminal function steps — steps that completed without errors and did not spawn further downstream function calls. A single workflow call may produce multiple outputs (e.g. from a split-then-transform pipeline).

Outputs and errors from the same call are not mutually exclusive: a partially-completed workflow may have both.

Use `GET /v3/outputs` to list outputs across calls, or `GET /v3/outputs/{eventID}` to retrieve a specific output. To get outputs scoped to a single call, filter by `callIDs`.

OutputService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewOutputService method instead.

func NewOutputService

func NewOutputService(opts ...option.RequestOption) (r OutputService)

NewOutputService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*OutputService) Get

func (r *OutputService) Get(ctx context.Context, eventID string, opts ...option.RequestOption) (res *OutputGetResponse, err error)

**Retrieve a single output event by ID.**

Fetches any non-error event by its `eventID`. Returns `404` if the event does not exist or if it is an error event (use `GET /v3/errors/{eventID}` for those).

func (*OutputService) List

**List terminal non-error output events.**

Returns events that represent successful terminal outputs — primary events (non-split-collection) that did not trigger any downstream function calls. Error events are excluded; use `GET /v3/errors` to retrieve those.

## Intermediate Events

By default, intermediate events (those that spawned a downstream function call in a multi-step workflow) are excluded. Pass `includeIntermediate=true` to include them.

## Filtering

Filter by call, workflow, function, or reference ID. Multiple filters are ANDed together.

func (*OutputService) ListAutoPaging

**List terminal non-error output events.**

Returns events that represent successful terminal outputs — primary events (non-split-collection) that did not trigger any downstream function calls. Error events are excluded; use `GET /v3/errors` to retrieve those.

## Intermediate Events

By default, intermediate events (those that spawned a downstream function call in a multi-step workflow) are excluded. Pass `includeIntermediate=true` to include them.

## Filtering

Filter by call, workflow, function, or reference ID. Multiple filters are ANDed together.

type ParseConfig added in v0.14.0

type ParseConfig struct {
	// When true, extract named entities (people, organizations, products, studies,
	// identifiers, etc.) and the relationships between them, and dedupe by canonical
	// name within the document. When false, only `sections[]` is extracted;
	// `entities[]` and `relationships[]` come back empty in the parse output. Defaults
	// to true.
	ExtractEntities bool `json:"extractEntities"`
	// When true, link this document's entities to entities seen in earlier documents
	// in this environment, building one canonical record per real-world thing across
	// the corpus. Visible in the Memory tab and queryable via `POST /v3/fs` (op=find /
	// open / xref). Doesn't change this call's parse output. Requires
	// `extractEntities=true`. Defaults to true.
	LinkAcrossDocuments bool `json:"linkAcrossDocuments"`
	// Optional JSONSchema. When provided, each chunk performs schema-guided
	// extraction. When absent, chunks perform open-ended discovery and return
	// sections, entities, and relationships per the discovery schema.
	Schema any `json:"schema"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExtractEntities     respjson.Field
		LinkAcrossDocuments respjson.Field
		Schema              respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Per-version configuration for a Parse function.

Parse renders document pages (PDF, image) via vision LLM and emits structured JSON. The two toggles below independently control entity extraction (a per-call output concern) and cross-document memory linking (an environment-wide concern).

func (ParseConfig) RawJSON added in v0.14.0

func (r ParseConfig) RawJSON() string

Returns the unmodified JSON received from the API

func (ParseConfig) ToParam added in v0.14.0

func (r ParseConfig) ToParam() ParseConfigParam

ToParam converts this ParseConfig to a ParseConfigParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ParseConfigParam.Overrides()

func (*ParseConfig) UnmarshalJSON added in v0.14.0

func (r *ParseConfig) UnmarshalJSON(data []byte) error

type ParseConfigParam added in v0.14.0

type ParseConfigParam struct {
	// When true, extract named entities (people, organizations, products, studies,
	// identifiers, etc.) and the relationships between them, and dedupe by canonical
	// name within the document. When false, only `sections[]` is extracted;
	// `entities[]` and `relationships[]` come back empty in the parse output. Defaults
	// to true.
	ExtractEntities param.Opt[bool] `json:"extractEntities,omitzero"`
	// When true, link this document's entities to entities seen in earlier documents
	// in this environment, building one canonical record per real-world thing across
	// the corpus. Visible in the Memory tab and queryable via `POST /v3/fs` (op=find /
	// open / xref). Doesn't change this call's parse output. Requires
	// `extractEntities=true`. Defaults to true.
	LinkAcrossDocuments param.Opt[bool] `json:"linkAcrossDocuments,omitzero"`
	// Optional JSONSchema. When provided, each chunk performs schema-guided
	// extraction. When absent, chunks perform open-ended discovery and return
	// sections, entities, and relationships per the discovery schema.
	Schema any `json:"schema,omitzero"`
	// contains filtered or unexported fields
}

Per-version configuration for a Parse function.

Parse renders document pages (PDF, image) via vision LLM and emits structured JSON. The two toggles below independently control entity extraction (a per-call output concern) and cross-document memory linking (an environment-wide concern).

func (ParseConfigParam) MarshalJSON added in v0.14.0

func (r ParseConfigParam) MarshalJSON() (data []byte, err error)

func (*ParseConfigParam) UnmarshalJSON added in v0.14.0

func (r *ParseConfigParam) UnmarshalJSON(data []byte) error

type ParseWebhookEvent added in v0.14.0

type ParseWebhookEvent struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The number of items that were parsed. Used for batch parsing to indicate how
	// many items were parsed.
	ItemCount int64 `json:"itemCount" api:"required"`
	// The offset of the first item that was parsed. Used for batch parsing to indicate
	// which item in the batch this event corresponds to.
	ItemOffset int64 `json:"itemOffset" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// The parsed content of the input. Top-level keys are `sections`, `entities`, and
	// `relationships`; the precise shape is determined by the parse function's
	// configuration.
	TransformedContent any `json:"transformedContent" api:"required"`
	// Average confidence score across all parsed fields, in the range [0, 1].
	AvgConfidence float64 `json:"avgConfidence" api:"nullable"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Corrected feedback provided for fine-tuning purposes.
	CorrectedContent ParseWebhookEventCorrectedContentUnion `json:"correctedContent" api:"nullable"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "parse".
	EventType ParseWebhookEventEventType `json:"eventType"`
	// Per-field bounding boxes. A JSON object mapping RFC 6901 JSON Pointer paths to
	// the document regions from which each parsed value was sourced.
	FieldBoundingBoxes any `json:"fieldBoundingBoxes"`
	// Per-field confidence scores. A JSON object mapping RFC 6901 JSON Pointer paths
	// to float values in the range [0, 1] indicating the model's confidence in each
	// parsed field value.
	FieldConfidences any `json:"fieldConfidences"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent `json:"inboundEmail"`
	// Array of parse inputs with their types and S3 URLs.
	Inputs []ParseWebhookEventInput `json:"inputs" api:"nullable"`
	// The input type of the content you're sending for transformation.
	//
	// Any of "csv", "docx", "email", "heic", "html", "jpeg", "json", "heif", "m4a",
	// "mp3", "pdf", "png", "text", "wav", "webp", "xls", "xlsx", "xml".
	InputType InputType `json:"inputType"`
	// List of properties that were invalid in the input.
	InvalidProperties []string                  `json:"invalidProperties"`
	Metadata          ParseWebhookEventMetadata `json:"metadata"`
	// Presigned S3 URL for the input content uploaded to S3.
	S3URL string `json:"s3URL" api:"nullable"`
	// Unique ID for each transformation output generated by bem following Segment's
	// KSUID conventions.
	TransformationID string `json:"transformationID"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ItemCount             respjson.Field
		ItemOffset            respjson.Field
		ReferenceID           respjson.Field
		TransformedContent    respjson.Field
		AvgConfidence         respjson.Field
		CallID                respjson.Field
		CorrectedContent      respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FieldBoundingBoxes    respjson.Field
		FieldConfidences      respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Inputs                respjson.Field
		InputType             respjson.Field
		InvalidProperties     respjson.Field
		Metadata              respjson.Field
		S3URL                 respjson.Field
		TransformationID      respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a `parse` function completes. Reuses the `extract` event shape on the wire — both wrap a Transformation and downstream consumers care about the same `transformedContent` payload — but uses a distinct `eventType` discriminator so receivers can dispatch on the function type that produced it.

func (ParseWebhookEvent) RawJSON added in v0.14.0

func (r ParseWebhookEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ParseWebhookEvent) UnmarshalJSON added in v0.14.0

func (r *ParseWebhookEvent) UnmarshalJSON(data []byte) error

type ParseWebhookEventCorrectedContentOutput added in v0.14.0

type ParseWebhookEventCorrectedContentOutput struct {
	Output []AnyTypeUnion `json:"output"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ParseWebhookEventCorrectedContentOutput) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*ParseWebhookEventCorrectedContentOutput) UnmarshalJSON added in v0.14.0

func (r *ParseWebhookEventCorrectedContentOutput) UnmarshalJSON(data []byte) error

type ParseWebhookEventCorrectedContentUnion added in v0.14.0

type ParseWebhookEventCorrectedContentUnion struct {
	// This field will be present if the value is a [[]any] instead of an object.
	OfAnyArray []any `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field is from variant [ParseWebhookEventCorrectedContentOutput].
	Output []AnyTypeUnion `json:"output"`
	JSON   struct {
		OfAnyArray respjson.Field
		OfString   respjson.Field
		OfFloat    respjson.Field
		OfBool     respjson.Field
		Output     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ParseWebhookEventCorrectedContentUnion contains all possible properties and values from ParseWebhookEventCorrectedContentOutput, [[]any], [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfAnyArray OfString OfFloat OfBool]

func (ParseWebhookEventCorrectedContentUnion) AsAnyArray added in v0.14.0

func (u ParseWebhookEventCorrectedContentUnion) AsAnyArray() (v []any)

func (ParseWebhookEventCorrectedContentUnion) AsBool added in v0.14.0

func (ParseWebhookEventCorrectedContentUnion) AsFloat added in v0.14.0

func (ParseWebhookEventCorrectedContentUnion) AsParseWebhookEventCorrectedContentOutput added in v0.14.0

func (u ParseWebhookEventCorrectedContentUnion) AsParseWebhookEventCorrectedContentOutput() (v ParseWebhookEventCorrectedContentOutput)

func (ParseWebhookEventCorrectedContentUnion) AsString added in v0.14.0

func (ParseWebhookEventCorrectedContentUnion) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*ParseWebhookEventCorrectedContentUnion) UnmarshalJSON added in v0.14.0

func (r *ParseWebhookEventCorrectedContentUnion) UnmarshalJSON(data []byte) error

type ParseWebhookEventEventType added in v0.14.0

type ParseWebhookEventEventType string
const (
	ParseWebhookEventEventTypeParse ParseWebhookEventEventType = "parse"
)

type ParseWebhookEventInput added in v0.14.0

type ParseWebhookEventInput struct {
	InputContent     string `json:"inputContent" api:"nullable"`
	InputType        string `json:"inputType" api:"nullable"`
	JsonInputContent any    `json:"jsonInputContent" api:"nullable"`
	S3URL            string `json:"s3URL" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InputContent     respjson.Field
		InputType        respjson.Field
		JsonInputContent respjson.Field
		S3URL            respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ParseWebhookEventInput) RawJSON added in v0.14.0

func (r ParseWebhookEventInput) RawJSON() string

Returns the unmodified JSON received from the API

func (*ParseWebhookEventInput) UnmarshalJSON added in v0.14.0

func (r *ParseWebhookEventInput) UnmarshalJSON(data []byte) error

type ParseWebhookEventMetadata added in v0.14.0

type ParseWebhookEventMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ParseWebhookEventMetadata) RawJSON added in v0.14.0

func (r ParseWebhookEventMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*ParseWebhookEventMetadata) UnmarshalJSON added in v0.14.0

func (r *ParseWebhookEventMetadata) UnmarshalJSON(data []byte) error

type PayloadShapingWebhookEvent added in v0.14.0

type PayloadShapingWebhookEvent struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// The reshaped payload produced by applying the function's JMESPath expressions to
	// the input data.
	TransformedContent any `json:"transformedContent" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "payload_shaping".
	EventType PayloadShapingWebhookEventEventType `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent                  `json:"inboundEmail"`
	Metadata     PayloadShapingWebhookEventMetadata `json:"metadata"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ReferenceID           respjson.Field
		TransformedContent    respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted by `payload_shaping` functions, which restructure JSON payloads using JMESPath expressions configured on the function. The shaped result is carried in `transformedContent`.

func (PayloadShapingWebhookEvent) RawJSON added in v0.14.0

func (r PayloadShapingWebhookEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*PayloadShapingWebhookEvent) UnmarshalJSON added in v0.14.0

func (r *PayloadShapingWebhookEvent) UnmarshalJSON(data []byte) error

type PayloadShapingWebhookEventEventType added in v0.14.0

type PayloadShapingWebhookEventEventType string
const (
	PayloadShapingWebhookEventEventTypePayloadShaping PayloadShapingWebhookEventEventType = "payload_shaping"
)

type PayloadShapingWebhookEventMetadata added in v0.14.0

type PayloadShapingWebhookEventMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PayloadShapingWebhookEventMetadata) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*PayloadShapingWebhookEventMetadata) UnmarshalJSON added in v0.14.0

func (r *PayloadShapingWebhookEventMetadata) UnmarshalJSON(data []byte) error

type ReviewQueueListParams added in v0.21.0

type ReviewQueueListParams struct {
	// `me` or a `usr_...` ID — restrict to entities whose effective type that user
	// reviews.
	AssignedTo param.Opt[string] `query:"assignedTo,omitzero" json:"-"`
	// Optional bucket public ID (`bkt_...`) to scope to. Omit for all buckets.
	Bucket param.Opt[string] `query:"bucket,omitzero" json:"-"`
	// Cursor — an `entityID` defining your place in the list.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Limit  param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// RFC3339 timestamp — restrict to entities created at or after this time.
	Since param.Opt[string] `query:"since,omitzero" json:"-"`
	// Restrict to these lifecycle states. Defaults to `extracted` + `proposed`.
	Status []string `query:"status,omitzero" json:"-"`
	// Restrict to entities whose effective type is one of these `ety_...` IDs.
	Type []string `query:"type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ReviewQueueListParams) URLQuery added in v0.21.0

func (r ReviewQueueListParams) URLQuery() (v url.Values, err error)

URLQuery serializes ReviewQueueListParams's query parameters as `url.Values`.

type ReviewQueueListResponse added in v0.21.0

type ReviewQueueListResponse struct {
	// The page of entities awaiting curation.
	Entities []ReviewQueueListResponseEntity `json:"entities" api:"required"`
	// Whether more rows exist beyond this page.
	HasMore bool `json:"hasMore" api:"required"`
	// Opaque cursor to pass as `?cursor=` for the next page. Empty when `hasMore` is
	// false.
	NextCursor string `json:"nextCursor"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Entities    respjson.Field
		HasMore     respjson.Field
		NextCursor  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

`GET /v3/review-queue` response. Cursor-paginated by `entityID` ascending.

func (ReviewQueueListResponse) RawJSON added in v0.21.0

func (r ReviewQueueListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ReviewQueueListResponse) UnmarshalJSON added in v0.21.0

func (r *ReviewQueueListResponse) UnmarshalJSON(data []byte) error

type ReviewQueueListResponseEntity added in v0.21.0

type ReviewQueueListResponseEntity struct {
	// The canonical (longest / most descriptive) surface form.
	Canonical string `json:"canonical" api:"required"`
	// When the entity was created.
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Public ID (`ent_...`) of the entity.
	EntityID string `json:"entityID" api:"required"`
	// Total mentions across all parsed documents.
	MentionCount int64 `json:"mentionCount" api:"required"`
	// A capped preview (up to 2) of the entity's first mentions, ordered by page then
	// time, so a reviewer can triage without opening each entity.
	PreviewMentions []ReviewQueueListResponseEntityPreviewMention `json:"previewMentions" api:"required"`
	// Curation lifecycle state: `extracted`, `proposed`, `approved`, `rejected`.
	Status string `json:"status" api:"required"`
	// Distinct surface forms that have resolved to this entity.
	SurfaceForms []string `json:"surfaceForms" api:"required"`
	// The effective type name (assigned override if set, else bem-inferred).
	Type string `json:"type" api:"required"`
	// When the entity was last updated.
	UpdatedAt time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// Free-form description of the entity, when present.
	Description string `json:"description"`
	// Public ID (`ety_...`) of the customer-assigned type, when one is set.
	TypeID string `json:"typeID"`
	// When a human approved/rejected the entity. Omitted while un-validated.
	ValidatedAt time.Time `json:"validatedAt" format:"date-time"`
	// Public ID (`usr_...`) of the user who validated the entity, when known.
	ValidatedByUserID string `json:"validatedByUserID"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Canonical         respjson.Field
		CreatedAt         respjson.Field
		EntityID          respjson.Field
		MentionCount      respjson.Field
		PreviewMentions   respjson.Field
		Status            respjson.Field
		SurfaceForms      respjson.Field
		Type              respjson.Field
		UpdatedAt         respjson.Field
		Description       respjson.Field
		TypeID            respjson.Field
		ValidatedAt       respjson.Field
		ValidatedByUserID respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

One row of the review queue: an entity plus a small preview of its mentions.

func (ReviewQueueListResponseEntity) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*ReviewQueueListResponseEntity) UnmarshalJSON added in v0.21.0

func (r *ReviewQueueListResponseEntity) UnmarshalJSON(data []byte) error

type ReviewQueueListResponseEntityPreviewMention added in v0.21.0

type ReviewQueueListResponseEntityPreviewMention struct {
	// When this mention was recorded.
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Public ID (`ent_...`) of the entity this mention resolves to.
	EntityID string `json:"entityID" api:"required"`
	// Public ID (`emn_...`) of this mention.
	MentionID string `json:"mentionID" api:"required"`
	// 1-indexed page number within the source document.
	Page int64 `json:"page" api:"required"`
	// The user-provided document handle this mention came from.
	ReferenceID string `json:"referenceID" api:"required"`
	// The exact surface string Parse extracted on the page.
	Surface string `json:"surface" api:"required"`
	// The parse-emitted section label this mention sat under, when present.
	SectionLabel string `json:"sectionLabel"`
	// Public ID of the parse transformation that produced this mention, when known.
	TransformationID string `json:"transformationID"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt        respjson.Field
		EntityID         respjson.Field
		MentionID        respjson.Field
		Page             respjson.Field
		ReferenceID      respjson.Field
		Surface          respjson.Field
		SectionLabel     respjson.Field
		TransformationID respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A single per-document occurrence of an entity, used in review-queue previews.

func (ReviewQueueListResponseEntityPreviewMention) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*ReviewQueueListResponseEntityPreviewMention) UnmarshalJSON added in v0.21.0

func (r *ReviewQueueListResponseEntityPreviewMention) UnmarshalJSON(data []byte) error

type ReviewQueueService added in v0.21.0

type ReviewQueueService struct {
	// contains filtered or unexported fields
}

The reviewer-facing read surface for entity curation, available on the dashboard (JWT) only.

  • **`GET /v3/review-queue`** returns a cursor-paginated set of entities awaiting curation, scoped to your account+environment (and optional `bucket`). Each row is a full entity plus a small preview (up to 2) of its first mentions, so a reviewer can triage without opening every entity.

Filters AND together. `status` (repeatable) defaults to the pre-terminal states `extracted` + `proposed` when omitted. `type` (repeatable `ety_…` IDs) matches the entity's _effective_ type — its assigned type id, or, for entities with no assigned type, its bem-inferred type name. `assignedTo` (`me` or a `usr_…` ID) restricts to entities whose effective type the user reviews. `since` (RFC3339) filters by creation time. Pagination is cursor-based on `entityID` ascending; default limit 50, maximum 200.

ReviewQueueService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewReviewQueueService method instead.

func NewReviewQueueService added in v0.21.0

func NewReviewQueueService(opts ...option.RequestOption) (r ReviewQueueService)

NewReviewQueueService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ReviewQueueService) List added in v0.21.0

**List entities awaiting curation, for a human reviewer's queue.**

Returns a cursor-paginated set of entities scoped to your account+environment (and optional `bucket`), each carrying a small preview of its first mentions so a reviewer can triage without opening every entity. All filters AND together.

  • **`status`** (repeatable) restricts to the given lifecycle states. Omitting it defaults to the pre-terminal states `extracted` and `proposed`.
  • **`type`** (repeatable, `ety_...` IDs) matches the entity's _effective_ type: an entity matches when its assigned type is one of these IDs, or it has no assigned type and its bem-inferred type name matches one of them.
  • **`assignedTo`** (`me` or a `usr_...` ID) restricts to entities whose effective type the given user reviews. `me` resolves to the calling user.
  • **`since`** (RFC3339) restricts to entities created at or after the time.

Pagination is cursor-based on `entityID` ascending; default limit is 50, maximum 200.

type SendDestinationType added in v0.14.0

type SendDestinationType string

Destination type for a Send function.

const (
	SendDestinationTypeWebhook     SendDestinationType = "webhook"
	SendDestinationTypeS3          SendDestinationType = "s3"
	SendDestinationTypeGoogleDrive SendDestinationType = "google_drive"
)

type SendWebhookEvent added in v0.14.0

type SendWebhookEvent struct {
	// Outcome of a Send function's delivery attempt.
	//
	// Any of "success", "skip".
	DeliveryStatus SendWebhookEventDeliveryStatus `json:"deliveryStatus" api:"required"`
	// Destination type for a Send function.
	//
	// Any of "webhook", "s3", "google_drive".
	DestinationType SendDestinationType `json:"destinationType" api:"required"`
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// The full protocol event JSON that was delivered — identical to what subscription
	// publish would deliver for the same event. For ad-hoc calls with a JSON file
	// input, contains the raw input JSON. For ad-hoc calls with a binary file input,
	// contains {"s3URL": "<presigned-url>"}.
	DeliveredContent any `json:"deliveredContent"`
	// Any of "send".
	EventType SendWebhookEventEventType `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// Metadata returned when a Send function delivers to Google Drive.
	GoogleDriveOutput SendWebhookEventGoogleDriveOutput `json:"googleDriveOutput"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent        `json:"inboundEmail"`
	Metadata     SendWebhookEventMetadata `json:"metadata"`
	// Metadata returned when a Send function delivers to an S3 bucket.
	S3Output SendWebhookEventS3Output `json:"s3Output"`
	// Metadata returned when a Send function delivers to a webhook.
	WebhookOutput SendWebhookEventWebhookOutput `json:"webhookOutput"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DeliveryStatus        respjson.Field
		DestinationType       respjson.Field
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ReferenceID           respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		DeliveredContent      respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		GoogleDriveOutput     respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		S3Output              respjson.Field
		WebhookOutput         respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SendWebhookEvent) RawJSON added in v0.14.0

func (r SendWebhookEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*SendWebhookEvent) UnmarshalJSON added in v0.14.0

func (r *SendWebhookEvent) UnmarshalJSON(data []byte) error

type SendWebhookEventDeliveryStatus added in v0.14.0

type SendWebhookEventDeliveryStatus string

Outcome of a Send function's delivery attempt.

const (
	SendWebhookEventDeliveryStatusSuccess SendWebhookEventDeliveryStatus = "success"
	SendWebhookEventDeliveryStatusSkip    SendWebhookEventDeliveryStatus = "skip"
)

type SendWebhookEventEventType added in v0.14.0

type SendWebhookEventEventType string
const (
	SendWebhookEventEventTypeSend SendWebhookEventEventType = "send"
)

type SendWebhookEventGoogleDriveOutput added in v0.14.0

type SendWebhookEventGoogleDriveOutput struct {
	// Name of the file created in Google Drive.
	FileName string `json:"fileName" api:"required"`
	// ID of the Google Drive folder the file was placed in.
	FolderID string `json:"folderID" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FileName    respjson.Field
		FolderID    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Metadata returned when a Send function delivers to Google Drive.

func (SendWebhookEventGoogleDriveOutput) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*SendWebhookEventGoogleDriveOutput) UnmarshalJSON added in v0.14.0

func (r *SendWebhookEventGoogleDriveOutput) UnmarshalJSON(data []byte) error

type SendWebhookEventMetadata added in v0.14.0

type SendWebhookEventMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SendWebhookEventMetadata) RawJSON added in v0.14.0

func (r SendWebhookEventMetadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*SendWebhookEventMetadata) UnmarshalJSON added in v0.14.0

func (r *SendWebhookEventMetadata) UnmarshalJSON(data []byte) error

type SendWebhookEventS3Output added in v0.14.0

type SendWebhookEventS3Output struct {
	// Name of the S3 bucket the payload was written to.
	BucketName string `json:"bucketName" api:"required"`
	// Object key under which the payload was stored.
	Key string `json:"key" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BucketName  respjson.Field
		Key         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Metadata returned when a Send function delivers to an S3 bucket.

func (SendWebhookEventS3Output) RawJSON added in v0.14.0

func (r SendWebhookEventS3Output) RawJSON() string

Returns the unmodified JSON received from the API

func (*SendWebhookEventS3Output) UnmarshalJSON added in v0.14.0

func (r *SendWebhookEventS3Output) UnmarshalJSON(data []byte) error

type SendWebhookEventWebhookOutput added in v0.14.0

type SendWebhookEventWebhookOutput struct {
	// Raw HTTP response body returned by the webhook endpoint.
	HTTPResponseBody string `json:"httpResponseBody" api:"required"`
	// HTTP status code returned by the webhook endpoint.
	HTTPStatusCode int64 `json:"httpStatusCode" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		HTTPResponseBody respjson.Field
		HTTPStatusCode   respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Metadata returned when a Send function delivers to a webhook.

func (SendWebhookEventWebhookOutput) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*SendWebhookEventWebhookOutput) UnmarshalJSON added in v0.14.0

func (r *SendWebhookEventWebhookOutput) UnmarshalJSON(data []byte) error

type SplitCollectionWebhookEvent added in v0.14.0

type SplitCollectionWebhookEvent struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// Any of "print_page", "semantic_page".
	OutputType      SplitCollectionWebhookEventOutputType      `json:"outputType" api:"required"`
	PrintPageOutput SplitCollectionWebhookEventPrintPageOutput `json:"printPageOutput" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID        string                                        `json:"referenceID" api:"required"`
	SemanticPageOutput SplitCollectionWebhookEventSemanticPageOutput `json:"semanticPageOutput" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "split_collection".
	EventType SplitCollectionWebhookEventEventType `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail InboundEmailEvent                   `json:"inboundEmail"`
	Metadata     SplitCollectionWebhookEventMetadata `json:"metadata"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		OutputType            respjson.Field
		PrintPageOutput       respjson.Field
		ReferenceID           respjson.Field
		SemanticPageOutput    respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SplitCollectionWebhookEvent) RawJSON added in v0.14.0

func (r SplitCollectionWebhookEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*SplitCollectionWebhookEvent) UnmarshalJSON added in v0.14.0

func (r *SplitCollectionWebhookEvent) UnmarshalJSON(data []byte) error

type SplitCollectionWebhookEventEventType added in v0.14.0

type SplitCollectionWebhookEventEventType string
const (
	SplitCollectionWebhookEventEventTypeSplitCollection SplitCollectionWebhookEventEventType = "split_collection"
)

type SplitCollectionWebhookEventMetadata added in v0.14.0

type SplitCollectionWebhookEventMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SplitCollectionWebhookEventMetadata) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*SplitCollectionWebhookEventMetadata) UnmarshalJSON added in v0.14.0

func (r *SplitCollectionWebhookEventMetadata) UnmarshalJSON(data []byte) error

type SplitCollectionWebhookEventOutputType added in v0.14.0

type SplitCollectionWebhookEventOutputType string
const (
	SplitCollectionWebhookEventOutputTypePrintPage    SplitCollectionWebhookEventOutputType = "print_page"
	SplitCollectionWebhookEventOutputTypeSemanticPage SplitCollectionWebhookEventOutputType = "semantic_page"
)

type SplitCollectionWebhookEventPrintPageOutput added in v0.14.0

type SplitCollectionWebhookEventPrintPageOutput struct {
	ItemCount int64                                            `json:"itemCount"`
	Items     []SplitCollectionWebhookEventPrintPageOutputItem `json:"items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemCount   respjson.Field
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SplitCollectionWebhookEventPrintPageOutput) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*SplitCollectionWebhookEventPrintPageOutput) UnmarshalJSON added in v0.14.0

func (r *SplitCollectionWebhookEventPrintPageOutput) UnmarshalJSON(data []byte) error

type SplitCollectionWebhookEventPrintPageOutputItem added in v0.14.0

type SplitCollectionWebhookEventPrintPageOutputItem struct {
	ItemOffset      int64  `json:"itemOffset"`
	ItemReferenceID string `json:"itemReferenceID"`
	S3URL           string `json:"s3URL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemOffset      respjson.Field
		ItemReferenceID respjson.Field
		S3URL           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SplitCollectionWebhookEventPrintPageOutputItem) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*SplitCollectionWebhookEventPrintPageOutputItem) UnmarshalJSON added in v0.14.0

type SplitCollectionWebhookEventSemanticPageOutput added in v0.14.0

type SplitCollectionWebhookEventSemanticPageOutput struct {
	ItemCount int64                                               `json:"itemCount"`
	Items     []SplitCollectionWebhookEventSemanticPageOutputItem `json:"items"`
	PageCount int64                                               `json:"pageCount"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemCount   respjson.Field
		Items       respjson.Field
		PageCount   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SplitCollectionWebhookEventSemanticPageOutput) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*SplitCollectionWebhookEventSemanticPageOutput) UnmarshalJSON added in v0.14.0

func (r *SplitCollectionWebhookEventSemanticPageOutput) UnmarshalJSON(data []byte) error

type SplitCollectionWebhookEventSemanticPageOutputItem added in v0.14.0

type SplitCollectionWebhookEventSemanticPageOutputItem struct {
	ItemClass       string `json:"itemClass"`
	ItemClassCount  int64  `json:"itemClassCount"`
	ItemClassOffset int64  `json:"itemClassOffset"`
	ItemOffset      int64  `json:"itemOffset"`
	ItemReferenceID string `json:"itemReferenceID"`
	PageEnd         int64  `json:"pageEnd"`
	PageStart       int64  `json:"pageStart"`
	S3URL           string `json:"s3URL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemClass       respjson.Field
		ItemClassCount  respjson.Field
		ItemClassOffset respjson.Field
		ItemOffset      respjson.Field
		ItemReferenceID respjson.Field
		PageEnd         respjson.Field
		PageStart       respjson.Field
		S3URL           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SplitCollectionWebhookEventSemanticPageOutputItem) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*SplitCollectionWebhookEventSemanticPageOutputItem) UnmarshalJSON added in v0.14.0

type SplitFunctionSemanticPageItemClass

type SplitFunctionSemanticPageItemClass struct {
	Name        string `json:"name" api:"required"`
	Description string `json:"description"`
	// The unique ID of the function you want to use for this item class.
	NextFunctionID string `json:"nextFunctionID"`
	// The unique name of the function you want to use for this item class.
	NextFunctionName string `json:"nextFunctionName"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name             respjson.Field
		Description      respjson.Field
		NextFunctionID   respjson.Field
		NextFunctionName respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SplitFunctionSemanticPageItemClass) RawJSON

Returns the unmodified JSON received from the API

func (SplitFunctionSemanticPageItemClass) ToParam

ToParam converts this SplitFunctionSemanticPageItemClass to a SplitFunctionSemanticPageItemClassParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with SplitFunctionSemanticPageItemClassParam.Overrides()

func (*SplitFunctionSemanticPageItemClass) UnmarshalJSON

func (r *SplitFunctionSemanticPageItemClass) UnmarshalJSON(data []byte) error

type SplitFunctionSemanticPageItemClassParam

type SplitFunctionSemanticPageItemClassParam struct {
	Name        string            `json:"name" api:"required"`
	Description param.Opt[string] `json:"description,omitzero"`
	// The unique ID of the function you want to use for this item class.
	NextFunctionID param.Opt[string] `json:"nextFunctionID,omitzero"`
	// The unique name of the function you want to use for this item class.
	NextFunctionName param.Opt[string] `json:"nextFunctionName,omitzero"`
	// contains filtered or unexported fields
}

The property Name is required.

func (SplitFunctionSemanticPageItemClassParam) MarshalJSON

func (r SplitFunctionSemanticPageItemClassParam) MarshalJSON() (data []byte, err error)

func (*SplitFunctionSemanticPageItemClassParam) UnmarshalJSON

func (r *SplitFunctionSemanticPageItemClassParam) UnmarshalJSON(data []byte) error

type SplitItemWebhookEvent added in v0.14.0

type SplitItemWebhookEvent struct {
	// Unique ID generated by bem to identify the event.
	EventID string `json:"eventID" api:"required"`
	// Unique identifier of function that this event is associated with.
	FunctionID string `json:"functionID" api:"required"`
	// Unique name of function that this event is associated with.
	FunctionName string `json:"functionName" api:"required"`
	// Any of "print_page", "semantic_page".
	OutputType SplitItemWebhookEventOutputType `json:"outputType" api:"required"`
	// The unique ID you use internally to refer to this data point, propagated from
	// the original function input.
	ReferenceID string `json:"referenceID" api:"required"`
	// Unique identifier of workflow call that this event is associated with.
	CallID string `json:"callID"`
	// Timestamp indicating when the event was created.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// Any of "split_item".
	EventType SplitItemWebhookEventEventType `json:"eventType"`
	// Unique identifier of function call that this event is associated with.
	FunctionCallID string `json:"functionCallID"`
	// The attempt number of the function call that created this event. 1 indexed.
	FunctionCallTryNumber int64 `json:"functionCallTryNumber"`
	// Version number of function that this event is associated with.
	FunctionVersionNum int64 `json:"functionVersionNum"`
	// The inbound email that triggered this event.
	InboundEmail       InboundEmailEvent                       `json:"inboundEmail"`
	Metadata           SplitItemWebhookEventMetadata           `json:"metadata"`
	PrintPageOutput    SplitItemWebhookEventPrintPageOutput    `json:"printPageOutput"`
	SemanticPageOutput SplitItemWebhookEventSemanticPageOutput `json:"semanticPageOutput"`
	// Unique identifier of workflow that this event is associated with.
	WorkflowID string `json:"workflowID"`
	// Name of workflow that this event is associated with.
	WorkflowName string `json:"workflowName"`
	// Version number of workflow that this event is associated with.
	WorkflowVersionNum int64 `json:"workflowVersionNum"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		OutputType            respjson.Field
		ReferenceID           respjson.Field
		CallID                respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Metadata              respjson.Field
		PrintPageOutput       respjson.Field
		SemanticPageOutput    respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SplitItemWebhookEvent) RawJSON added in v0.14.0

func (r SplitItemWebhookEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*SplitItemWebhookEvent) UnmarshalJSON added in v0.14.0

func (r *SplitItemWebhookEvent) UnmarshalJSON(data []byte) error

type SplitItemWebhookEventEventType added in v0.14.0

type SplitItemWebhookEventEventType string
const (
	SplitItemWebhookEventEventTypeSplitItem SplitItemWebhookEventEventType = "split_item"
)

type SplitItemWebhookEventMetadata added in v0.14.0

type SplitItemWebhookEventMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DurationFunctionToEventSeconds respjson.Field
		ExtraFields                    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SplitItemWebhookEventMetadata) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*SplitItemWebhookEventMetadata) UnmarshalJSON added in v0.14.0

func (r *SplitItemWebhookEventMetadata) UnmarshalJSON(data []byte) error

type SplitItemWebhookEventOutputType added in v0.14.0

type SplitItemWebhookEventOutputType string
const (
	SplitItemWebhookEventOutputTypePrintPage    SplitItemWebhookEventOutputType = "print_page"
	SplitItemWebhookEventOutputTypeSemanticPage SplitItemWebhookEventOutputType = "semantic_page"
)

type SplitItemWebhookEventPrintPageOutput added in v0.14.0

type SplitItemWebhookEventPrintPageOutput struct {
	CollectionReferenceID string `json:"collectionReferenceID"`
	ItemCount             int64  `json:"itemCount"`
	ItemOffset            int64  `json:"itemOffset"`
	S3URL                 string `json:"s3URL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CollectionReferenceID respjson.Field
		ItemCount             respjson.Field
		ItemOffset            respjson.Field
		S3URL                 respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SplitItemWebhookEventPrintPageOutput) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*SplitItemWebhookEventPrintPageOutput) UnmarshalJSON added in v0.14.0

func (r *SplitItemWebhookEventPrintPageOutput) UnmarshalJSON(data []byte) error

type SplitItemWebhookEventSemanticPageOutput added in v0.14.0

type SplitItemWebhookEventSemanticPageOutput struct {
	CollectionReferenceID string `json:"collectionReferenceID"`
	ItemClass             string `json:"itemClass"`
	ItemClassCount        int64  `json:"itemClassCount"`
	ItemClassOffset       int64  `json:"itemClassOffset"`
	ItemCount             int64  `json:"itemCount"`
	ItemOffset            int64  `json:"itemOffset"`
	PageCount             int64  `json:"pageCount"`
	PageEnd               int64  `json:"pageEnd"`
	PageStart             int64  `json:"pageStart"`
	S3URL                 string `json:"s3URL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CollectionReferenceID respjson.Field
		ItemClass             respjson.Field
		ItemClassCount        respjson.Field
		ItemClassOffset       respjson.Field
		ItemCount             respjson.Field
		ItemOffset            respjson.Field
		PageCount             respjson.Field
		PageEnd               respjson.Field
		PageStart             respjson.Field
		S3URL                 respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SplitItemWebhookEventSemanticPageOutput) RawJSON added in v0.14.0

Returns the unmodified JSON received from the API

func (*SplitItemWebhookEventSemanticPageOutput) UnmarshalJSON added in v0.14.0

func (r *SplitItemWebhookEventSemanticPageOutput) UnmarshalJSON(data []byte) error

type SubscriptionListParams added in v0.14.0

type SubscriptionListParams struct {
	// A cursor to use in pagination. `endingBefore` is a task ID that defines your
	// place in the list. For example, if you make a list request and receive 50
	// objects, starting with `sub_2c9AXIj48cUYJtCuv1gsQtHGDzK`, your subsequent call
	// can include `endingBefore=sub_2c9AXIj48cUYJtCuv1gsQtHGDzK` to fetch the previous
	// page of the list.
	EndingBefore param.Opt[string] `query:"endingBefore,omitzero" json:"-"`
	// This specifies a limit on the number of objects to return, ranging between 1
	// and 100.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// A cursor to use in pagination. `startingAfter` is a task ID that defines your
	// place in the list. For example, if you make a list request and receive 50
	// objects, ending with `sub_2c9AXIj48cUYJtCuv1gsQtHGDzK`, your subsequent call can
	// include `startingAfter=sub_2c9AXIj48cUYJtCuv1gsQtHGDzK` to fetch the next page
	// of the list.
	StartingAfter param.Opt[string] `query:"startingAfter,omitzero" json:"-"`
	// Filters to subscriptions linked to included array of function names.
	FunctionNames []string `query:"functionNames,omitzero" json:"-"`
	// Specifies sorting behavior. The two options are `asc` and `desc` to sort
	// ascending and descending respectively, with default sort being ascending. Paging
	// works in both directions.
	//
	// Any of "asc", "desc".
	SortOrder SubscriptionListParamsSortOrder `query:"sortOrder,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SubscriptionListParams) URLQuery added in v0.14.0

func (r SubscriptionListParams) URLQuery() (v url.Values, err error)

URLQuery serializes SubscriptionListParams's query parameters as `url.Values`.

type SubscriptionListParamsSortOrder added in v0.14.0

type SubscriptionListParamsSortOrder string

Specifies sorting behavior. The two options are `asc` and `desc` to sort ascending and descending respectively, with default sort being ascending. Paging works in both directions.

const (
	SubscriptionListParamsSortOrderAsc  SubscriptionListParamsSortOrder = "asc"
	SubscriptionListParamsSortOrderDesc SubscriptionListParamsSortOrder = "desc"
)

type SubscriptionNewParams added in v0.14.0

type SubscriptionNewParams struct {
	// Name of subscription.
	Name string `json:"name" api:"required"`
	// Type of subscription.
	//
	// Any of "transform", "analyze", "route", "join", "split_collection",
	// "split_item", "evaluation", "error", "payload_shaping", "enrich",
	// "collection_processing".
	Type SubscriptionNewParamsType `json:"type,omitzero" api:"required"`
	// Unique identifier of collection this subscription listens to (alternative to
	// collectionName).
	CollectionID param.Opt[string] `json:"collectionID,omitzero"`
	// Name of collection this subscription listens to (required for collection-based
	// subscriptions).
	CollectionName param.Opt[string] `json:"collectionName,omitzero"`
	// Toggles whether subscription is active or not.
	Disabled param.Opt[bool] `json:"disabled,omitzero"`
	// Unique identifier of function this subscription listens to (alternative to
	// functionName).
	FunctionID param.Opt[string] `json:"functionID,omitzero"`
	// Unique name of function this subscription listens to (required for
	// function-based subscriptions).
	FunctionName param.Opt[string] `json:"functionName,omitzero"`
	// Google Drive folder ID for syncing output data to Google Drive.
	GoogleDriveFolderID param.Opt[string] `json:"googleDriveFolderID,omitzero"`
	// S3 bucket name for syncing output data to AWS S3.
	S3Bucket param.Opt[string] `json:"s3Bucket,omitzero"`
	// S3 file path for syncing output data to AWS S3.
	S3FilePath param.Opt[string] `json:"s3FilePath,omitzero"`
	// URL bem will send webhook requests to.
	WebhookURL param.Opt[string] `json:"webhookURL,omitzero"`
	// contains filtered or unexported fields
}

func (SubscriptionNewParams) MarshalJSON added in v0.14.0

func (r SubscriptionNewParams) MarshalJSON() (data []byte, err error)

func (*SubscriptionNewParams) UnmarshalJSON added in v0.14.0

func (r *SubscriptionNewParams) UnmarshalJSON(data []byte) error

type SubscriptionNewParamsType added in v0.14.0

type SubscriptionNewParamsType string

Type of subscription.

const (
	SubscriptionNewParamsTypeTransform            SubscriptionNewParamsType = "transform"
	SubscriptionNewParamsTypeAnalyze              SubscriptionNewParamsType = "analyze"
	SubscriptionNewParamsTypeRoute                SubscriptionNewParamsType = "route"
	SubscriptionNewParamsTypeJoin                 SubscriptionNewParamsType = "join"
	SubscriptionNewParamsTypeSplitCollection      SubscriptionNewParamsType = "split_collection"
	SubscriptionNewParamsTypeSplitItem            SubscriptionNewParamsType = "split_item"
	SubscriptionNewParamsTypeEvaluation           SubscriptionNewParamsType = "evaluation"
	SubscriptionNewParamsTypeError                SubscriptionNewParamsType = "error"
	SubscriptionNewParamsTypePayloadShaping       SubscriptionNewParamsType = "payload_shaping"
	SubscriptionNewParamsTypeEnrich               SubscriptionNewParamsType = "enrich"
	SubscriptionNewParamsTypeCollectionProcessing SubscriptionNewParamsType = "collection_processing"
)

type SubscriptionService added in v0.14.0

type SubscriptionService struct {
	// contains filtered or unexported fields
}

Subscriptions wire up notifications for the events your functions and collections produce.

Most subscriptions target a single function (by `functionName` or `functionID`) or a single collection (by `collectionName` or `collectionID`) and select a `type` corresponding to the event you want to receive — for example `transform`, `route`, `join`, `evaluation`, `error`, `enrich`, or `collection_processing`.

Entity-lifecycle events are account-wide and target no function or collection. Set `type` to one of the following and provide a `webhookURL` (these event types support webhook delivery only):

  • `entity_proposed` — an entity entered the `proposed` curation status (queued for review).
  • `entity_validated` — an entity was approved/validated by a reviewer.
  • `entity_rejected` — an entity was rejected by a reviewer.

Each entity-lifecycle delivery is a JSON POST describing the transition (`entityID`, `typeName`, `priorStatus`, `newStatus`, optional `actorUserID` and `reason`, and a `timestamp`).

Deliveries can be sent to any combination of:

- `webhookURL` — HTTPS endpoint that receives a JSON POST per event. - `s3Bucket` + `s3FilePath` — sync output JSON into an AWS S3 prefix you own. - `googleDriveFolderID` — drop output JSON into a Google Drive folder.

Use `disabled: true` to pause delivery without deleting the subscription. Updates follow conventional PATCH semantics — only the fields you include are changed.

SubscriptionService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSubscriptionService method instead.

func NewSubscriptionService added in v0.14.0

func NewSubscriptionService(opts ...option.RequestOption) (r SubscriptionService)

NewSubscriptionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SubscriptionService) Delete added in v0.14.0

func (r *SubscriptionService) Delete(ctx context.Context, subscriptionID string, opts ...option.RequestOption) (err error)

Deletes an existing subscription.

func (*SubscriptionService) Get added in v0.14.0

func (r *SubscriptionService) Get(ctx context.Context, subscriptionID string, opts ...option.RequestOption) (res *SubscriptionV3, err error)

Get a Subscription

func (*SubscriptionService) List added in v0.14.0

List Subscriptions

func (*SubscriptionService) New added in v0.14.0

Creates a new subscription to listen to transform or error events.

func (*SubscriptionService) Update added in v0.14.0

func (r *SubscriptionService) Update(ctx context.Context, subscriptionID string, body SubscriptionUpdateParams, opts ...option.RequestOption) (res *SubscriptionV3, err error)

Updates an existing subscription. Follow conventional PATCH behavior, so only included fields will be updated.

type SubscriptionUpdateParams added in v0.14.0

type SubscriptionUpdateParams struct {
	// Toggles whether subscription is active or not.
	Disabled param.Opt[bool] `json:"disabled,omitzero"`
	// Unique name of function this subscription listens to.
	FunctionName param.Opt[string] `json:"functionName,omitzero"`
	// Google Drive folder ID for syncing output data to Google Drive.
	GoogleDriveFolderID param.Opt[string] `json:"googleDriveFolderID,omitzero"`
	// Name of subscription.
	Name param.Opt[string] `json:"name,omitzero"`
	// S3 bucket name for syncing output data to AWS S3.
	S3Bucket param.Opt[string] `json:"s3Bucket,omitzero"`
	// S3 file path for syncing output data to AWS S3.
	S3FilePath param.Opt[string] `json:"s3FilePath,omitzero"`
	// URL bem will send webhook requests to.
	WebhookURL param.Opt[string] `json:"webhookURL,omitzero"`
	// Type of subscription.
	//
	// Any of "transform", "analyze", "route", "join", "split_collection",
	// "split_item", "evaluation", "error", "payload_shaping", "enrich",
	// "collection_processing".
	Type SubscriptionUpdateParamsType `json:"type,omitzero"`
	// contains filtered or unexported fields
}

func (SubscriptionUpdateParams) MarshalJSON added in v0.14.0

func (r SubscriptionUpdateParams) MarshalJSON() (data []byte, err error)

func (*SubscriptionUpdateParams) UnmarshalJSON added in v0.14.0

func (r *SubscriptionUpdateParams) UnmarshalJSON(data []byte) error

type SubscriptionUpdateParamsType added in v0.14.0

type SubscriptionUpdateParamsType string

Type of subscription.

const (
	SubscriptionUpdateParamsTypeTransform            SubscriptionUpdateParamsType = "transform"
	SubscriptionUpdateParamsTypeAnalyze              SubscriptionUpdateParamsType = "analyze"
	SubscriptionUpdateParamsTypeRoute                SubscriptionUpdateParamsType = "route"
	SubscriptionUpdateParamsTypeJoin                 SubscriptionUpdateParamsType = "join"
	SubscriptionUpdateParamsTypeSplitCollection      SubscriptionUpdateParamsType = "split_collection"
	SubscriptionUpdateParamsTypeSplitItem            SubscriptionUpdateParamsType = "split_item"
	SubscriptionUpdateParamsTypeEvaluation           SubscriptionUpdateParamsType = "evaluation"
	SubscriptionUpdateParamsTypeError                SubscriptionUpdateParamsType = "error"
	SubscriptionUpdateParamsTypePayloadShaping       SubscriptionUpdateParamsType = "payload_shaping"
	SubscriptionUpdateParamsTypeEnrich               SubscriptionUpdateParamsType = "enrich"
	SubscriptionUpdateParamsTypeCollectionProcessing SubscriptionUpdateParamsType = "collection_processing"
)

type SubscriptionV3 added in v0.14.0

type SubscriptionV3 struct {
	// Name of subscription.
	Name string `json:"name" api:"required"`
	// The unique identifier of the subscription.
	SubscriptionID string `json:"subscriptionID" api:"required"`
	// Type of subscription.
	//
	// Any of "transform", "analyze", "route", "join", "split_collection",
	// "split_item", "evaluation", "error", "payload_shaping", "enrich",
	// "collection_processing".
	Type SubscriptionV3Type `json:"type" api:"required"`
	// Unique identifier of collection this subscription listens to.
	CollectionID string `json:"collectionID"`
	// Name of collection this subscription listens to.
	CollectionName string `json:"collectionName"`
	// Toggles whether subscription is active or not.
	Disabled bool `json:"disabled"`
	// Unique identifier of function this subscription listens to.
	FunctionID string `json:"functionID"`
	// Unique name of function this subscription listens to.
	FunctionName string `json:"functionName"`
	// Google Drive folder ID for syncing output data to Google Drive.
	GoogleDriveFolderID string `json:"googleDriveFolderID"`
	// S3 bucket name for syncing output data to AWS S3.
	S3Bucket string `json:"s3Bucket"`
	// S3 file path for syncing output data to AWS S3.
	S3FilePath string `json:"s3FilePath"`
	// URL bem will send webhook requests to.
	WebhookURL string `json:"webhookURL"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name                respjson.Field
		SubscriptionID      respjson.Field
		Type                respjson.Field
		CollectionID        respjson.Field
		CollectionName      respjson.Field
		Disabled            respjson.Field
		FunctionID          respjson.Field
		FunctionName        respjson.Field
		GoogleDriveFolderID respjson.Field
		S3Bucket            respjson.Field
		S3FilePath          respjson.Field
		WebhookURL          respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SubscriptionV3) RawJSON added in v0.14.0

func (r SubscriptionV3) RawJSON() string

Returns the unmodified JSON received from the API

func (*SubscriptionV3) UnmarshalJSON added in v0.14.0

func (r *SubscriptionV3) UnmarshalJSON(data []byte) error

type SubscriptionV3Type added in v0.14.0

type SubscriptionV3Type string

Type of subscription.

const (
	SubscriptionV3TypeTransform            SubscriptionV3Type = "transform"
	SubscriptionV3TypeAnalyze              SubscriptionV3Type = "analyze"
	SubscriptionV3TypeRoute                SubscriptionV3Type = "route"
	SubscriptionV3TypeJoin                 SubscriptionV3Type = "join"
	SubscriptionV3TypeSplitCollection      SubscriptionV3Type = "split_collection"
	SubscriptionV3TypeSplitItem            SubscriptionV3Type = "split_item"
	SubscriptionV3TypeEvaluation           SubscriptionV3Type = "evaluation"
	SubscriptionV3TypeError                SubscriptionV3Type = "error"
	SubscriptionV3TypePayloadShaping       SubscriptionV3Type = "payload_shaping"
	SubscriptionV3TypeEnrich               SubscriptionV3Type = "enrich"
	SubscriptionV3TypeCollectionProcessing SubscriptionV3Type = "collection_processing"
)

type UnwrapWebhookEventUnion added in v0.14.0

type UnwrapWebhookEventUnion struct {
	EventID            string  `json:"eventID"`
	FunctionID         string  `json:"functionID"`
	FunctionName       string  `json:"functionName"`
	ItemCount          int64   `json:"itemCount"`
	ItemOffset         int64   `json:"itemOffset"`
	ReferenceID        string  `json:"referenceID"`
	TransformedContent any     `json:"transformedContent"`
	AvgConfidence      float64 `json:"avgConfidence"`
	CallID             string  `json:"callID"`
	// This field is a union of [ExtractWebhookEventCorrectedContentUnion],
	// [ParseWebhookEventCorrectedContentUnion]
	CorrectedContent UnwrapWebhookEventUnionCorrectedContent `json:"correctedContent"`
	CreatedAt        time.Time                               `json:"createdAt"`
	// Any of "extract", "classify", "parse", "split_collection", "split_item", "join",
	// "enrich", "payload_shaping", "send", "evaluation", "collection_processing",
	// "error".
	EventType             string `json:"eventType"`
	FieldBoundingBoxes    any    `json:"fieldBoundingBoxes"`
	FieldConfidences      any    `json:"fieldConfidences"`
	FunctionCallID        string `json:"functionCallID"`
	FunctionCallTryNumber int64  `json:"functionCallTryNumber"`
	FunctionVersionNum    int64  `json:"functionVersionNum"`
	// This field is from variant [ExtractWebhookEvent].
	InboundEmail InboundEmailEvent `json:"inboundEmail"`
	// This field is a union of [[]ExtractWebhookEventInput],
	// [[]ParseWebhookEventInput]
	Inputs UnwrapWebhookEventUnionInputs `json:"inputs"`
	// This field is from variant [ExtractWebhookEvent].
	InputType         InputType `json:"inputType"`
	InvalidProperties []string  `json:"invalidProperties"`
	// This field is a union of [ExtractWebhookEventMetadata],
	// [ClassifyWebhookEventMetadata], [ParseWebhookEventMetadata],
	// [SplitCollectionWebhookEventMetadata], [SplitItemWebhookEventMetadata],
	// [JoinWebhookEventMetadata], [EnrichWebhookEventMetadata],
	// [PayloadShapingWebhookEventMetadata], [SendWebhookEventMetadata],
	// [EvaluationWebhookEventMetadata], [CollectionProcessingWebhookEventMetadata],
	// [ErrorEventMetadata]
	Metadata           UnwrapWebhookEventUnionMetadata `json:"metadata"`
	S3URL              string                          `json:"s3URL"`
	TransformationID   string                          `json:"transformationID"`
	WorkflowID         string                          `json:"workflowID"`
	WorkflowName       string                          `json:"workflowName"`
	WorkflowVersionNum int64                           `json:"workflowVersionNum"`
	// This field is from variant [ClassifyWebhookEvent].
	Choice     string `json:"choice"`
	OutputType string `json:"outputType"`
	// This field is a union of [SplitCollectionWebhookEventPrintPageOutput],
	// [SplitItemWebhookEventPrintPageOutput]
	PrintPageOutput UnwrapWebhookEventUnionPrintPageOutput `json:"printPageOutput"`
	// This field is a union of [SplitCollectionWebhookEventSemanticPageOutput],
	// [SplitItemWebhookEventSemanticPageOutput]
	SemanticPageOutput UnwrapWebhookEventUnionSemanticPageOutput `json:"semanticPageOutput"`
	// This field is from variant [JoinWebhookEvent].
	Items []JoinWebhookEventItem `json:"items"`
	// This field is from variant [JoinWebhookEvent].
	JoinType JoinWebhookEventJoinType `json:"joinType"`
	// This field is from variant [EnrichWebhookEvent].
	EnrichedContent any `json:"enrichedContent"`
	// This field is from variant [SendWebhookEvent].
	DeliveryStatus SendWebhookEventDeliveryStatus `json:"deliveryStatus"`
	// This field is from variant [SendWebhookEvent].
	DestinationType SendDestinationType `json:"destinationType"`
	// This field is from variant [SendWebhookEvent].
	DeliveredContent any `json:"deliveredContent"`
	// This field is from variant [SendWebhookEvent].
	GoogleDriveOutput SendWebhookEventGoogleDriveOutput `json:"googleDriveOutput"`
	// This field is from variant [SendWebhookEvent].
	S3Output SendWebhookEventS3Output `json:"s3Output"`
	// This field is from variant [SendWebhookEvent].
	WebhookOutput SendWebhookEventWebhookOutput `json:"webhookOutput"`
	// This field is from variant [EvaluationWebhookEvent].
	EvaluationVersion string `json:"evaluationVersion"`
	// This field is from variant [EvaluationWebhookEvent].
	Result any    `json:"result"`
	Status string `json:"status"`
	// This field is from variant [EvaluationWebhookEvent].
	TransformID  string `json:"transformId"`
	ErrorMessage string `json:"errorMessage"`
	// This field is from variant [CollectionProcessingWebhookEvent].
	CollectionID string `json:"collectionID"`
	// This field is from variant [CollectionProcessingWebhookEvent].
	CollectionName string `json:"collectionName"`
	// This field is from variant [CollectionProcessingWebhookEvent].
	Operation CollectionProcessingWebhookEventOperation `json:"operation"`
	// This field is from variant [CollectionProcessingWebhookEvent].
	ProcessedCount int64 `json:"processedCount"`
	// This field is from variant [CollectionProcessingWebhookEvent].
	CollectionItemIDs []string `json:"collectionItemIDs"`
	// This field is from variant [ErrorEvent].
	Message string `json:"message"`
	JSON    struct {
		EventID               respjson.Field
		FunctionID            respjson.Field
		FunctionName          respjson.Field
		ItemCount             respjson.Field
		ItemOffset            respjson.Field
		ReferenceID           respjson.Field
		TransformedContent    respjson.Field
		AvgConfidence         respjson.Field
		CallID                respjson.Field
		CorrectedContent      respjson.Field
		CreatedAt             respjson.Field
		EventType             respjson.Field
		FieldBoundingBoxes    respjson.Field
		FieldConfidences      respjson.Field
		FunctionCallID        respjson.Field
		FunctionCallTryNumber respjson.Field
		FunctionVersionNum    respjson.Field
		InboundEmail          respjson.Field
		Inputs                respjson.Field
		InputType             respjson.Field
		InvalidProperties     respjson.Field
		Metadata              respjson.Field
		S3URL                 respjson.Field
		TransformationID      respjson.Field
		WorkflowID            respjson.Field
		WorkflowName          respjson.Field
		WorkflowVersionNum    respjson.Field
		Choice                respjson.Field
		OutputType            respjson.Field
		PrintPageOutput       respjson.Field
		SemanticPageOutput    respjson.Field
		Items                 respjson.Field
		JoinType              respjson.Field
		EnrichedContent       respjson.Field
		DeliveryStatus        respjson.Field
		DestinationType       respjson.Field
		DeliveredContent      respjson.Field
		GoogleDriveOutput     respjson.Field
		S3Output              respjson.Field
		WebhookOutput         respjson.Field
		EvaluationVersion     respjson.Field
		Result                respjson.Field
		Status                respjson.Field
		TransformID           respjson.Field
		ErrorMessage          respjson.Field
		CollectionID          respjson.Field
		CollectionName        respjson.Field
		Operation             respjson.Field
		ProcessedCount        respjson.Field
		CollectionItemIDs     respjson.Field
		Message               respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnion contains all possible properties and values from ExtractWebhookEvent, ClassifyWebhookEvent, ParseWebhookEvent, SplitCollectionWebhookEvent, SplitItemWebhookEvent, JoinWebhookEvent, EnrichWebhookEvent, PayloadShapingWebhookEvent, SendWebhookEvent, EvaluationWebhookEvent, CollectionProcessingWebhookEvent, ErrorEvent.

Use the UnwrapWebhookEventUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (UnwrapWebhookEventUnion) AsAny added in v0.14.0

func (u UnwrapWebhookEventUnion) AsAny() anyUnwrapWebhookEvent

Use the following switch statement to find the correct variant

switch variant := UnwrapWebhookEventUnion.AsAny().(type) {
case bem.ExtractWebhookEvent:
case bem.ClassifyWebhookEvent:
case bem.ParseWebhookEvent:
case bem.SplitCollectionWebhookEvent:
case bem.SplitItemWebhookEvent:
case bem.JoinWebhookEvent:
case bem.EnrichWebhookEvent:
case bem.PayloadShapingWebhookEvent:
case bem.SendWebhookEvent:
case bem.EvaluationWebhookEvent:
case bem.CollectionProcessingWebhookEvent:
case bem.ErrorEvent:
default:
  fmt.Errorf("no variant present")
}

func (UnwrapWebhookEventUnion) AsClassify added in v0.14.0

func (u UnwrapWebhookEventUnion) AsClassify() (v ClassifyWebhookEvent)

func (UnwrapWebhookEventUnion) AsCollectionProcessing added in v0.14.0

func (u UnwrapWebhookEventUnion) AsCollectionProcessing() (v CollectionProcessingWebhookEvent)

func (UnwrapWebhookEventUnion) AsEnrich added in v0.14.0

func (UnwrapWebhookEventUnion) AsError added in v0.14.0

func (u UnwrapWebhookEventUnion) AsError() (v ErrorEvent)

func (UnwrapWebhookEventUnion) AsEvaluation added in v0.14.0

func (u UnwrapWebhookEventUnion) AsEvaluation() (v EvaluationWebhookEvent)

func (UnwrapWebhookEventUnion) AsExtract added in v0.14.0

func (u UnwrapWebhookEventUnion) AsExtract() (v ExtractWebhookEvent)

func (UnwrapWebhookEventUnion) AsJoin added in v0.14.0

func (UnwrapWebhookEventUnion) AsParse added in v0.14.0

func (UnwrapWebhookEventUnion) AsPayloadShaping added in v0.14.0

func (u UnwrapWebhookEventUnion) AsPayloadShaping() (v PayloadShapingWebhookEvent)

func (UnwrapWebhookEventUnion) AsSend added in v0.14.0

func (UnwrapWebhookEventUnion) AsSplitCollection added in v0.14.0

func (u UnwrapWebhookEventUnion) AsSplitCollection() (v SplitCollectionWebhookEvent)

func (UnwrapWebhookEventUnion) AsSplitItem added in v0.14.0

func (u UnwrapWebhookEventUnion) AsSplitItem() (v SplitItemWebhookEvent)

func (UnwrapWebhookEventUnion) RawJSON added in v0.14.0

func (u UnwrapWebhookEventUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*UnwrapWebhookEventUnion) UnmarshalJSON added in v0.14.0

func (r *UnwrapWebhookEventUnion) UnmarshalJSON(data []byte) error

type UnwrapWebhookEventUnionCorrectedContent added in v0.14.0

type UnwrapWebhookEventUnionCorrectedContent struct {
	// This field will be present if the value is a [[]any] instead of an object.
	OfAnyArray []any `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool           `json:",inline"`
	Output []AnyTypeUnion `json:"output"`
	JSON   struct {
		OfAnyArray respjson.Field
		OfString   respjson.Field
		OfFloat    respjson.Field
		OfBool     respjson.Field
		Output     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnionCorrectedContent is an implicit subunion of UnwrapWebhookEventUnion. UnwrapWebhookEventUnionCorrectedContent provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnwrapWebhookEventUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfAnyArray OfString OfFloat OfBool]

func (*UnwrapWebhookEventUnionCorrectedContent) UnmarshalJSON added in v0.14.0

func (r *UnwrapWebhookEventUnionCorrectedContent) UnmarshalJSON(data []byte) error

type UnwrapWebhookEventUnionInputs added in v0.14.0

type UnwrapWebhookEventUnionInputs struct {
	// This field will be present if the value is a [[]ExtractWebhookEventInput]
	// instead of an object.
	OfExtractWebhookEventInputs []ExtractWebhookEventInput `json:",inline"`
	// This field will be present if the value is a [[]ParseWebhookEventInput] instead
	// of an object.
	OfParseWebhookEventInputs []ParseWebhookEventInput `json:",inline"`
	JSON                      struct {
		OfExtractWebhookEventInputs respjson.Field
		OfParseWebhookEventInputs   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnionInputs is an implicit subunion of UnwrapWebhookEventUnion. UnwrapWebhookEventUnionInputs provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnwrapWebhookEventUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfExtractWebhookEventInputs OfParseWebhookEventInputs]

func (*UnwrapWebhookEventUnionInputs) UnmarshalJSON added in v0.14.0

func (r *UnwrapWebhookEventUnionInputs) UnmarshalJSON(data []byte) error

type UnwrapWebhookEventUnionMetadata added in v0.14.0

type UnwrapWebhookEventUnionMetadata struct {
	DurationFunctionToEventSeconds float64 `json:"durationFunctionToEventSeconds"`
	JSON                           struct {
		DurationFunctionToEventSeconds respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnionMetadata is an implicit subunion of UnwrapWebhookEventUnion. UnwrapWebhookEventUnionMetadata provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnwrapWebhookEventUnion.

func (*UnwrapWebhookEventUnionMetadata) UnmarshalJSON added in v0.14.0

func (r *UnwrapWebhookEventUnionMetadata) UnmarshalJSON(data []byte) error

type UnwrapWebhookEventUnionPrintPageOutput added in v0.14.0

type UnwrapWebhookEventUnionPrintPageOutput struct {
	ItemCount int64 `json:"itemCount"`
	// This field is from variant [SplitCollectionWebhookEventPrintPageOutput].
	Items []SplitCollectionWebhookEventPrintPageOutputItem `json:"items"`
	// This field is from variant [SplitItemWebhookEventPrintPageOutput].
	CollectionReferenceID string `json:"collectionReferenceID"`
	// This field is from variant [SplitItemWebhookEventPrintPageOutput].
	ItemOffset int64 `json:"itemOffset"`
	// This field is from variant [SplitItemWebhookEventPrintPageOutput].
	S3URL string `json:"s3URL"`
	JSON  struct {
		ItemCount             respjson.Field
		Items                 respjson.Field
		CollectionReferenceID respjson.Field
		ItemOffset            respjson.Field
		S3URL                 respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnionPrintPageOutput is an implicit subunion of UnwrapWebhookEventUnion. UnwrapWebhookEventUnionPrintPageOutput provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnwrapWebhookEventUnion.

func (*UnwrapWebhookEventUnionPrintPageOutput) UnmarshalJSON added in v0.14.0

func (r *UnwrapWebhookEventUnionPrintPageOutput) UnmarshalJSON(data []byte) error

type UnwrapWebhookEventUnionSemanticPageOutput added in v0.14.0

type UnwrapWebhookEventUnionSemanticPageOutput struct {
	ItemCount int64 `json:"itemCount"`
	// This field is from variant [SplitCollectionWebhookEventSemanticPageOutput].
	Items     []SplitCollectionWebhookEventSemanticPageOutputItem `json:"items"`
	PageCount int64                                               `json:"pageCount"`
	// This field is from variant [SplitItemWebhookEventSemanticPageOutput].
	CollectionReferenceID string `json:"collectionReferenceID"`
	// This field is from variant [SplitItemWebhookEventSemanticPageOutput].
	ItemClass string `json:"itemClass"`
	// This field is from variant [SplitItemWebhookEventSemanticPageOutput].
	ItemClassCount int64 `json:"itemClassCount"`
	// This field is from variant [SplitItemWebhookEventSemanticPageOutput].
	ItemClassOffset int64 `json:"itemClassOffset"`
	// This field is from variant [SplitItemWebhookEventSemanticPageOutput].
	ItemOffset int64 `json:"itemOffset"`
	// This field is from variant [SplitItemWebhookEventSemanticPageOutput].
	PageEnd int64 `json:"pageEnd"`
	// This field is from variant [SplitItemWebhookEventSemanticPageOutput].
	PageStart int64 `json:"pageStart"`
	// This field is from variant [SplitItemWebhookEventSemanticPageOutput].
	S3URL string `json:"s3URL"`
	JSON  struct {
		ItemCount             respjson.Field
		Items                 respjson.Field
		PageCount             respjson.Field
		CollectionReferenceID respjson.Field
		ItemClass             respjson.Field
		ItemClassCount        respjson.Field
		ItemClassOffset       respjson.Field
		ItemOffset            respjson.Field
		PageEnd               respjson.Field
		PageStart             respjson.Field
		S3URL                 respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnionSemanticPageOutput is an implicit subunion of UnwrapWebhookEventUnion. UnwrapWebhookEventUnionSemanticPageOutput provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnwrapWebhookEventUnion.

func (*UnwrapWebhookEventUnionSemanticPageOutput) UnmarshalJSON added in v0.14.0

func (r *UnwrapWebhookEventUnionSemanticPageOutput) UnmarshalJSON(data []byte) error

type UpdateFunctionClassifyParam added in v0.7.0

type UpdateFunctionClassifyParam struct {
	// Description of classifier. Can be used to provide additional context on
	// classifier's purpose and expected inputs.
	Description param.Opt[string] `json:"description,omitzero"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName param.Opt[string] `json:"functionName,omitzero"`
	// List of classifications a classify function can produce. Shares the underlying
	// route list shape.
	Classifications []ClassificationListItemParam `json:"classifications,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "classify".
	Type constant.Classify `json:"type" default:"classify"`
	// contains filtered or unexported fields
}

V3 create/update variants of the shared function payloads.

The V3 Functions API no longer accepts the legacy `transform` or `analyze` function types when creating new functions or updating existing ones — both have been unified under `extract`. Existing functions of those types remain readable and callable via V3, so the V3 read-side unions still include `transform` and `analyze` variants.

The V3 API also exposes `classify` in place of the legacy `route` type on create/update, with `classifications` in place of `routes`. Read-side `ClassifyFunction` / `ClassifyFunctionVersion` / `ClassificationList` are defined in the shared functions models and used by both the V2 and V3 response unions (existing classify functions are returned from V2 GET endpoints verbatim).V3 wire form of the classify function upsert payload.

The property Type is required.

func (UpdateFunctionClassifyParam) MarshalJSON added in v0.7.0

func (r UpdateFunctionClassifyParam) MarshalJSON() (data []byte, err error)

func (*UpdateFunctionClassifyParam) UnmarshalJSON added in v0.7.0

func (r *UpdateFunctionClassifyParam) UnmarshalJSON(data []byte) error

type UpdateFunctionEnrichParam

type UpdateFunctionEnrichParam struct {
	// Configuration for an enrich function.
	//
	// **How Enrich Functions Work:**
	//
	// Enrich functions augment JSON input with data from external sources. They take
	// JSON input (typically from a previous function), extract specified fields, fetch
	// or search for matching data, and inject the results back into the JSON.
	//
	// **Data Sources:**
	//
	//   - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
	//     collection. Best for semantic matching against pre-indexed documents.
	//   - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
	//     Best for looking up live data from CRMs, ERPs, or other external systems.
	//     Optionally uses LLM agent reasoning to rank candidates returned by the
	//     endpoint.
	//
	// **Input Requirements:**
	//
	// - Must receive JSON input (typically from a previous function's output)
	//
	// **Example Use Cases:**
	//
	//   - Match product descriptions to SKU codes from a product catalog collection
	//   - Enrich customer data with account details from a CRM endpoint
	//   - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
	//     products
	//
	// **Configuration:**
	//
	// - Define named endpoints (for endpoint-source steps)
	// - Define one or more enrichment steps; steps are executed sequentially
	Config EnrichConfigParam `json:"config,omitzero"`
	// This field can be elided, and will marshal its zero value as "enrich".
	Type constant.Enrich `json:"type" default:"enrich"`
	// contains filtered or unexported fields
}

The property Type is required.

func (UpdateFunctionEnrichParam) MarshalJSON

func (r UpdateFunctionEnrichParam) MarshalJSON() (data []byte, err error)

func (*UpdateFunctionEnrichParam) UnmarshalJSON

func (r *UpdateFunctionEnrichParam) UnmarshalJSON(data []byte) error

type UpdateFunctionExtractParam added in v0.2.0

type UpdateFunctionExtractParam struct {
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// Whether bounding box extraction is enabled. Applies to vision input types (pdf,
	// png, jpeg, heic, heif, webp) that dispatch through the analyze path. When true,
	// the function returns the document regions (page, coordinates) from which each
	// field was extracted. Enabling this automatically configures the function to use
	// the bounding box model. Disabling resets to the default.
	EnableBoundingBoxes param.Opt[bool] `json:"enableBoundingBoxes,omitzero"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName param.Opt[string] `json:"functionName,omitzero"`
	// Name of output schema object.
	OutputSchemaName param.Opt[string] `json:"outputSchemaName,omitzero"`
	// Reducing the risk of the model stopping early on long documents. Trade-off:
	// Increases total latency. Compatible with `enableBoundingBoxes`.
	PreCount param.Opt[bool] `json:"preCount,omitzero"`
	// Whether tabular chunking is enabled. When true, tables in CSV/Excel files are
	// processed in row batches rather than all at once.
	TabularChunkingEnabled param.Opt[bool] `json:"tabularChunkingEnabled,omitzero"`
	// Desired output structure defined in standard JSON Schema convention.
	OutputSchema any `json:"outputSchema,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "extract".
	Type constant.Extract `json:"type" default:"extract"`
	// contains filtered or unexported fields
}

The property Type is required.

func (UpdateFunctionExtractParam) MarshalJSON added in v0.2.0

func (r UpdateFunctionExtractParam) MarshalJSON() (data []byte, err error)

func (*UpdateFunctionExtractParam) UnmarshalJSON added in v0.2.0

func (r *UpdateFunctionExtractParam) UnmarshalJSON(data []byte) error

type UpdateFunctionJoinParam

type UpdateFunctionJoinParam struct {
	// Description of join function.
	Description param.Opt[string] `json:"description,omitzero"`
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName param.Opt[string] `json:"functionName,omitzero"`
	// Name of output schema object.
	OutputSchemaName param.Opt[string] `json:"outputSchemaName,omitzero"`
	// The type of join to perform.
	//
	// Any of "standard".
	JoinType string `json:"joinType,omitzero"`
	// Desired output structure defined in standard JSON Schema convention.
	OutputSchema any `json:"outputSchema,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "join".
	Type constant.Join `json:"type" default:"join"`
	// contains filtered or unexported fields
}

The property Type is required.

func (UpdateFunctionJoinParam) MarshalJSON

func (r UpdateFunctionJoinParam) MarshalJSON() (data []byte, err error)

func (*UpdateFunctionJoinParam) UnmarshalJSON

func (r *UpdateFunctionJoinParam) UnmarshalJSON(data []byte) error

type UpdateFunctionParseExtraConfigParam added in v0.19.0

type UpdateFunctionParseExtraConfigParam struct {
	// When true, return per-section and per-entity-mention coordinates in the parse
	// event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
	// array of `{page, left, top, width, height}` with coordinates normalized to [0,
	// 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
	// output. Only applies to the open-ended discovery path (no `schema`) and to
	// vision input types. Bedrock-backed parse functions silently return an empty map
	// (no native bbox support). Defaults to false.
	EnableBoundingBoxes param.Opt[bool] `json:"enableBoundingBoxes,omitzero"`
	// contains filtered or unexported fields
}

Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on Extract / Join — separated from `parseConfig` so the per-call Parse output shape stays distinct from operator-level execution flags.

func (UpdateFunctionParseExtraConfigParam) MarshalJSON added in v0.19.0

func (r UpdateFunctionParseExtraConfigParam) MarshalJSON() (data []byte, err error)

func (*UpdateFunctionParseExtraConfigParam) UnmarshalJSON added in v0.19.0

func (r *UpdateFunctionParseExtraConfigParam) UnmarshalJSON(data []byte) error

type UpdateFunctionParseParam added in v0.10.0

type UpdateFunctionParseParam struct {
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName param.Opt[string] `json:"functionName,omitzero"`
	// Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
	// Extract / Join — separated from `parseConfig` so the per-call Parse output shape
	// stays distinct from operator-level execution flags.
	ExtraConfig UpdateFunctionParseExtraConfigParam `json:"extraConfig,omitzero"`
	// Per-version configuration for a Parse function.
	//
	// Parse renders document pages (PDF, image) via vision LLM and emits structured
	// JSON. The two toggles below independently control entity extraction (a per-call
	// output concern) and cross-document memory linking (an environment-wide concern).
	ParseConfig ParseConfigParam `json:"parseConfig,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "parse".
	Type constant.Parse `json:"type" default:"parse"`
	// contains filtered or unexported fields
}

The property Type is required.

func (UpdateFunctionParseParam) MarshalJSON added in v0.10.0

func (r UpdateFunctionParseParam) MarshalJSON() (data []byte, err error)

func (*UpdateFunctionParseParam) UnmarshalJSON added in v0.10.0

func (r *UpdateFunctionParseParam) UnmarshalJSON(data []byte) error

type UpdateFunctionPayloadShapingParam

type UpdateFunctionPayloadShapingParam struct {
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName param.Opt[string] `json:"functionName,omitzero"`
	// JMESPath expression that defines how to transform and customize the input
	// payload structure. Payload shaping allows you to extract, reshape, and
	// reorganize data from complex input payloads into a simplified, standardized
	// output format. Use JMESPath syntax to select specific fields, perform
	// calculations, and create new data structures tailored to your needs.
	ShapingSchema param.Opt[string] `json:"shapingSchema,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "payload_shaping".
	Type constant.PayloadShaping `json:"type" default:"payload_shaping"`
	// contains filtered or unexported fields
}

A function that transforms and customizes input payloads using JMESPath expressions. Payload shaping allows you to extract specific data, perform calculations, and reshape complex input structures into simplified, standardized output formats tailored to your downstream systems or business requirements.

The property Type is required.

func (UpdateFunctionPayloadShapingParam) MarshalJSON

func (r UpdateFunctionPayloadShapingParam) MarshalJSON() (data []byte, err error)

func (*UpdateFunctionPayloadShapingParam) UnmarshalJSON

func (r *UpdateFunctionPayloadShapingParam) UnmarshalJSON(data []byte) error

type UpdateFunctionSendParam

type UpdateFunctionSendParam struct {
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName param.Opt[string] `json:"functionName,omitzero"`
	// Google Drive folder ID. Required when destinationType is google_drive. Managed
	// via Paragon OAuth.
	GoogleDriveFolderID param.Opt[string] `json:"googleDriveFolderId,omitzero"`
	// S3 bucket to upload the payload to. Required when destinationType is s3.
	S3Bucket param.Opt[string] `json:"s3Bucket,omitzero"`
	// Optional S3 key prefix (folder path).
	S3Prefix param.Opt[string] `json:"s3Prefix,omitzero"`
	// Whether to sign webhook deliveries with an HMAC-SHA256 `bem-signature` header.
	// Defaults to `true` when omitted — signing is on by default for new send
	// functions. Set explicitly to `false` to disable.
	WebhookSigningEnabled param.Opt[bool] `json:"webhookSigningEnabled,omitzero"`
	// Webhook URL to POST the payload to. Required when destinationType is webhook.
	WebhookURL param.Opt[string] `json:"webhookUrl,omitzero"`
	// Destination type for a Send function.
	//
	// Any of "webhook", "s3", "google_drive".
	DestinationType SendDestinationType `json:"destinationType,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "send".
	Type constant.Send `json:"type" default:"send"`
	// contains filtered or unexported fields
}

The property Type is required.

func (UpdateFunctionSendParam) MarshalJSON

func (r UpdateFunctionSendParam) MarshalJSON() (data []byte, err error)

func (*UpdateFunctionSendParam) UnmarshalJSON

func (r *UpdateFunctionSendParam) UnmarshalJSON(data []byte) error

type UpdateFunctionSplitParam

type UpdateFunctionSplitParam struct {
	// Display name of function. Human-readable name to help you identify the function.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// Name of function. Must be UNIQUE on a per-environment basis.
	FunctionName            param.Opt[string]                               `json:"functionName,omitzero"`
	PrintPageSplitConfig    UpdateFunctionSplitPrintPageSplitConfigParam    `json:"printPageSplitConfig,omitzero"`
	SemanticPageSplitConfig UpdateFunctionSplitSemanticPageSplitConfigParam `json:"semanticPageSplitConfig,omitzero"`
	// Any of "print_page", "semantic_page".
	SplitType string `json:"splitType,omitzero"`
	// Array of tags to categorize and organize functions.
	Tags []string `json:"tags,omitzero"`
	// This field can be elided, and will marshal its zero value as "split".
	Type constant.Split `json:"type" default:"split"`
	// contains filtered or unexported fields
}

The property Type is required.

func (UpdateFunctionSplitParam) MarshalJSON

func (r UpdateFunctionSplitParam) MarshalJSON() (data []byte, err error)

func (*UpdateFunctionSplitParam) UnmarshalJSON

func (r *UpdateFunctionSplitParam) UnmarshalJSON(data []byte) error

type UpdateFunctionSplitPrintPageSplitConfigParam

type UpdateFunctionSplitPrintPageSplitConfigParam struct {
	NextFunctionID   param.Opt[string] `json:"nextFunctionID,omitzero"`
	NextFunctionName param.Opt[string] `json:"nextFunctionName,omitzero"`
	// contains filtered or unexported fields
}

func (UpdateFunctionSplitPrintPageSplitConfigParam) MarshalJSON

func (r UpdateFunctionSplitPrintPageSplitConfigParam) MarshalJSON() (data []byte, err error)

func (*UpdateFunctionSplitPrintPageSplitConfigParam) UnmarshalJSON

func (r *UpdateFunctionSplitPrintPageSplitConfigParam) UnmarshalJSON(data []byte) error

type UpdateFunctionSplitSemanticPageSplitConfigParam

type UpdateFunctionSplitSemanticPageSplitConfigParam struct {
	ItemClasses []SplitFunctionSemanticPageItemClassParam `json:"itemClasses,omitzero"`
	// contains filtered or unexported fields
}

func (UpdateFunctionSplitSemanticPageSplitConfigParam) MarshalJSON

func (r UpdateFunctionSplitSemanticPageSplitConfigParam) MarshalJSON() (data []byte, err error)

func (*UpdateFunctionSplitSemanticPageSplitConfigParam) UnmarshalJSON

type UpdateFunctionUnionParam

type UpdateFunctionUnionParam struct {
	OfExtract        *UpdateFunctionExtractParam        `json:",omitzero,inline"`
	OfClassify       *UpdateFunctionClassifyParam       `json:",omitzero,inline"`
	OfSend           *UpdateFunctionSendParam           `json:",omitzero,inline"`
	OfSplit          *UpdateFunctionSplitParam          `json:",omitzero,inline"`
	OfJoin           *UpdateFunctionJoinParam           `json:",omitzero,inline"`
	OfPayloadShaping *UpdateFunctionPayloadShapingParam `json:",omitzero,inline"`
	OfEnrich         *UpdateFunctionEnrichParam         `json:",omitzero,inline"`
	OfParse          *UpdateFunctionParseParam          `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (UpdateFunctionUnionParam) MarshalJSON

func (u UpdateFunctionUnionParam) MarshalJSON() ([]byte, error)

func (*UpdateFunctionUnionParam) UnmarshalJSON

func (u *UpdateFunctionUnionParam) UnmarshalJSON(data []byte) error

type UserActionSummary

type UserActionSummary struct {
	// The date and time the action was created.
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Unique identifier of the user action.
	UserActionID string `json:"userActionID" api:"required"`
	// API key name. Present for API key-initiated actions.
	APIKeyName string `json:"apiKeyName"`
	// Email address. Present for email-initiated actions.
	EmailAddress string `json:"emailAddress"`
	// User's email address. Present for user-initiated actions.
	UserEmail string `json:"userEmail"`
	// User's ID. Present for user-initiated actions.
	UserID string `json:"userID"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt    respjson.Field
		UserActionID respjson.Field
		APIKeyName   respjson.Field
		EmailAddress respjson.Field
		UserEmail    respjson.Field
		UserID       respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UserActionSummary) RawJSON

func (r UserActionSummary) RawJSON() string

Returns the unmodified JSON received from the API

func (*UserActionSummary) UnmarshalJSON

func (r *UserActionSummary) UnmarshalJSON(data []byte) error

type UserListReviewerAssignmentsResponse added in v0.21.0

type UserListReviewerAssignmentsResponse struct {
	Assignments []UserListReviewerAssignmentsResponseAssignment `json:"assignments" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Assignments respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response body for the reverse lookup of a user's reviewer assignments.

func (UserListReviewerAssignmentsResponse) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*UserListReviewerAssignmentsResponse) UnmarshalJSON added in v0.21.0

func (r *UserListReviewerAssignmentsResponse) UnmarshalJSON(data []byte) error

type UserListReviewerAssignmentsResponseAssignment added in v0.21.0

type UserListReviewerAssignmentsResponseAssignment struct {
	// When the assignment was created (RFC 3339).
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// The entity type's description.
	Description string `json:"description" api:"required"`
	// The entity type's human-facing name.
	Name string `json:"name" api:"required"`
	// Public ID (`ety_...`) of the entity type the user reviews.
	TypeID string `json:"typeID" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Description respjson.Field
		Name        respjson.Field
		TypeID      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

One entity type a user reviews, as returned by the reverse-lookup endpoint. The type is exposed via its public ID plus its name and description.

func (UserListReviewerAssignmentsResponseAssignment) RawJSON added in v0.21.0

Returns the unmodified JSON received from the API

func (*UserListReviewerAssignmentsResponseAssignment) UnmarshalJSON added in v0.21.0

func (r *UserListReviewerAssignmentsResponseAssignment) UnmarshalJSON(data []byte) error

type UserService added in v0.21.0

type UserService struct {
	// contains filtered or unexported fields
}

Reviewer assignments link users to the entity types they are responsible for reviewing, scoped to an account+environment. These are dashboard-only endpoints: an assignment needs a user identity, which only the dashboard (JWT) surface carries.

  • **`POST /v3/entity-types/{typeID}/reviewers`** assigns a user as a reviewer of the type. The assignment is idempotent: re-assigning an existing reviewer returns the existing assignment. Requires the `admin` role.
  • **`GET /v3/entity-types/{typeID}/reviewers`** lists the users assigned to review the type, with each user's email and role. Requires the `operator` role.
  • **`DELETE /v3/entity-types/{typeID}/reviewers/{userID}`** removes an assignment. Requires the `admin` role.
  • **`GET /v3/users/{userID}/reviewer-assignments`** is the reverse lookup: the entity types a user reviews. A user may read their own assignments; reading another user's assignments requires the `admin` role.

UserService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewUserService method instead.

func NewUserService added in v0.21.0

func NewUserService(opts ...option.RequestOption) (r UserService)

NewUserService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*UserService) ListReviewerAssignments added in v0.21.0

func (r *UserService) ListReviewerAssignments(ctx context.Context, userID string, opts ...option.RequestOption) (res *UserListReviewerAssignmentsResponse, err error)

List a User's Reviewer Assignments

type ViewGenerateAggregationDataParams added in v0.16.0

type ViewGenerateAggregationDataParams struct {
	// List of aggregations defined for the view
	Aggregations []ViewGenerateAggregationDataParamsAggregation `json:"aggregations,omitzero" api:"required"`
	// List of columns in the view
	Columns []ViewGenerateAggregationDataParamsColumn `json:"columns,omitzero" api:"required"`
	// List of filters applied to the view
	Filters []ViewGenerateAggregationDataParamsFilter `json:"filters,omitzero" api:"required"`
	// List of functions that this view queries transformations from
	Functions []ViewGenerateAggregationDataParamsFunction `json:"functions,omitzero" api:"required"`
	// Name of the view
	Name string `json:"name" api:"required"`
	// Time window for filtering transformations in a view
	TimeWindow ViewGenerateAggregationDataParamsTimeWindow `json:"timeWindow,omitzero" api:"required"`
	// Description of the view
	Description param.Opt[string] `json:"description,omitzero"`
	// contains filtered or unexported fields
}

func (ViewGenerateAggregationDataParams) MarshalJSON added in v0.16.0

func (r ViewGenerateAggregationDataParams) MarshalJSON() (data []byte, err error)

func (*ViewGenerateAggregationDataParams) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateAggregationDataParams) UnmarshalJSON(data []byte) error

type ViewGenerateAggregationDataParamsAggregation added in v0.16.0

type ViewGenerateAggregationDataParamsAggregation struct {
	// Aggregation function to apply to a view column
	//
	// Any of "count", "count_distinct", "sum", "average", "min", "max".
	Function string `json:"function,omitzero" api:"required"`
	// Name of the aggregation
	Name string `json:"name" api:"required"`
	// Name of the column to aggregate (required for count_distinct, sum, average, min,
	// max functions)
	AggregateColumnName param.Opt[string] `json:"aggregateColumnName,omitzero"`
	// Name of the column to group by (optional, for grouped aggregations)
	GroupByColumnName param.Opt[string] `json:"groupByColumnName,omitzero"`
	// How to display the aggregation results
	//
	// Any of "table", "bar_chart", "pie_chart".
	DisplayType string `json:"displayType,omitzero"`
	// contains filtered or unexported fields
}

An aggregation definition for a view

The properties Function, Name are required.

func (ViewGenerateAggregationDataParamsAggregation) MarshalJSON added in v0.16.0

func (r ViewGenerateAggregationDataParamsAggregation) MarshalJSON() (data []byte, err error)

func (*ViewGenerateAggregationDataParamsAggregation) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateAggregationDataParamsAggregation) UnmarshalJSON(data []byte) error

type ViewGenerateAggregationDataParamsColumn added in v0.16.0

type ViewGenerateAggregationDataParamsColumn struct {
	// Order in which this column should be displayed (0-based index)
	DisplayOrderIndex int64 `json:"displayOrderIndex" api:"required"`
	// Name of the column
	Name string `json:"name" api:"required"`
	// JSON path to the value in the transformation output schema (e.g.,
	// ["invoiceDetails", "invoiceNumber"])
	ValueSchemaPath []string `json:"valueSchemaPath,omitzero" api:"required"`
	// contains filtered or unexported fields
}

A column definition in a view

The properties DisplayOrderIndex, Name, ValueSchemaPath are required.

func (ViewGenerateAggregationDataParamsColumn) MarshalJSON added in v0.16.0

func (r ViewGenerateAggregationDataParamsColumn) MarshalJSON() (data []byte, err error)

func (*ViewGenerateAggregationDataParamsColumn) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateAggregationDataParamsColumn) UnmarshalJSON(data []byte) error

type ViewGenerateAggregationDataParamsFilter added in v0.16.0

type ViewGenerateAggregationDataParamsFilter struct {
	// Name of the column to filter on
	ColumnName string `json:"columnName" api:"required"`
	// Type of filter to apply to a view column
	//
	// Any of "equals_string", "equals_number", "less_than_number",
	// "less_than_equal_number", "greater_than_number", "greater_than_equal_number",
	// "is_null", "is_not_null".
	FilterType string `json:"filterType,omitzero" api:"required"`
	// Numeric value for the filter (required for number filter types)
	Number param.Opt[float64] `json:"number,omitzero"`
	// String value for the filter (required for string filter types)
	String param.Opt[string] `json:"string,omitzero"`
	// contains filtered or unexported fields
}

A filter to apply to a view column

The properties ColumnName, FilterType are required.

func (ViewGenerateAggregationDataParamsFilter) MarshalJSON added in v0.16.0

func (r ViewGenerateAggregationDataParamsFilter) MarshalJSON() (data []byte, err error)

func (*ViewGenerateAggregationDataParamsFilter) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateAggregationDataParamsFilter) UnmarshalJSON(data []byte) error

type ViewGenerateAggregationDataParamsFunction added in v0.16.0

type ViewGenerateAggregationDataParamsFunction struct {
	// Unique identifier of function. Provide either id or name, not both.
	ID param.Opt[string] `json:"id,omitzero"`
	// Name of function. Must be UNIQUE on a per-environment basis. Provide either id
	// or name, not both.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (ViewGenerateAggregationDataParamsFunction) MarshalJSON added in v0.16.0

func (r ViewGenerateAggregationDataParamsFunction) MarshalJSON() (data []byte, err error)

func (*ViewGenerateAggregationDataParamsFunction) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateAggregationDataParamsFunction) UnmarshalJSON(data []byte) error

type ViewGenerateAggregationDataParamsTimeWindow added in v0.16.0

type ViewGenerateAggregationDataParamsTimeWindow struct {
	// End of the time window in ISO 8601 (RFC 3339) format in UTC
	End time.Time `json:"end" api:"required" format:"date-time"`
	// Start of the time window in ISO 8601 (RFC 3339) format in UTC
	Start time.Time `json:"start" api:"required" format:"date-time"`
	// contains filtered or unexported fields
}

Time window for filtering transformations in a view

The properties End, Start are required.

func (ViewGenerateAggregationDataParamsTimeWindow) MarshalJSON added in v0.16.0

func (r ViewGenerateAggregationDataParamsTimeWindow) MarshalJSON() (data []byte, err error)

func (*ViewGenerateAggregationDataParamsTimeWindow) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateAggregationDataParamsTimeWindow) UnmarshalJSON(data []byte) error

type ViewGenerateAggregationDataResponse added in v0.16.0

type ViewGenerateAggregationDataResponse struct {
	// Array of aggregation results
	Aggregations []ViewGenerateAggregationDataResponseAggregation `json:"aggregations" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Aggregations respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response containing aggregation data for a view

func (ViewGenerateAggregationDataResponse) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*ViewGenerateAggregationDataResponse) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateAggregationDataResponse) UnmarshalJSON(data []byte) error

type ViewGenerateAggregationDataResponseAggregation added in v0.16.0

type ViewGenerateAggregationDataResponseAggregation struct {
	// Array of group results (single group for non-grouped aggregations)
	Groups []ViewGenerateAggregationDataResponseAggregationGroup `json:"groups" api:"required"`
	// Name of the aggregation
	Name string `json:"name" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Groups      respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Aggregation result for a single aggregation definition

func (ViewGenerateAggregationDataResponseAggregation) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*ViewGenerateAggregationDataResponseAggregation) UnmarshalJSON added in v0.16.0

type ViewGenerateAggregationDataResponseAggregationGroup added in v0.16.0

type ViewGenerateAggregationDataResponseAggregationGroup struct {
	// Name of the group (empty string for non-grouped aggregations)
	GroupName string `json:"groupName" api:"required"`
	// Aggregated value for this group
	Value float64 `json:"value" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		GroupName   respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A single group result in an aggregation response

func (ViewGenerateAggregationDataResponseAggregationGroup) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*ViewGenerateAggregationDataResponseAggregationGroup) UnmarshalJSON added in v0.16.0

type ViewGenerateTableDataParams added in v0.16.0

type ViewGenerateTableDataParams struct {
	// List of aggregations defined for the view
	Aggregations []ViewGenerateTableDataParamsAggregation `json:"aggregations,omitzero" api:"required"`
	// List of columns in the view
	Columns []ViewGenerateTableDataParamsColumn `json:"columns,omitzero" api:"required"`
	// List of filters applied to the view
	Filters []ViewGenerateTableDataParamsFilter `json:"filters,omitzero" api:"required"`
	// List of functions that this view queries transformations from
	Functions []ViewGenerateTableDataParamsFunction `json:"functions,omitzero" api:"required"`
	// Name of the view
	Name string `json:"name" api:"required"`
	// Time window for filtering transformations in a view
	TimeWindow ViewGenerateTableDataParamsTimeWindow `json:"timeWindow,omitzero" api:"required"`
	// Maximum number of rows to return (default: 50, max: 200)
	Limit param.Opt[int64] `json:"limit,omitzero"`
	// Number of rows to skip for pagination
	Offset param.Opt[int64] `json:"offset,omitzero"`
	// Description of the view
	Description param.Opt[string] `json:"description,omitzero"`
	// contains filtered or unexported fields
}

func (ViewGenerateTableDataParams) MarshalJSON added in v0.16.0

func (r ViewGenerateTableDataParams) MarshalJSON() (data []byte, err error)

func (*ViewGenerateTableDataParams) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateTableDataParams) UnmarshalJSON(data []byte) error

type ViewGenerateTableDataParamsAggregation added in v0.16.0

type ViewGenerateTableDataParamsAggregation struct {
	// Aggregation function to apply to a view column
	//
	// Any of "count", "count_distinct", "sum", "average", "min", "max".
	Function string `json:"function,omitzero" api:"required"`
	// Name of the aggregation
	Name string `json:"name" api:"required"`
	// Name of the column to aggregate (required for count_distinct, sum, average, min,
	// max functions)
	AggregateColumnName param.Opt[string] `json:"aggregateColumnName,omitzero"`
	// Name of the column to group by (optional, for grouped aggregations)
	GroupByColumnName param.Opt[string] `json:"groupByColumnName,omitzero"`
	// How to display the aggregation results
	//
	// Any of "table", "bar_chart", "pie_chart".
	DisplayType string `json:"displayType,omitzero"`
	// contains filtered or unexported fields
}

An aggregation definition for a view

The properties Function, Name are required.

func (ViewGenerateTableDataParamsAggregation) MarshalJSON added in v0.16.0

func (r ViewGenerateTableDataParamsAggregation) MarshalJSON() (data []byte, err error)

func (*ViewGenerateTableDataParamsAggregation) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateTableDataParamsAggregation) UnmarshalJSON(data []byte) error

type ViewGenerateTableDataParamsColumn added in v0.16.0

type ViewGenerateTableDataParamsColumn struct {
	// Order in which this column should be displayed (0-based index)
	DisplayOrderIndex int64 `json:"displayOrderIndex" api:"required"`
	// Name of the column
	Name string `json:"name" api:"required"`
	// JSON path to the value in the transformation output schema (e.g.,
	// ["invoiceDetails", "invoiceNumber"])
	ValueSchemaPath []string `json:"valueSchemaPath,omitzero" api:"required"`
	// contains filtered or unexported fields
}

A column definition in a view

The properties DisplayOrderIndex, Name, ValueSchemaPath are required.

func (ViewGenerateTableDataParamsColumn) MarshalJSON added in v0.16.0

func (r ViewGenerateTableDataParamsColumn) MarshalJSON() (data []byte, err error)

func (*ViewGenerateTableDataParamsColumn) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateTableDataParamsColumn) UnmarshalJSON(data []byte) error

type ViewGenerateTableDataParamsFilter added in v0.16.0

type ViewGenerateTableDataParamsFilter struct {
	// Name of the column to filter on
	ColumnName string `json:"columnName" api:"required"`
	// Type of filter to apply to a view column
	//
	// Any of "equals_string", "equals_number", "less_than_number",
	// "less_than_equal_number", "greater_than_number", "greater_than_equal_number",
	// "is_null", "is_not_null".
	FilterType string `json:"filterType,omitzero" api:"required"`
	// Numeric value for the filter (required for number filter types)
	Number param.Opt[float64] `json:"number,omitzero"`
	// String value for the filter (required for string filter types)
	String param.Opt[string] `json:"string,omitzero"`
	// contains filtered or unexported fields
}

A filter to apply to a view column

The properties ColumnName, FilterType are required.

func (ViewGenerateTableDataParamsFilter) MarshalJSON added in v0.16.0

func (r ViewGenerateTableDataParamsFilter) MarshalJSON() (data []byte, err error)

func (*ViewGenerateTableDataParamsFilter) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateTableDataParamsFilter) UnmarshalJSON(data []byte) error

type ViewGenerateTableDataParamsFunction added in v0.16.0

type ViewGenerateTableDataParamsFunction struct {
	// Unique identifier of function. Provide either id or name, not both.
	ID param.Opt[string] `json:"id,omitzero"`
	// Name of function. Must be UNIQUE on a per-environment basis. Provide either id
	// or name, not both.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (ViewGenerateTableDataParamsFunction) MarshalJSON added in v0.16.0

func (r ViewGenerateTableDataParamsFunction) MarshalJSON() (data []byte, err error)

func (*ViewGenerateTableDataParamsFunction) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateTableDataParamsFunction) UnmarshalJSON(data []byte) error

type ViewGenerateTableDataParamsTimeWindow added in v0.16.0

type ViewGenerateTableDataParamsTimeWindow struct {
	// End of the time window in ISO 8601 (RFC 3339) format in UTC
	End time.Time `json:"end" api:"required" format:"date-time"`
	// Start of the time window in ISO 8601 (RFC 3339) format in UTC
	Start time.Time `json:"start" api:"required" format:"date-time"`
	// contains filtered or unexported fields
}

Time window for filtering transformations in a view

The properties End, Start are required.

func (ViewGenerateTableDataParamsTimeWindow) MarshalJSON added in v0.16.0

func (r ViewGenerateTableDataParamsTimeWindow) MarshalJSON() (data []byte, err error)

func (*ViewGenerateTableDataParamsTimeWindow) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateTableDataParamsTimeWindow) UnmarshalJSON(data []byte) error

type ViewGenerateTableDataResponse added in v0.16.0

type ViewGenerateTableDataResponse struct {
	// Array of rows matching the view configuration
	Rows []ViewGenerateTableDataResponseRow `json:"rows" api:"required"`
	// Total number of rows matching the view (before pagination)
	TotalCount int64 `json:"totalCount" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Rows        respjson.Field
		TotalCount  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response containing paginated view table data

func (ViewGenerateTableDataResponse) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*ViewGenerateTableDataResponse) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateTableDataResponse) UnmarshalJSON(data []byte) error

type ViewGenerateTableDataResponseRow added in v0.16.0

type ViewGenerateTableDataResponseRow struct {
	// Column entries for this row
	Columns []ViewGenerateTableDataResponseRowColumn `json:"columns" api:"required"`
	// Externally-stable KSUID of the event whose underlying transformation produced
	// this row.
	EventID string `json:"eventID" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Columns     respjson.Field
		EventID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A single row in the view table data response

func (ViewGenerateTableDataResponseRow) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*ViewGenerateTableDataResponseRow) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateTableDataResponseRow) UnmarshalJSON(data []byte) error

type ViewGenerateTableDataResponseRowColumn added in v0.16.0

type ViewGenerateTableDataResponseRowColumn struct {
	// Name of the column
	ColumnName string `json:"columnName" api:"required"`
	// Value of the column (can be any JSON type)
	Value ViewGenerateTableDataResponseRowColumnValueUnion `json:"value" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ColumnName  respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A single column entry in a view table data row

func (ViewGenerateTableDataResponseRowColumn) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*ViewGenerateTableDataResponseRowColumn) UnmarshalJSON added in v0.16.0

func (r *ViewGenerateTableDataResponseRowColumn) UnmarshalJSON(data []byte) error

type ViewGenerateTableDataResponseRowColumnValueUnion added in v0.16.0

type ViewGenerateTableDataResponseRowColumnValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field will be present if the value is a [[]any] instead of an object.
	OfAnyArray []any `json:",inline"`
	JSON       struct {
		OfString   respjson.Field
		OfFloat    respjson.Field
		OfBool     respjson.Field
		OfAnyArray respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ViewGenerateTableDataResponseRowColumnValueUnion contains all possible properties and values from [string], [float64], [bool], [[]any].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool OfAnyArray]

func (ViewGenerateTableDataResponseRowColumnValueUnion) AsAnyArray added in v0.16.0

func (ViewGenerateTableDataResponseRowColumnValueUnion) AsBool added in v0.16.0

func (ViewGenerateTableDataResponseRowColumnValueUnion) AsFloat added in v0.16.0

func (ViewGenerateTableDataResponseRowColumnValueUnion) AsString added in v0.16.0

func (ViewGenerateTableDataResponseRowColumnValueUnion) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*ViewGenerateTableDataResponseRowColumnValueUnion) UnmarshalJSON added in v0.16.0

type ViewGetResponse added in v0.16.0

type ViewGetResponse struct {
	// List of aggregations defined for the view
	Aggregations []ViewGetResponseAggregation `json:"aggregations" api:"required"`
	// List of columns in the view
	Columns []ViewGetResponseColumn `json:"columns" api:"required"`
	// Current version number of the view
	CurrentVersionNum int64 `json:"currentVersionNum" api:"required"`
	// List of filters applied to the view
	Filters []ViewGetResponseFilter `json:"filters" api:"required"`
	// List of functions that this view queries transformations from
	Functions []ViewGetResponseFunction `json:"functions" api:"required"`
	// Name of the view
	Name string `json:"name" api:"required"`
	// Unique identifier of the view
	ViewID string `json:"viewID" api:"required"`
	// Description of the view
	Description string `json:"description" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Aggregations      respjson.Field
		Columns           respjson.Field
		CurrentVersionNum respjson.Field
		Filters           respjson.Field
		Functions         respjson.Field
		Name              respjson.Field
		ViewID            respjson.Field
		Description       respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A view is a table visualization of transformations that allows customers to have insight into their transformations

func (ViewGetResponse) RawJSON added in v0.16.0

func (r ViewGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewGetResponse) UnmarshalJSON added in v0.16.0

func (r *ViewGetResponse) UnmarshalJSON(data []byte) error

type ViewGetResponseAggregation added in v0.16.0

type ViewGetResponseAggregation struct {
	// Aggregation function to apply to a view column
	//
	// Any of "count", "count_distinct", "sum", "average", "min", "max".
	Function string `json:"function" api:"required"`
	// Name of the aggregation
	Name string `json:"name" api:"required"`
	// Name of the column to aggregate (required for count_distinct, sum, average, min,
	// max functions)
	AggregateColumnName string `json:"aggregateColumnName" api:"nullable"`
	// How to display the aggregation results
	//
	// Any of "table", "bar_chart", "pie_chart".
	DisplayType string `json:"displayType"`
	// Name of the column to group by (optional, for grouped aggregations)
	GroupByColumnName string `json:"groupByColumnName" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Function            respjson.Field
		Name                respjson.Field
		AggregateColumnName respjson.Field
		DisplayType         respjson.Field
		GroupByColumnName   respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An aggregation definition for a view

func (ViewGetResponseAggregation) RawJSON added in v0.16.0

func (r ViewGetResponseAggregation) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewGetResponseAggregation) UnmarshalJSON added in v0.16.0

func (r *ViewGetResponseAggregation) UnmarshalJSON(data []byte) error

type ViewGetResponseColumn added in v0.16.0

type ViewGetResponseColumn struct {
	// Order in which this column should be displayed (0-based index)
	DisplayOrderIndex int64 `json:"displayOrderIndex" api:"required"`
	// Name of the column
	Name string `json:"name" api:"required"`
	// JSON path to the value in the transformation output schema (e.g.,
	// ["invoiceDetails", "invoiceNumber"])
	ValueSchemaPath []string `json:"valueSchemaPath" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DisplayOrderIndex respjson.Field
		Name              respjson.Field
		ValueSchemaPath   respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A column definition in a view

func (ViewGetResponseColumn) RawJSON added in v0.16.0

func (r ViewGetResponseColumn) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewGetResponseColumn) UnmarshalJSON added in v0.16.0

func (r *ViewGetResponseColumn) UnmarshalJSON(data []byte) error

type ViewGetResponseFilter added in v0.16.0

type ViewGetResponseFilter struct {
	// Name of the column to filter on
	ColumnName string `json:"columnName" api:"required"`
	// Type of filter to apply to a view column
	//
	// Any of "equals_string", "equals_number", "less_than_number",
	// "less_than_equal_number", "greater_than_number", "greater_than_equal_number",
	// "is_null", "is_not_null".
	FilterType string `json:"filterType" api:"required"`
	// Numeric value for the filter (required for number filter types)
	Number float64 `json:"number" api:"nullable"`
	// String value for the filter (required for string filter types)
	String string `json:"string" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ColumnName  respjson.Field
		FilterType  respjson.Field
		Number      respjson.Field
		String      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A filter to apply to a view column

func (ViewGetResponseFilter) RawJSON added in v0.16.0

func (r ViewGetResponseFilter) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewGetResponseFilter) UnmarshalJSON added in v0.16.0

func (r *ViewGetResponseFilter) UnmarshalJSON(data []byte) error

type ViewGetResponseFunction added in v0.16.0

type ViewGetResponseFunction struct {
	// Unique identifier of function. Provide either id or name, not both.
	ID string `json:"id"`
	// Name of function. Must be UNIQUE on a per-environment basis. Provide either id
	// or name, not both.
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ViewGetResponseFunction) RawJSON added in v0.16.0

func (r ViewGetResponseFunction) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewGetResponseFunction) UnmarshalJSON added in v0.16.0

func (r *ViewGetResponseFunction) UnmarshalJSON(data []byte) error

type ViewListParams added in v0.16.0

type ViewListParams struct {
	// Cursor — a `viewID` defining your place in the list.
	EndingBefore param.Opt[string] `query:"endingBefore,omitzero" json:"-"`
	Limit        param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// Cursor — a `viewID` defining your place in the list.
	StartingAfter param.Opt[string] `query:"startingAfter,omitzero" json:"-"`
	// Case-insensitive substring search over view names.
	ViewNameSubstring param.Opt[string] `query:"viewNameSubstring,omitzero" json:"-"`
	// Return only views that read from at least one of the named functions.
	FunctionIDs []string `query:"functionIDs,omitzero" json:"-"`
	// Return only views that read from at least one of the named functions.
	FunctionNames []string `query:"functionNames,omitzero" json:"-"`
	// Sort order over view IDs (default `asc`).
	//
	// Any of "asc", "desc".
	SortOrder ViewListParamsSortOrder `query:"sortOrder,omitzero" json:"-"`
	// Return only the specified view IDs.
	ViewIDs []string `query:"viewIDs,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ViewListParams) URLQuery added in v0.16.0

func (r ViewListParams) URLQuery() (v url.Values, err error)

URLQuery serializes ViewListParams's query parameters as `url.Values`.

type ViewListParamsSortOrder added in v0.16.0

type ViewListParamsSortOrder string

Sort order over view IDs (default `asc`).

const (
	ViewListParamsSortOrderAsc  ViewListParamsSortOrder = "asc"
	ViewListParamsSortOrderDesc ViewListParamsSortOrder = "desc"
)

type ViewListResponse added in v0.16.0

type ViewListResponse struct {
	// Total number of views matching the query
	TotalCount int64 `json:"totalCount" api:"required"`
	// Array of views
	Views []ViewListResponseView `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		TotalCount  respjson.Field
		Views       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response containing a list of views

func (ViewListResponse) RawJSON added in v0.16.0

func (r ViewListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewListResponse) UnmarshalJSON added in v0.16.0

func (r *ViewListResponse) UnmarshalJSON(data []byte) error

type ViewListResponseView added in v0.16.0

type ViewListResponseView struct {
	// List of aggregations defined for the view
	Aggregations []ViewListResponseViewAggregation `json:"aggregations" api:"required"`
	// List of columns in the view
	Columns []ViewListResponseViewColumn `json:"columns" api:"required"`
	// Current version number of the view
	CurrentVersionNum int64 `json:"currentVersionNum" api:"required"`
	// List of filters applied to the view
	Filters []ViewListResponseViewFilter `json:"filters" api:"required"`
	// List of functions that this view queries transformations from
	Functions []ViewListResponseViewFunction `json:"functions" api:"required"`
	// Name of the view
	Name string `json:"name" api:"required"`
	// Unique identifier of the view
	ViewID string `json:"viewID" api:"required"`
	// Description of the view
	Description string `json:"description" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Aggregations      respjson.Field
		Columns           respjson.Field
		CurrentVersionNum respjson.Field
		Filters           respjson.Field
		Functions         respjson.Field
		Name              respjson.Field
		ViewID            respjson.Field
		Description       respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A view is a table visualization of transformations that allows customers to have insight into their transformations

func (ViewListResponseView) RawJSON added in v0.16.0

func (r ViewListResponseView) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewListResponseView) UnmarshalJSON added in v0.16.0

func (r *ViewListResponseView) UnmarshalJSON(data []byte) error

type ViewListResponseViewAggregation added in v0.16.0

type ViewListResponseViewAggregation struct {
	// Aggregation function to apply to a view column
	//
	// Any of "count", "count_distinct", "sum", "average", "min", "max".
	Function string `json:"function" api:"required"`
	// Name of the aggregation
	Name string `json:"name" api:"required"`
	// Name of the column to aggregate (required for count_distinct, sum, average, min,
	// max functions)
	AggregateColumnName string `json:"aggregateColumnName" api:"nullable"`
	// How to display the aggregation results
	//
	// Any of "table", "bar_chart", "pie_chart".
	DisplayType string `json:"displayType"`
	// Name of the column to group by (optional, for grouped aggregations)
	GroupByColumnName string `json:"groupByColumnName" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Function            respjson.Field
		Name                respjson.Field
		AggregateColumnName respjson.Field
		DisplayType         respjson.Field
		GroupByColumnName   respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An aggregation definition for a view

func (ViewListResponseViewAggregation) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*ViewListResponseViewAggregation) UnmarshalJSON added in v0.16.0

func (r *ViewListResponseViewAggregation) UnmarshalJSON(data []byte) error

type ViewListResponseViewColumn added in v0.16.0

type ViewListResponseViewColumn struct {
	// Order in which this column should be displayed (0-based index)
	DisplayOrderIndex int64 `json:"displayOrderIndex" api:"required"`
	// Name of the column
	Name string `json:"name" api:"required"`
	// JSON path to the value in the transformation output schema (e.g.,
	// ["invoiceDetails", "invoiceNumber"])
	ValueSchemaPath []string `json:"valueSchemaPath" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DisplayOrderIndex respjson.Field
		Name              respjson.Field
		ValueSchemaPath   respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A column definition in a view

func (ViewListResponseViewColumn) RawJSON added in v0.16.0

func (r ViewListResponseViewColumn) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewListResponseViewColumn) UnmarshalJSON added in v0.16.0

func (r *ViewListResponseViewColumn) UnmarshalJSON(data []byte) error

type ViewListResponseViewFilter added in v0.16.0

type ViewListResponseViewFilter struct {
	// Name of the column to filter on
	ColumnName string `json:"columnName" api:"required"`
	// Type of filter to apply to a view column
	//
	// Any of "equals_string", "equals_number", "less_than_number",
	// "less_than_equal_number", "greater_than_number", "greater_than_equal_number",
	// "is_null", "is_not_null".
	FilterType string `json:"filterType" api:"required"`
	// Numeric value for the filter (required for number filter types)
	Number float64 `json:"number" api:"nullable"`
	// String value for the filter (required for string filter types)
	String string `json:"string" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ColumnName  respjson.Field
		FilterType  respjson.Field
		Number      respjson.Field
		String      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A filter to apply to a view column

func (ViewListResponseViewFilter) RawJSON added in v0.16.0

func (r ViewListResponseViewFilter) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewListResponseViewFilter) UnmarshalJSON added in v0.16.0

func (r *ViewListResponseViewFilter) UnmarshalJSON(data []byte) error

type ViewListResponseViewFunction added in v0.16.0

type ViewListResponseViewFunction struct {
	// Unique identifier of function. Provide either id or name, not both.
	ID string `json:"id"`
	// Name of function. Must be UNIQUE on a per-environment basis. Provide either id
	// or name, not both.
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ViewListResponseViewFunction) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*ViewListResponseViewFunction) UnmarshalJSON added in v0.16.0

func (r *ViewListResponseViewFunction) UnmarshalJSON(data []byte) error

type ViewNewParams added in v0.16.0

type ViewNewParams struct {
	// List of aggregations defined for the view
	Aggregations []ViewNewParamsAggregation `json:"aggregations,omitzero" api:"required"`
	// List of columns in the view
	Columns []ViewNewParamsColumn `json:"columns,omitzero" api:"required"`
	// List of filters applied to the view
	Filters []ViewNewParamsFilter `json:"filters,omitzero" api:"required"`
	// List of functions that this view queries transformations from
	Functions []ViewNewParamsFunction `json:"functions,omitzero" api:"required"`
	// Name of the view
	Name string `json:"name" api:"required"`
	// Description of the view
	Description param.Opt[string] `json:"description,omitzero"`
	// contains filtered or unexported fields
}

func (ViewNewParams) MarshalJSON added in v0.16.0

func (r ViewNewParams) MarshalJSON() (data []byte, err error)

func (*ViewNewParams) UnmarshalJSON added in v0.16.0

func (r *ViewNewParams) UnmarshalJSON(data []byte) error

type ViewNewParamsAggregation added in v0.16.0

type ViewNewParamsAggregation struct {
	// Aggregation function to apply to a view column
	//
	// Any of "count", "count_distinct", "sum", "average", "min", "max".
	Function string `json:"function,omitzero" api:"required"`
	// Name of the aggregation
	Name string `json:"name" api:"required"`
	// Name of the column to aggregate (required for count_distinct, sum, average, min,
	// max functions)
	AggregateColumnName param.Opt[string] `json:"aggregateColumnName,omitzero"`
	// Name of the column to group by (optional, for grouped aggregations)
	GroupByColumnName param.Opt[string] `json:"groupByColumnName,omitzero"`
	// How to display the aggregation results
	//
	// Any of "table", "bar_chart", "pie_chart".
	DisplayType string `json:"displayType,omitzero"`
	// contains filtered or unexported fields
}

An aggregation definition for a view

The properties Function, Name are required.

func (ViewNewParamsAggregation) MarshalJSON added in v0.16.0

func (r ViewNewParamsAggregation) MarshalJSON() (data []byte, err error)

func (*ViewNewParamsAggregation) UnmarshalJSON added in v0.16.0

func (r *ViewNewParamsAggregation) UnmarshalJSON(data []byte) error

type ViewNewParamsColumn added in v0.16.0

type ViewNewParamsColumn struct {
	// Order in which this column should be displayed (0-based index)
	DisplayOrderIndex int64 `json:"displayOrderIndex" api:"required"`
	// Name of the column
	Name string `json:"name" api:"required"`
	// JSON path to the value in the transformation output schema (e.g.,
	// ["invoiceDetails", "invoiceNumber"])
	ValueSchemaPath []string `json:"valueSchemaPath,omitzero" api:"required"`
	// contains filtered or unexported fields
}

A column definition in a view

The properties DisplayOrderIndex, Name, ValueSchemaPath are required.

func (ViewNewParamsColumn) MarshalJSON added in v0.16.0

func (r ViewNewParamsColumn) MarshalJSON() (data []byte, err error)

func (*ViewNewParamsColumn) UnmarshalJSON added in v0.16.0

func (r *ViewNewParamsColumn) UnmarshalJSON(data []byte) error

type ViewNewParamsFilter added in v0.16.0

type ViewNewParamsFilter struct {
	// Name of the column to filter on
	ColumnName string `json:"columnName" api:"required"`
	// Type of filter to apply to a view column
	//
	// Any of "equals_string", "equals_number", "less_than_number",
	// "less_than_equal_number", "greater_than_number", "greater_than_equal_number",
	// "is_null", "is_not_null".
	FilterType string `json:"filterType,omitzero" api:"required"`
	// Numeric value for the filter (required for number filter types)
	Number param.Opt[float64] `json:"number,omitzero"`
	// String value for the filter (required for string filter types)
	String param.Opt[string] `json:"string,omitzero"`
	// contains filtered or unexported fields
}

A filter to apply to a view column

The properties ColumnName, FilterType are required.

func (ViewNewParamsFilter) MarshalJSON added in v0.16.0

func (r ViewNewParamsFilter) MarshalJSON() (data []byte, err error)

func (*ViewNewParamsFilter) UnmarshalJSON added in v0.16.0

func (r *ViewNewParamsFilter) UnmarshalJSON(data []byte) error

type ViewNewParamsFunction added in v0.16.0

type ViewNewParamsFunction struct {
	// Unique identifier of function. Provide either id or name, not both.
	ID param.Opt[string] `json:"id,omitzero"`
	// Name of function. Must be UNIQUE on a per-environment basis. Provide either id
	// or name, not both.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (ViewNewParamsFunction) MarshalJSON added in v0.16.0

func (r ViewNewParamsFunction) MarshalJSON() (data []byte, err error)

func (*ViewNewParamsFunction) UnmarshalJSON added in v0.16.0

func (r *ViewNewParamsFunction) UnmarshalJSON(data []byte) error

type ViewNewResponse added in v0.16.0

type ViewNewResponse struct {
	// List of aggregations defined for the view
	Aggregations []ViewNewResponseAggregation `json:"aggregations" api:"required"`
	// List of columns in the view
	Columns []ViewNewResponseColumn `json:"columns" api:"required"`
	// Current version number of the view
	CurrentVersionNum int64 `json:"currentVersionNum" api:"required"`
	// List of filters applied to the view
	Filters []ViewNewResponseFilter `json:"filters" api:"required"`
	// List of functions that this view queries transformations from
	Functions []ViewNewResponseFunction `json:"functions" api:"required"`
	// Name of the view
	Name string `json:"name" api:"required"`
	// Unique identifier of the view
	ViewID string `json:"viewID" api:"required"`
	// Description of the view
	Description string `json:"description" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Aggregations      respjson.Field
		Columns           respjson.Field
		CurrentVersionNum respjson.Field
		Filters           respjson.Field
		Functions         respjson.Field
		Name              respjson.Field
		ViewID            respjson.Field
		Description       respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A view is a table visualization of transformations that allows customers to have insight into their transformations

func (ViewNewResponse) RawJSON added in v0.16.0

func (r ViewNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewNewResponse) UnmarshalJSON added in v0.16.0

func (r *ViewNewResponse) UnmarshalJSON(data []byte) error

type ViewNewResponseAggregation added in v0.16.0

type ViewNewResponseAggregation struct {
	// Aggregation function to apply to a view column
	//
	// Any of "count", "count_distinct", "sum", "average", "min", "max".
	Function string `json:"function" api:"required"`
	// Name of the aggregation
	Name string `json:"name" api:"required"`
	// Name of the column to aggregate (required for count_distinct, sum, average, min,
	// max functions)
	AggregateColumnName string `json:"aggregateColumnName" api:"nullable"`
	// How to display the aggregation results
	//
	// Any of "table", "bar_chart", "pie_chart".
	DisplayType string `json:"displayType"`
	// Name of the column to group by (optional, for grouped aggregations)
	GroupByColumnName string `json:"groupByColumnName" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Function            respjson.Field
		Name                respjson.Field
		AggregateColumnName respjson.Field
		DisplayType         respjson.Field
		GroupByColumnName   respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An aggregation definition for a view

func (ViewNewResponseAggregation) RawJSON added in v0.16.0

func (r ViewNewResponseAggregation) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewNewResponseAggregation) UnmarshalJSON added in v0.16.0

func (r *ViewNewResponseAggregation) UnmarshalJSON(data []byte) error

type ViewNewResponseColumn added in v0.16.0

type ViewNewResponseColumn struct {
	// Order in which this column should be displayed (0-based index)
	DisplayOrderIndex int64 `json:"displayOrderIndex" api:"required"`
	// Name of the column
	Name string `json:"name" api:"required"`
	// JSON path to the value in the transformation output schema (e.g.,
	// ["invoiceDetails", "invoiceNumber"])
	ValueSchemaPath []string `json:"valueSchemaPath" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DisplayOrderIndex respjson.Field
		Name              respjson.Field
		ValueSchemaPath   respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A column definition in a view

func (ViewNewResponseColumn) RawJSON added in v0.16.0

func (r ViewNewResponseColumn) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewNewResponseColumn) UnmarshalJSON added in v0.16.0

func (r *ViewNewResponseColumn) UnmarshalJSON(data []byte) error

type ViewNewResponseFilter added in v0.16.0

type ViewNewResponseFilter struct {
	// Name of the column to filter on
	ColumnName string `json:"columnName" api:"required"`
	// Type of filter to apply to a view column
	//
	// Any of "equals_string", "equals_number", "less_than_number",
	// "less_than_equal_number", "greater_than_number", "greater_than_equal_number",
	// "is_null", "is_not_null".
	FilterType string `json:"filterType" api:"required"`
	// Numeric value for the filter (required for number filter types)
	Number float64 `json:"number" api:"nullable"`
	// String value for the filter (required for string filter types)
	String string `json:"string" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ColumnName  respjson.Field
		FilterType  respjson.Field
		Number      respjson.Field
		String      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A filter to apply to a view column

func (ViewNewResponseFilter) RawJSON added in v0.16.0

func (r ViewNewResponseFilter) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewNewResponseFilter) UnmarshalJSON added in v0.16.0

func (r *ViewNewResponseFilter) UnmarshalJSON(data []byte) error

type ViewNewResponseFunction added in v0.16.0

type ViewNewResponseFunction struct {
	// Unique identifier of function. Provide either id or name, not both.
	ID string `json:"id"`
	// Name of function. Must be UNIQUE on a per-environment basis. Provide either id
	// or name, not both.
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ViewNewResponseFunction) RawJSON added in v0.16.0

func (r ViewNewResponseFunction) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewNewResponseFunction) UnmarshalJSON added in v0.16.0

func (r *ViewNewResponseFunction) UnmarshalJSON(data []byte) error

type ViewService added in v0.16.0

type ViewService struct {
	// contains filtered or unexported fields
}

Views are tabular projections over the `transformations` your functions produce — a saved query that turns raw extracted JSON into a filterable, paginatable, aggregatable table.

## Anatomy

A view declares:

  • One or more **functions** to read from (by `functionID` or `functionName`).
  • A list of **columns**, each pinned to a `valueSchemaPath` (a JSON Pointer into the function's output schema).
  • Optional **filters** (string equality, numeric comparators, null-checks) and **aggregations** (`count`, `count_distinct`, `sum`, `average`, `min`, `max`).

Views are versioned: every update produces a new version, and the previous version remains immutable and addressable. Function types that produce transformations with an output schema — `extract`, `transform`, `analyze`, `join` — are all queryable through views; `extract` works uniformly across vision and OCR inputs.

## Reading data

  • **`POST /v3/views/table-data`** — paginated rows of column values. Each row reports the underlying event's `eventID` (the externally-stable KSUID used everywhere else in V3) plus the projected column values.
  • **`POST /v3/views/aggregation-data`** — group-by-able aggregate values across the same query surface.

Both endpoints take a `timeWindow` to bound the transformation set and require at least one `function` to read from.

ViewService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewViewService method instead.

func NewViewService added in v0.16.0

func NewViewService(opts ...option.RequestOption) (r ViewService)

NewViewService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ViewService) Delete added in v0.16.0

func (r *ViewService) Delete(ctx context.Context, viewID string, opts ...option.RequestOption) (err error)

**Delete a view and every one of its versions.**

Permanent. Any cached data-table or aggregation result clients have fetched remains valid, but subsequent calls to `POST /v3/views/table-data` or `POST /v3/views/aggregation-data` for this view will fail.

func (*ViewService) GenerateAggregationData added in v0.16.0

**Generate aggregation results for a view.**

Executes each aggregation declared on the view against the `transformations` rows produced by the named functions inside the supplied `timeWindow`, applying the view's filters. Supported aggregation functions: `count`, `count_distinct`, `sum`, `average`, `min`, `max`. Grouped aggregations return up to 200 groups per aggregation; non-grouped aggregations return a single group with an empty `groupName`.

As with table-data, the `functions` field is required.

func (*ViewService) GenerateTableData added in v0.16.0

**Generate paginated table data for a view.**

Executes the view's query against `transformations` rows produced by the named functions inside the supplied `timeWindow`, applies the view's filters, and returns matching rows. Each row reports the event `eventID` (externally-stable KSUID) plus the projected column values.

The `functions` field is required — at least one `functionID` or `functionName` must be supplied. `limit` defaults to 50 with a maximum of 200; `offset` is zero-based. The response's `totalCount` reflects the match count before pagination, so paging can be driven off it.

func (*ViewService) Get added in v0.16.0

func (r *ViewService) Get(ctx context.Context, viewID string, opts ...option.RequestOption) (res *ViewGetResponse, err error)

**Retrieve a view by ID.**

Returns the view's current version. To inspect a historical version, fetch the list of versions on the View object and re-request with the desired version pinned (versions are immutable once created).

func (*ViewService) List added in v0.16.0

func (r *ViewService) List(ctx context.Context, query ViewListParams, opts ...option.RequestOption) (res *ViewListResponse, err error)

**List views in the current environment, optionally filtered by the functions they read from.**

Views are tabular projections over `transformations` rows: each view names one or more functions and a list of columns (JSON-pointer paths into `extractedJson`), and produces a uniform table that can be filtered, paginated, and aggregated.

Filters AND together when combined. Pagination is cursor-based on `viewID`; default limit is 50, maximum 100.

func (*ViewService) New added in v0.16.0

func (r *ViewService) New(ctx context.Context, body ViewNewParams, opts ...option.RequestOption) (res *ViewNewResponse, err error)

**Create a view.**

A view is a tabular projection over the `transformations` produced by one or more functions. Each column declares a `valueSchemaPath` — a JSON Pointer path into the function's output schema — and the view can additionally carry filters and aggregations.

Supported for every function type that produces correctable transformations and an output schema: `extract`, `transform`, `analyze`, `join`. Extract works on both vision (PDF/PNG/JPEG/HEIC/HEIF/WebP) and OCR-routed inputs — the resulting rows surface through views uniformly.

The new view is created at `versionNum: 1`. Subsequent updates produce new versions; the version-1 configuration remains addressable.

func (*ViewService) Update added in v0.16.0

func (r *ViewService) Update(ctx context.Context, viewID string, body ViewUpdateParams, opts ...option.RequestOption) (res *ViewUpdateResponse, err error)

**Update a view. Updates create a new version.**

The previous version remains addressable and immutable. The new configuration is fully replacing — pass the complete view body, not a patch. The version number is auto-incremented.

type ViewUpdateParams added in v0.16.0

type ViewUpdateParams struct {
	// List of aggregations defined for the view
	Aggregations []ViewUpdateParamsAggregation `json:"aggregations,omitzero" api:"required"`
	// List of columns in the view
	Columns []ViewUpdateParamsColumn `json:"columns,omitzero" api:"required"`
	// List of filters applied to the view
	Filters []ViewUpdateParamsFilter `json:"filters,omitzero" api:"required"`
	// List of functions that this view queries transformations from
	Functions []ViewUpdateParamsFunction `json:"functions,omitzero" api:"required"`
	// Name of the view
	Name string `json:"name" api:"required"`
	// Description of the view
	Description param.Opt[string] `json:"description,omitzero"`
	// contains filtered or unexported fields
}

func (ViewUpdateParams) MarshalJSON added in v0.16.0

func (r ViewUpdateParams) MarshalJSON() (data []byte, err error)

func (*ViewUpdateParams) UnmarshalJSON added in v0.16.0

func (r *ViewUpdateParams) UnmarshalJSON(data []byte) error

type ViewUpdateParamsAggregation added in v0.16.0

type ViewUpdateParamsAggregation struct {
	// Aggregation function to apply to a view column
	//
	// Any of "count", "count_distinct", "sum", "average", "min", "max".
	Function string `json:"function,omitzero" api:"required"`
	// Name of the aggregation
	Name string `json:"name" api:"required"`
	// Name of the column to aggregate (required for count_distinct, sum, average, min,
	// max functions)
	AggregateColumnName param.Opt[string] `json:"aggregateColumnName,omitzero"`
	// Name of the column to group by (optional, for grouped aggregations)
	GroupByColumnName param.Opt[string] `json:"groupByColumnName,omitzero"`
	// How to display the aggregation results
	//
	// Any of "table", "bar_chart", "pie_chart".
	DisplayType string `json:"displayType,omitzero"`
	// contains filtered or unexported fields
}

An aggregation definition for a view

The properties Function, Name are required.

func (ViewUpdateParamsAggregation) MarshalJSON added in v0.16.0

func (r ViewUpdateParamsAggregation) MarshalJSON() (data []byte, err error)

func (*ViewUpdateParamsAggregation) UnmarshalJSON added in v0.16.0

func (r *ViewUpdateParamsAggregation) UnmarshalJSON(data []byte) error

type ViewUpdateParamsColumn added in v0.16.0

type ViewUpdateParamsColumn struct {
	// Order in which this column should be displayed (0-based index)
	DisplayOrderIndex int64 `json:"displayOrderIndex" api:"required"`
	// Name of the column
	Name string `json:"name" api:"required"`
	// JSON path to the value in the transformation output schema (e.g.,
	// ["invoiceDetails", "invoiceNumber"])
	ValueSchemaPath []string `json:"valueSchemaPath,omitzero" api:"required"`
	// contains filtered or unexported fields
}

A column definition in a view

The properties DisplayOrderIndex, Name, ValueSchemaPath are required.

func (ViewUpdateParamsColumn) MarshalJSON added in v0.16.0

func (r ViewUpdateParamsColumn) MarshalJSON() (data []byte, err error)

func (*ViewUpdateParamsColumn) UnmarshalJSON added in v0.16.0

func (r *ViewUpdateParamsColumn) UnmarshalJSON(data []byte) error

type ViewUpdateParamsFilter added in v0.16.0

type ViewUpdateParamsFilter struct {
	// Name of the column to filter on
	ColumnName string `json:"columnName" api:"required"`
	// Type of filter to apply to a view column
	//
	// Any of "equals_string", "equals_number", "less_than_number",
	// "less_than_equal_number", "greater_than_number", "greater_than_equal_number",
	// "is_null", "is_not_null".
	FilterType string `json:"filterType,omitzero" api:"required"`
	// Numeric value for the filter (required for number filter types)
	Number param.Opt[float64] `json:"number,omitzero"`
	// String value for the filter (required for string filter types)
	String param.Opt[string] `json:"string,omitzero"`
	// contains filtered or unexported fields
}

A filter to apply to a view column

The properties ColumnName, FilterType are required.

func (ViewUpdateParamsFilter) MarshalJSON added in v0.16.0

func (r ViewUpdateParamsFilter) MarshalJSON() (data []byte, err error)

func (*ViewUpdateParamsFilter) UnmarshalJSON added in v0.16.0

func (r *ViewUpdateParamsFilter) UnmarshalJSON(data []byte) error

type ViewUpdateParamsFunction added in v0.16.0

type ViewUpdateParamsFunction struct {
	// Unique identifier of function. Provide either id or name, not both.
	ID param.Opt[string] `json:"id,omitzero"`
	// Name of function. Must be UNIQUE on a per-environment basis. Provide either id
	// or name, not both.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (ViewUpdateParamsFunction) MarshalJSON added in v0.16.0

func (r ViewUpdateParamsFunction) MarshalJSON() (data []byte, err error)

func (*ViewUpdateParamsFunction) UnmarshalJSON added in v0.16.0

func (r *ViewUpdateParamsFunction) UnmarshalJSON(data []byte) error

type ViewUpdateResponse added in v0.16.0

type ViewUpdateResponse struct {
	// List of aggregations defined for the view
	Aggregations []ViewUpdateResponseAggregation `json:"aggregations" api:"required"`
	// List of columns in the view
	Columns []ViewUpdateResponseColumn `json:"columns" api:"required"`
	// Current version number of the view
	CurrentVersionNum int64 `json:"currentVersionNum" api:"required"`
	// List of filters applied to the view
	Filters []ViewUpdateResponseFilter `json:"filters" api:"required"`
	// List of functions that this view queries transformations from
	Functions []ViewUpdateResponseFunction `json:"functions" api:"required"`
	// Name of the view
	Name string `json:"name" api:"required"`
	// Unique identifier of the view
	ViewID string `json:"viewID" api:"required"`
	// Description of the view
	Description string `json:"description" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Aggregations      respjson.Field
		Columns           respjson.Field
		CurrentVersionNum respjson.Field
		Filters           respjson.Field
		Functions         respjson.Field
		Name              respjson.Field
		ViewID            respjson.Field
		Description       respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A view is a table visualization of transformations that allows customers to have insight into their transformations

func (ViewUpdateResponse) RawJSON added in v0.16.0

func (r ViewUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewUpdateResponse) UnmarshalJSON added in v0.16.0

func (r *ViewUpdateResponse) UnmarshalJSON(data []byte) error

type ViewUpdateResponseAggregation added in v0.16.0

type ViewUpdateResponseAggregation struct {
	// Aggregation function to apply to a view column
	//
	// Any of "count", "count_distinct", "sum", "average", "min", "max".
	Function string `json:"function" api:"required"`
	// Name of the aggregation
	Name string `json:"name" api:"required"`
	// Name of the column to aggregate (required for count_distinct, sum, average, min,
	// max functions)
	AggregateColumnName string `json:"aggregateColumnName" api:"nullable"`
	// How to display the aggregation results
	//
	// Any of "table", "bar_chart", "pie_chart".
	DisplayType string `json:"displayType"`
	// Name of the column to group by (optional, for grouped aggregations)
	GroupByColumnName string `json:"groupByColumnName" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Function            respjson.Field
		Name                respjson.Field
		AggregateColumnName respjson.Field
		DisplayType         respjson.Field
		GroupByColumnName   respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An aggregation definition for a view

func (ViewUpdateResponseAggregation) RawJSON added in v0.16.0

Returns the unmodified JSON received from the API

func (*ViewUpdateResponseAggregation) UnmarshalJSON added in v0.16.0

func (r *ViewUpdateResponseAggregation) UnmarshalJSON(data []byte) error

type ViewUpdateResponseColumn added in v0.16.0

type ViewUpdateResponseColumn struct {
	// Order in which this column should be displayed (0-based index)
	DisplayOrderIndex int64 `json:"displayOrderIndex" api:"required"`
	// Name of the column
	Name string `json:"name" api:"required"`
	// JSON path to the value in the transformation output schema (e.g.,
	// ["invoiceDetails", "invoiceNumber"])
	ValueSchemaPath []string `json:"valueSchemaPath" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DisplayOrderIndex respjson.Field
		Name              respjson.Field
		ValueSchemaPath   respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A column definition in a view

func (ViewUpdateResponseColumn) RawJSON added in v0.16.0

func (r ViewUpdateResponseColumn) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewUpdateResponseColumn) UnmarshalJSON added in v0.16.0

func (r *ViewUpdateResponseColumn) UnmarshalJSON(data []byte) error

type ViewUpdateResponseFilter added in v0.16.0

type ViewUpdateResponseFilter struct {
	// Name of the column to filter on
	ColumnName string `json:"columnName" api:"required"`
	// Type of filter to apply to a view column
	//
	// Any of "equals_string", "equals_number", "less_than_number",
	// "less_than_equal_number", "greater_than_number", "greater_than_equal_number",
	// "is_null", "is_not_null".
	FilterType string `json:"filterType" api:"required"`
	// Numeric value for the filter (required for number filter types)
	Number float64 `json:"number" api:"nullable"`
	// String value for the filter (required for string filter types)
	String string `json:"string" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ColumnName  respjson.Field
		FilterType  respjson.Field
		Number      respjson.Field
		String      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A filter to apply to a view column

func (ViewUpdateResponseFilter) RawJSON added in v0.16.0

func (r ViewUpdateResponseFilter) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewUpdateResponseFilter) UnmarshalJSON added in v0.16.0

func (r *ViewUpdateResponseFilter) UnmarshalJSON(data []byte) error

type ViewUpdateResponseFunction added in v0.16.0

type ViewUpdateResponseFunction struct {
	// Unique identifier of function. Provide either id or name, not both.
	ID string `json:"id"`
	// Name of function. Must be UNIQUE on a per-environment basis. Provide either id
	// or name, not both.
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ViewUpdateResponseFunction) RawJSON added in v0.16.0

func (r ViewUpdateResponseFunction) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewUpdateResponseFunction) UnmarshalJSON added in v0.16.0

func (r *ViewUpdateResponseFunction) UnmarshalJSON(data []byte) error

type WebhookSecret added in v0.14.0

type WebhookSecret struct {
	// The signing secret value. Store this securely — it is shown in full only on
	// generation.
	Secret string `json:"secret" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Secret      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Webhook signing secret used to verify `bem-signature` headers on delivered webhooks.

func (WebhookSecret) RawJSON added in v0.14.0

func (r WebhookSecret) RawJSON() string

Returns the unmodified JSON received from the API

func (*WebhookSecret) UnmarshalJSON added in v0.14.0

func (r *WebhookSecret) UnmarshalJSON(data []byte) error

type WebhookSecretService added in v0.9.0

type WebhookSecretService struct {
	// contains filtered or unexported fields
}

bem POSTs a JSON event to your configured webhook URL each time a subscribed function call, workflow output, or collection-processing job fires. This section is the reference for those deliveries: the payload shape per event type, plus the endpoints you use to manage the signing secret.

Every variant shares the same envelope — function/workflow IDs, timestamps, the inbound email that triggered the call, and so on — and adds a payload field that depends on the function type. The `eventType` field on the body is the discriminator: dispatch on it to select which payload shape to expect. SDKs generated from this spec expose a `webhooks.unwrap()` helper that performs the dispatch and returns a typed event.

## Payloads

| `eventType` | Payload | Schema | | ----------------------- | ---------------------------------------------------------------------------- | --------------------------- | | `extract` | [Extract event](/api/v3/webhooks/events/extract) | `ExtractEvent` | | `classify` | [Classify event](/api/v3/webhooks/events/classify) | `ClassifyEvent` | | `parse` | [Parse event](/api/v3/webhooks/events/parse) | `ParseEvent` | | `split_collection` | [Split collection event](/api/v3/webhooks/events/split-collection) | `SplitCollectionEvent` | | `split_item` | [Split item event](/api/v3/webhooks/events/split-item) | `SplitItemEvent` | | `join` | [Join event](/api/v3/webhooks/events/join) | `JoinEvent` | | `enrich` | [Enrich event](/api/v3/webhooks/events/enrich) | `EnrichEvent` | | `payload_shaping` | [Payload shaping event](/api/v3/webhooks/events/payload-shaping) | `PayloadShapingEvent` | | `send` | [Send event](/api/v3/webhooks/events/send) | `SendEvent` | | `evaluation` | [Evaluation event](/api/v3/webhooks/events/evaluation) | `EvaluationEvent` | | `collection_processing` | [Collection processing event](/api/v3/webhooks/events/collection-processing) | `collectionProcessingEvent` | | `error` | [Error event](/api/v3/webhooks/events/error) | `ErrorEvent` |

## Signing secret

Every delivery includes a `bem-signature` header in the format `t={unix_timestamp},v1={hex_hmac_sha256}`. The signature covers `{timestamp}.{raw_request_body}` and is computed with HMAC-SHA256 using the active signing secret for your environment.

To verify a payload:

  1. Parse `bem-signature: t={timestamp},v1={signature}`.
  2. Construct the signed string: `{timestamp}.{raw_request_body}`.
  3. Compute HMAC-SHA256 of that string using your secret.
  4. Reject the request if the hex digest doesn't match `v1`, or if the timestamp is more than a few minutes old.

Manage the secret with these endpoints:

  • [**Generate a signing secret**](/api/v3/webhooks/secret/generate-secret) — `POST /v3/webhook-secret`. Returns the new secret in full exactly once.
  • [**Get the signing secret**](/api/v3/webhooks/secret/get-secret) — `GET /v3/webhook-secret`. Returns the active secret.
  • [**Revoke the signing secret**](/api/v3/webhooks/secret/revoke-secret) — `DELETE /v3/webhook-secret`. Webhook deliveries continue but are unsigned until a new secret is generated.

For zero-downtime rotation, briefly accept both the old and new secret in your verification logic before revoking the old one.

## Retries

bem treats any non-2XX response (or a transport failure) as a delivery error and retries with exponential backoff. Return a 2XX as soon as you have durably queued the payload — do not block on downstream work.

WebhookSecretService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWebhookSecretService method instead.

func NewWebhookSecretService added in v0.9.0

func NewWebhookSecretService(opts ...option.RequestOption) (r WebhookSecretService)

NewWebhookSecretService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*WebhookSecretService) Get added in v0.9.0

func (r *WebhookSecretService) Get(ctx context.Context, opts ...option.RequestOption) (res *WebhookSecret, err error)

**Get the current webhook signing secret.**

Returns the active secret used to sign outbound webhook deliveries via the `bem-signature` header. Returns 404 if no secret has been generated for this environment yet.

Use the secret to verify incoming webhook payloads:

1. Parse `bem-signature: t={timestamp},v1={signature}`. 2. Construct the signed string: `{timestamp}.{raw request body}`. 3. Compute HMAC-SHA256 of that string using the secret. 4. Compare the hex digest against `v1`. 5. Reject requests where the timestamp is more than a few minutes old.

func (*WebhookSecretService) New added in v0.9.0

func (r *WebhookSecretService) New(ctx context.Context, opts ...option.RequestOption) (res *WebhookSecret, err error)

**Generate a new webhook signing secret.**

Creates a new signing secret for this environment (or replaces the existing one). The new secret is returned in full exactly once — store it securely.

After rotation all newly delivered webhooks will be signed with the new secret. Update your verification logic before calling this endpoint if you need zero-downtime rotation.

func (*WebhookSecretService) Revoke added in v0.9.0

func (r *WebhookSecretService) Revoke(ctx context.Context, opts ...option.RequestOption) (err error)

**Revoke the current webhook signing secret.**

Deletes the active signing secret. Webhook deliveries will continue but will no longer include a `bem-signature` header until a new secret is generated.

type WebhookService added in v0.14.0

type WebhookService struct {
	// contains filtered or unexported fields
}

WebhookService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWebhookService method instead.

func NewWebhookService added in v0.14.0

func NewWebhookService(opts ...option.RequestOption) (r WebhookService)

NewWebhookService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*WebhookService) Unwrap added in v0.14.0

func (r *WebhookService) Unwrap(payload []byte, opts ...option.RequestOption) (*UnwrapWebhookEventUnion, error)

type Workflow

type Workflow struct {
	// Unique identifier of the workflow.
	ID string `json:"id" api:"required"`
	// Connectors currently attached to this workflow. For version-scoped reads
	// (`/versions/{n}`) this is always empty — connectors are current-state and not
	// part of version history.
	Connectors []WorkflowConnector `json:"connectors" api:"required"`
	// The date and time the workflow was created.
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// All directed edges in this workflow version's DAG.
	Edges []WorkflowEdgeResponse `json:"edges" api:"required"`
	// Name of the entry-point call-site node.
	MainNodeName string `json:"mainNodeName" api:"required"`
	// Unique name of the workflow within the environment.
	Name string `json:"name" api:"required"`
	// All call-site nodes in this workflow version's DAG.
	Nodes []WorkflowNodeResponse `json:"nodes" api:"required"`
	// The date and time the workflow was last updated.
	UpdatedAt time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// Version number of this workflow version.
	VersionNum int64 `json:"versionNum" api:"required"`
	// Audit trail information.
	Audit WorkflowAudit `json:"audit"`
	// Human-readable display name.
	DisplayName string `json:"displayName"`
	// Inbound email address associated with the workflow, if any.
	EmailAddress string `json:"emailAddress"`
	// Tags associated with the workflow.
	Tags []string `json:"tags"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		Connectors   respjson.Field
		CreatedAt    respjson.Field
		Edges        respjson.Field
		MainNodeName respjson.Field
		Name         respjson.Field
		Nodes        respjson.Field
		UpdatedAt    respjson.Field
		VersionNum   respjson.Field
		Audit        respjson.Field
		DisplayName  respjson.Field
		EmailAddress respjson.Field
		Tags         respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

V3 read representation of a workflow version.

func (Workflow) RawJSON

func (r Workflow) RawJSON() string

Returns the unmodified JSON received from the API

func (*Workflow) UnmarshalJSON

func (r *Workflow) UnmarshalJSON(data []byte) error

type WorkflowAudit

type WorkflowAudit struct {
	// Information about who created the current version.
	VersionCreatedBy UserActionSummary `json:"versionCreatedBy"`
	// Information about who created the workflow.
	WorkflowCreatedBy UserActionSummary `json:"workflowCreatedBy"`
	// Information about who last updated the workflow.
	WorkflowLastUpdatedBy UserActionSummary `json:"workflowLastUpdatedBy"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		VersionCreatedBy      respjson.Field
		WorkflowCreatedBy     respjson.Field
		WorkflowLastUpdatedBy respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowAudit) RawJSON

func (r WorkflowAudit) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowAudit) UnmarshalJSON

func (r *WorkflowAudit) UnmarshalJSON(data []byte) error

type WorkflowCallParams

type WorkflowCallParams struct {
	// Input file(s) for a call. Provide exactly one of `singleFile` or `batchFiles`.
	//
	// In the CLI, use the nested flags `--input.single-file` or `--input.batch-files`
	// with `@path/to/file` for automatic file embedding:
	// `--input.single-file '{"inputContent": "@invoice.pdf", "inputType": "pdf"}' --wait`
	Input WorkflowCallParamsInput `json:"input,omitzero" api:"required"`
	// Block until the call completes (up to 30 seconds) and return the finished call
	// object. Default: `false`. This is a boolean flag — use `--wait` or
	// `--wait=true`, not `--wait true`.
	Wait param.Opt[bool] `query:"wait,omitzero" json:"-"`
	// Your reference ID for tracking this call.
	CallReferenceID param.Opt[string] `json:"callReferenceID,omitzero"`
	// Arbitrary JSON object attached to this call. Stored on the call record and
	// injected into `transformedContent` under the reserved `_metadata` key (alongside
	// `referenceID`). Must be a JSON object. Maximum size: 4 KB.
	Metadata any `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

func (WorkflowCallParams) MarshalJSON

func (r WorkflowCallParams) MarshalJSON() (data []byte, err error)

func (WorkflowCallParams) URLQuery

func (r WorkflowCallParams) URLQuery() (v url.Values, err error)

URLQuery serializes WorkflowCallParams's query parameters as `url.Values`.

func (*WorkflowCallParams) UnmarshalJSON

func (r *WorkflowCallParams) UnmarshalJSON(data []byte) error

type WorkflowCallParamsInput

type WorkflowCallParamsInput struct {
	// Multiple files to process in one call. Each item in the `inputs` array has its
	// own `inputContent` and `inputType`.
	BatchFiles WorkflowCallParamsInputBatchFiles `json:"batchFiles,omitzero"`
	// A single file input with base64-encoded content.
	//
	// When using the Bem CLI, use `@path/to/file` in the `inputContent` field to
	// automatically read and base64-encode the file:
	// `--input.single-file '{"inputContent": "@file.pdf", "inputType": "pdf"}' --wait`
	SingleFile WorkflowCallParamsInputSingleFile `json:"singleFile,omitzero"`
	// contains filtered or unexported fields
}

Input file(s) for a call. Provide exactly one of `singleFile` or `batchFiles`.

In the CLI, use the nested flags `--input.single-file` or `--input.batch-files` with `@path/to/file` for automatic file embedding: `--input.single-file '{"inputContent": "@invoice.pdf", "inputType": "pdf"}' --wait`

func (WorkflowCallParamsInput) MarshalJSON

func (r WorkflowCallParamsInput) MarshalJSON() (data []byte, err error)

func (*WorkflowCallParamsInput) UnmarshalJSON

func (r *WorkflowCallParamsInput) UnmarshalJSON(data []byte) error

type WorkflowCallParamsInputBatchFiles

type WorkflowCallParamsInputBatchFiles struct {
	Inputs []WorkflowCallParamsInputBatchFilesInput `json:"inputs,omitzero"`
	// contains filtered or unexported fields
}

Multiple files to process in one call. Each item in the `inputs` array has its own `inputContent` and `inputType`.

func (WorkflowCallParamsInputBatchFiles) MarshalJSON

func (r WorkflowCallParamsInputBatchFiles) MarshalJSON() (data []byte, err error)

func (*WorkflowCallParamsInputBatchFiles) UnmarshalJSON

func (r *WorkflowCallParamsInputBatchFiles) UnmarshalJSON(data []byte) error

type WorkflowCallParamsInputBatchFilesInput

type WorkflowCallParamsInputBatchFilesInput struct {
	// Base64-encoded file content. In the Bem CLI, use `@path/to/file` to embed file
	// contents automatically.
	InputContent string `json:"inputContent" api:"required"`
	// The input type of the content you're sending for transformation.
	//
	// Any of "csv", "docx", "email", "heic", "html", "jpeg", "json", "heif", "m4a",
	// "mp3", "pdf", "png", "text", "wav", "webp", "xls", "xlsx", "xml".
	InputType       InputType         `json:"inputType,omitzero" api:"required"`
	ItemReferenceID param.Opt[string] `json:"itemReferenceID,omitzero"`
	// contains filtered or unexported fields
}

The properties InputContent, InputType are required.

func (WorkflowCallParamsInputBatchFilesInput) MarshalJSON

func (r WorkflowCallParamsInputBatchFilesInput) MarshalJSON() (data []byte, err error)

func (*WorkflowCallParamsInputBatchFilesInput) UnmarshalJSON

func (r *WorkflowCallParamsInputBatchFilesInput) UnmarshalJSON(data []byte) error

type WorkflowCallParamsInputSingleFile

type WorkflowCallParamsInputSingleFile struct {
	// Base64-encoded file content. In the Bem CLI, use `@path/to/file` to embed file
	// contents automatically.
	InputContent string `json:"inputContent" api:"required"`
	// The input type of the content you're sending for transformation.
	//
	// Any of "csv", "docx", "email", "heic", "html", "jpeg", "json", "heif", "m4a",
	// "mp3", "pdf", "png", "text", "wav", "webp", "xls", "xlsx", "xml".
	InputType InputType `json:"inputType,omitzero" api:"required"`
	// contains filtered or unexported fields
}

A single file input with base64-encoded content.

When using the Bem CLI, use `@path/to/file` in the `inputContent` field to automatically read and base64-encode the file: `--input.single-file '{"inputContent": "@file.pdf", "inputType": "pdf"}' --wait`

The properties InputContent, InputType are required.

func (WorkflowCallParamsInputSingleFile) MarshalJSON

func (r WorkflowCallParamsInputSingleFile) MarshalJSON() (data []byte, err error)

func (*WorkflowCallParamsInputSingleFile) UnmarshalJSON

func (r *WorkflowCallParamsInputSingleFile) UnmarshalJSON(data []byte) error

type WorkflowConnector added in v0.7.0

type WorkflowConnector struct {
	// Unique connector API ID.
	ConnectorID string `json:"connectorID" api:"required"`
	// Human-friendly connector name.
	Name string `json:"name" api:"required"`
	// Discriminator for a workflow connector. V3 supports `paragon` only.
	//
	// Any of "paragon".
	Type WorkflowConnectorType `json:"type" api:"required"`
	// Paragon-integration configuration on a workflow connector.
	Paragon WorkflowConnectorParagon `json:"paragon"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConnectorID respjson.Field
		Name        respjson.Field
		Type        respjson.Field
		Paragon     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A connector attached to a workflow. Ingestion point that triggers the workflow.

func (WorkflowConnector) RawJSON added in v0.7.0

func (r WorkflowConnector) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowConnector) UnmarshalJSON added in v0.7.0

func (r *WorkflowConnector) UnmarshalJSON(data []byte) error

type WorkflowConnectorError added in v0.14.0

type WorkflowConnectorError struct {
	// Machine-readable error code.
	Code string `json:"code" api:"required"`
	// Human-readable error message.
	Message string `json:"message" api:"required"`
	// Which diff operation was attempted.
	//
	// Any of "create", "update", "delete".
	Operation WorkflowConnectorErrorOperation `json:"operation" api:"required"`
	// Populated for update/delete failures.
	ConnectorID string `json:"connectorID"`
	// Populated for create failures.
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Code        respjson.Field
		Message     respjson.Field
		Operation   respjson.Field
		ConnectorID respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Per-connector failure surfaced alongside a successful workflow DAG save.

func (WorkflowConnectorError) RawJSON added in v0.14.0

func (r WorkflowConnectorError) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowConnectorError) UnmarshalJSON added in v0.14.0

func (r *WorkflowConnectorError) UnmarshalJSON(data []byte) error

type WorkflowConnectorErrorOperation added in v0.14.0

type WorkflowConnectorErrorOperation string

Which diff operation was attempted.

const (
	WorkflowConnectorErrorOperationCreate WorkflowConnectorErrorOperation = "create"
	WorkflowConnectorErrorOperationUpdate WorkflowConnectorErrorOperation = "update"
	WorkflowConnectorErrorOperationDelete WorkflowConnectorErrorOperation = "delete"
)

type WorkflowConnectorParagon added in v0.7.0

type WorkflowConnectorParagon struct {
	// Opaque per-integration configuration (e.g. `{"folderId": "..."}`).
	Configuration any `json:"configuration" api:"required"`
	// Paragon integration key (e.g. "googledrive").
	Integration string `json:"integration" api:"required"`
	// Paragon sync ID managed by the server. Read-only.
	SyncID string `json:"syncID" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Configuration respjson.Field
		Integration   respjson.Field
		SyncID        respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Paragon-integration configuration on a workflow connector.

func (WorkflowConnectorParagon) RawJSON added in v0.7.0

func (r WorkflowConnectorParagon) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowConnectorParagon) UnmarshalJSON added in v0.7.0

func (r *WorkflowConnectorParagon) UnmarshalJSON(data []byte) error

type WorkflowConnectorParagonParam added in v0.14.0

type WorkflowConnectorParagonParam struct {
	// Paragon integration key. Required on create.
	Integration param.Opt[string] `json:"integration,omitzero"`
	// Opaque per-integration configuration. Required on create.
	Configuration any `json:"configuration,omitzero"`
	// contains filtered or unexported fields
}

Request-side config block for a Paragon connector. Fields absent on update are unchanged.

func (WorkflowConnectorParagonParam) MarshalJSON added in v0.14.0

func (r WorkflowConnectorParagonParam) MarshalJSON() (data []byte, err error)

func (*WorkflowConnectorParagonParam) UnmarshalJSON added in v0.14.0

func (r *WorkflowConnectorParagonParam) UnmarshalJSON(data []byte) error

type WorkflowConnectorParam added in v0.14.0

type WorkflowConnectorParam struct {
	// Human-friendly connector name.
	Name string `json:"name" api:"required"`
	// Discriminator for a workflow connector. V3 supports `paragon` only.
	//
	// Any of "paragon".
	Type WorkflowConnectorType `json:"type,omitzero" api:"required"`
	// Present → update. Absent → create.
	ConnectorID param.Opt[string] `json:"connectorID,omitzero"`
	// Request-side config block for a Paragon connector. Fields absent on update are
	// unchanged.
	Paragon WorkflowConnectorParagonParam `json:"paragon,omitzero"`
	// contains filtered or unexported fields
}

Create/update entry for a connector inline with the workflow.

The properties Name, Type are required.

func (WorkflowConnectorParam) MarshalJSON added in v0.14.0

func (r WorkflowConnectorParam) MarshalJSON() (data []byte, err error)

func (*WorkflowConnectorParam) UnmarshalJSON added in v0.14.0

func (r *WorkflowConnectorParam) UnmarshalJSON(data []byte) error

type WorkflowConnectorType added in v0.14.0

type WorkflowConnectorType string

Discriminator for a workflow connector. V3 supports `paragon` only.

const (
	WorkflowConnectorTypeParagon WorkflowConnectorType = "paragon"
)

type WorkflowCopyParams

type WorkflowCopyParams struct {
	// Name of the source workflow to copy from.
	SourceWorkflowName string `json:"sourceWorkflowName" api:"required"`
	// Name for the new copied workflow. Must be unique within the target environment.
	TargetWorkflowName string `json:"targetWorkflowName" api:"required"`
	// Optional version number of the source workflow to copy. If not provided, copies
	// the current version.
	SourceWorkflowVersionNum param.Opt[int64] `json:"sourceWorkflowVersionNum,omitzero"`
	// Optional display name for the copied workflow. If not provided, uses the source
	// workflow's display name with " (Copy)" appended.
	TargetDisplayName param.Opt[string] `json:"targetDisplayName,omitzero"`
	// Optional target environment name. If provided, copies the workflow to a
	// different environment. When copying to a different environment, all functions
	// used in the workflow will also be copied.
	TargetEnvironment param.Opt[string] `json:"targetEnvironment,omitzero"`
	// Optional tags for the copied workflow. If not provided, uses the source
	// workflow's tags.
	Tags []string `json:"tags,omitzero"`
	// contains filtered or unexported fields
}

func (WorkflowCopyParams) MarshalJSON

func (r WorkflowCopyParams) MarshalJSON() (data []byte, err error)

func (*WorkflowCopyParams) UnmarshalJSON

func (r *WorkflowCopyParams) UnmarshalJSON(data []byte) error

type WorkflowCopyResponse

type WorkflowCopyResponse struct {
	// Functions that were copied when copying to a different environment. Empty when
	// copying within the same environment.
	CopiedFunctions []WorkflowCopyResponseCopiedFunction `json:"copiedFunctions"`
	// The environment the workflow was copied to.
	Environment string `json:"environment"`
	// Error message if the workflow copy failed.
	Error string `json:"error"`
	// V3 read representation of a workflow version.
	Workflow Workflow `json:"workflow"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CopiedFunctions respjson.Field
		Environment     respjson.Field
		Error           respjson.Field
		Workflow        respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowCopyResponse) RawJSON

func (r WorkflowCopyResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowCopyResponse) UnmarshalJSON

func (r *WorkflowCopyResponse) UnmarshalJSON(data []byte) error

type WorkflowCopyResponseCopiedFunction

type WorkflowCopyResponseCopiedFunction struct {
	// ID of the source function that was copied.
	SourceFunctionID string `json:"sourceFunctionID" api:"required"`
	// Name of the source function that was copied.
	SourceFunctionName string `json:"sourceFunctionName" api:"required"`
	// Version number of the source function that was copied.
	SourceVersionNum int64 `json:"sourceVersionNum" api:"required"`
	// ID of the newly created function in the target environment.
	TargetFunctionID string `json:"targetFunctionID" api:"required"`
	// Name of the newly created function in the target environment.
	TargetFunctionName string `json:"targetFunctionName" api:"required"`
	// Version number of the newly created function in the target environment.
	TargetVersionNum int64 `json:"targetVersionNum" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SourceFunctionID   respjson.Field
		SourceFunctionName respjson.Field
		SourceVersionNum   respjson.Field
		TargetFunctionID   respjson.Field
		TargetFunctionName respjson.Field
		TargetVersionNum   respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowCopyResponseCopiedFunction) RawJSON

Returns the unmodified JSON received from the API

func (*WorkflowCopyResponseCopiedFunction) UnmarshalJSON

func (r *WorkflowCopyResponseCopiedFunction) UnmarshalJSON(data []byte) error

type WorkflowEdgeParam added in v0.14.0

type WorkflowEdgeParam struct {
	// Name of the destination node.
	DestinationNodeName string `json:"destinationNodeName" api:"required"`
	// Name of the source node.
	SourceNodeName string `json:"sourceNodeName" api:"required"`
	// Labelled outlet on the source node that activates this edge. Omit for the
	// default (unlabelled) outlet.
	DestinationName param.Opt[string] `json:"destinationName,omitzero"`
	// Opaque free-form JSON object attached to this edge. Stored and returned
	// verbatim; the server does not interpret it.
	Metadata any `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

A directed edge between two named call-site nodes.

The properties DestinationNodeName, SourceNodeName are required.

func (WorkflowEdgeParam) MarshalJSON added in v0.14.0

func (r WorkflowEdgeParam) MarshalJSON() (data []byte, err error)

func (*WorkflowEdgeParam) UnmarshalJSON added in v0.14.0

func (r *WorkflowEdgeParam) UnmarshalJSON(data []byte) error

type WorkflowEdgeResponse

type WorkflowEdgeResponse struct {
	// Name of the destination node.
	DestinationNodeName string `json:"destinationNodeName" api:"required"`
	// Name of the source node.
	SourceNodeName string `json:"sourceNodeName" api:"required"`
	// Labelled outlet on the source node, if any.
	DestinationName string `json:"destinationName"`
	// Opaque free-form JSON object attached to this edge on create/update. Returned
	// verbatim; never interpreted by the server.
	Metadata any `json:"metadata"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DestinationNodeName respjson.Field
		SourceNodeName      respjson.Field
		DestinationName     respjson.Field
		Metadata            respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Read representation of a directed edge between call-site nodes.

func (WorkflowEdgeResponse) RawJSON

func (r WorkflowEdgeResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowEdgeResponse) UnmarshalJSON

func (r *WorkflowEdgeResponse) UnmarshalJSON(data []byte) error

type WorkflowGetResponse

type WorkflowGetResponse struct {
	// Error message if the workflow retrieval failed.
	Error string `json:"error"`
	// V3 read representation of a workflow version.
	Workflow Workflow `json:"workflow"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Error       respjson.Field
		Workflow    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowGetResponse) RawJSON

func (r WorkflowGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowGetResponse) UnmarshalJSON

func (r *WorkflowGetResponse) UnmarshalJSON(data []byte) error

type WorkflowListParams

type WorkflowListParams struct {
	DisplayName   param.Opt[string] `query:"displayName,omitzero" json:"-"`
	EndingBefore  param.Opt[string] `query:"endingBefore,omitzero" json:"-"`
	Limit         param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	StartingAfter param.Opt[string] `query:"startingAfter,omitzero" json:"-"`
	FunctionIDs   []string          `query:"functionIDs,omitzero" json:"-"`
	FunctionNames []string          `query:"functionNames,omitzero" json:"-"`
	// Any of "asc", "desc".
	SortOrder     WorkflowListParamsSortOrder `query:"sortOrder,omitzero" json:"-"`
	Tags          []string                    `query:"tags,omitzero" json:"-"`
	WorkflowIDs   []string                    `query:"workflowIDs,omitzero" json:"-"`
	WorkflowNames []string                    `query:"workflowNames,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (WorkflowListParams) URLQuery

func (r WorkflowListParams) URLQuery() (v url.Values, err error)

URLQuery serializes WorkflowListParams's query parameters as `url.Values`.

type WorkflowListParamsSortOrder

type WorkflowListParamsSortOrder string
const (
	WorkflowListParamsSortOrderAsc  WorkflowListParamsSortOrder = "asc"
	WorkflowListParamsSortOrderDesc WorkflowListParamsSortOrder = "desc"
)

type WorkflowNewParams

type WorkflowNewParams struct {
	// Name of the entry-point node. Must not be a destination of any edge.
	MainNodeName string `json:"mainNodeName" api:"required"`
	// Unique name for the workflow. Must match `^[a-zA-Z0-9_-]{1,128}$`.
	Name string `json:"name" api:"required"`
	// Call-site nodes in the DAG. At least one is required.
	Nodes []WorkflowNodeParam `json:"nodes,omitzero" api:"required"`
	// Human-readable display name.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// Connectors to attach to the workflow at creation. If any entry fails to
	// provision, the entire workflow creation is rolled back.
	Connectors []WorkflowConnectorParam `json:"connectors,omitzero"`
	// Directed edges between nodes. Omit or leave empty for single-node workflows.
	Edges []WorkflowEdgeParam `json:"edges,omitzero"`
	// Tags to categorize and organize the workflow.
	Tags []string `json:"tags,omitzero"`
	// contains filtered or unexported fields
}

func (WorkflowNewParams) MarshalJSON

func (r WorkflowNewParams) MarshalJSON() (data []byte, err error)

func (*WorkflowNewParams) UnmarshalJSON

func (r *WorkflowNewParams) UnmarshalJSON(data []byte) error

type WorkflowNewResponseEnvelope added in v0.8.0

type WorkflowNewResponseEnvelope struct {
	// Per-connector failures from the diff/apply phase. Empty or omitted when all
	// operations succeeded.
	ConnectorErrors []WorkflowConnectorError `json:"connectorErrors"`
	// Error message if the workflow creation failed.
	Error string `json:"error"`
	// V3 read representation of a workflow version.
	Workflow Workflow `json:"workflow"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConnectorErrors respjson.Field
		Error           respjson.Field
		Workflow        respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowNewResponseEnvelope) RawJSON added in v0.8.0

func (r WorkflowNewResponseEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowNewResponseEnvelope) UnmarshalJSON added in v0.8.0

func (r *WorkflowNewResponseEnvelope) UnmarshalJSON(data []byte) error

type WorkflowNodeParam added in v0.14.0

type WorkflowNodeParam struct {
	// The function (and version) to execute at this call site.
	Function FunctionVersionIdentifierParam `json:"function,omitzero" api:"required"`
	// Name for this call site. Must be unique within the workflow version. Defaults to
	// the function's own name when omitted.
	Name param.Opt[string] `json:"name,omitzero"`
	// Opaque free-form JSON object attached to this node. Stored and returned
	// verbatim; the server does not interpret it. Intended for client-side concerns
	// such as canvas display properties (position, color, collapsed state, etc.).
	Metadata any `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

A single function call-site node in a workflow DAG.

The property Function is required.

func (WorkflowNodeParam) MarshalJSON added in v0.14.0

func (r WorkflowNodeParam) MarshalJSON() (data []byte, err error)

func (*WorkflowNodeParam) UnmarshalJSON added in v0.14.0

func (r *WorkflowNodeParam) UnmarshalJSON(data []byte) error

type WorkflowNodeResponse

type WorkflowNodeResponse struct {
	// Function (and version) executing at this call site.
	Function FunctionVersionIdentifier `json:"function" api:"required"`
	// Name of this call site, unique within the workflow version.
	Name string `json:"name" api:"required"`
	// Opaque free-form JSON object attached to this node on create/update. Returned
	// verbatim; never interpreted by the server.
	Metadata any `json:"metadata"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Function    respjson.Field
		Name        respjson.Field
		Metadata    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Read representation of a call-site node.

func (WorkflowNodeResponse) RawJSON

func (r WorkflowNodeResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowNodeResponse) UnmarshalJSON

func (r *WorkflowNodeResponse) UnmarshalJSON(data []byte) error

type WorkflowService

type WorkflowService struct {

	// Workflows orchestrate one or more functions into a directed acyclic graph (DAG)
	// for document processing.
	//
	// Use these endpoints to create, update, list, and manage workflows, and to invoke
	// them with file input via `POST /v3/workflows/{workflowName}/call`.
	//
	// The call endpoint accepts files as either multipart form data or JSON with
	// base64-encoded content. In the Bem CLI, use `@path/to/file` inside JSON values
	// to automatically read and encode files:
	//
	// “`
	//
	//	bem workflows call --workflow-name my-workflow \
	//	  --input.single-file '{"inputContent": "@file.pdf", "inputType": "pdf"}' \
	//	  --wait
	//
	// “`
	Versions WorkflowVersionService
	// contains filtered or unexported fields
}

Workflows orchestrate one or more functions into a directed acyclic graph (DAG) for document processing.

Use these endpoints to create, update, list, and manage workflows, and to invoke them with file input via `POST /v3/workflows/{workflowName}/call`.

The call endpoint accepts files as either multipart form data or JSON with base64-encoded content. In the Bem CLI, use `@path/to/file` inside JSON values to automatically read and encode files:

```

bem workflows call --workflow-name my-workflow \
  --input.single-file '{"inputContent": "@file.pdf", "inputType": "pdf"}' \
  --wait

```

WorkflowService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWorkflowService method instead.

func NewWorkflowService

func NewWorkflowService(opts ...option.RequestOption) (r WorkflowService)

NewWorkflowService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*WorkflowService) Call

func (r *WorkflowService) Call(ctx context.Context, workflowName string, params WorkflowCallParams, opts ...option.RequestOption) (res *CallGetResponse, err error)

**Invoke a workflow.**

Submit the input file as either a multipart form request or a JSON request with base64-encoded file content. The workflow name is derived from the URL path.

## Input Formats

  • **Multipart form** (`multipart/form-data`): attach the file directly via the `file` or `files` fields. Set `wait` in the form body to control synchronous behaviour.
  • **JSON** (`application/json`): base64-encode the file content and set it in `input.singleFile.inputContent` or `input.batchFiles.inputs[*].inputContent`. Pass `wait=true` as a query parameter to control synchronous behaviour.

## Synchronous vs Asynchronous

By default the call is created asynchronously and this endpoint returns `202 Accepted` immediately with a `pending` call object. Set `wait` to `true` to block until the call completes (up to 30 seconds):

  • On success: returns `200 OK` with the completed call, `outputs` populated
  • On failure: returns `500 Internal Server Error` with the call and an `error` message
  • On timeout: returns `202 Accepted` with the still-running call

## Tracking

Poll `GET /v3/calls/{callID}` to check status, or configure a webhook subscription to receive events when the call finishes.

## CLI Usage

Use `@path/to/file` inside JSON string values to embed file contents automatically. Binary files (PDF, images, audio) are base64-encoded; text files are embedded as strings.

Single file (synchronous):

```bash

bem workflows call \
  --workflow-name my-workflow \
  --input.single-file '{"inputContent": "@invoice.pdf", "inputType": "pdf"}' \
  --wait

```

Single file (asynchronous, returns callID immediately):

```bash

bem workflows call \
  --workflow-name my-workflow \
  --input.single-file '{"inputContent": "@invoice.pdf", "inputType": "pdf"}'

```

Batch files:

```bash

bem workflows call \
  --workflow-name my-workflow \
  --input.batch-files '{"inputs": [{"inputContent": "@a.pdf", "inputType": "pdf"}, {"inputContent": "@b.png", "inputType": "png"}]}'

```

Alternative: pass the full `--input` flag as JSON:

```bash

bem workflows call \
  --workflow-name my-workflow \
  --input '{"singleFile": {"inputContent": "@invoice.pdf", "inputType": "pdf"}}' \
  --wait

```

**Important:** `--wait` is a boolean flag. Use `--wait` or `--wait=true`. Do **not** use `--wait true` (with a space) — the `true` will be parsed as an unexpected positional argument.

Supported `inputType` values: csv, docx, email, heic, heif, html, jpeg, json, m4a, mp3, pdf, png, text, wav, webp, xls, xlsx, xml.

func (*WorkflowService) Copy

**Copy a workflow to a new name.**

Forks the source workflow's current version into a brand-new workflow at `versionNum: 1`. The full node graph and edges are carried over, but the _functions_ the copied nodes reference are shared, not duplicated — both workflows now point at the same functions.

Useful for forking a production workflow to test a topology change without disturbing the live caller.

func (*WorkflowService) Delete

func (r *WorkflowService) Delete(ctx context.Context, workflowName string, opts ...option.RequestOption) (err error)

**Delete a workflow and every one of its versions.**

Permanent. Running and queued calls against this workflow continue to completion against the version they captured at call time; subsequent attempts to call the workflow return `404 Not Found`.

Functions referenced by the deleted workflow are not removed — they remain available to other workflows or for direct reference.

func (*WorkflowService) Get

func (r *WorkflowService) Get(ctx context.Context, workflowName string, opts ...option.RequestOption) (res *WorkflowGetResponse, err error)

**Retrieve a workflow's current version by name.**

Returns the full workflow record: `currentVersionNum`, `mainNodeName`, the `nodes` array (with each node's function reference and pinned `versionNum` if any), and the `edges` array. To inspect a historical version, use `GET /v3/workflows/{workflowName}/versions/{versionNum}`.

func (*WorkflowService) List

**List workflows in the current environment.**

Returns each workflow's current version, including its node graph and main node. Combine filters freely — they AND together.

## Filtering

  • `workflowIDs` / `workflowNames`: exact-match identity filters.
  • `displayName`: case-insensitive substring match.
  • `tags`: returns workflows tagged with any of the supplied tags.
  • `functionIDs` / `functionNames`: returns only workflows that reference the named functions in any node. Useful for "which workflows depend on this function?" lookups before changing or deleting a function.

## Pagination

Cursor-based with `startingAfter` and `endingBefore` (workflowIDs). Default limit 50, maximum 100.

func (*WorkflowService) ListAutoPaging

**List workflows in the current environment.**

Returns each workflow's current version, including its node graph and main node. Combine filters freely — they AND together.

## Filtering

  • `workflowIDs` / `workflowNames`: exact-match identity filters.
  • `displayName`: case-insensitive substring match.
  • `tags`: returns workflows tagged with any of the supplied tags.
  • `functionIDs` / `functionNames`: returns only workflows that reference the named functions in any node. Useful for "which workflows depend on this function?" lookups before changing or deleting a function.

## Pagination

Cursor-based with `startingAfter` and `endingBefore` (workflowIDs). Default limit 50, maximum 100.

func (*WorkflowService) New

func (r *WorkflowService) New(ctx context.Context, body WorkflowNewParams, opts ...option.RequestOption) (res *Workflow, err error)

**Create a workflow.**

A workflow is a directed acyclic graph of nodes (each pointing at a function) with one entry point (`mainNodeName`). The graph runs end-to-end on every call.

## Required structure

  • `name`: unique within the environment, alphanumeric plus hyphens and underscores.
  • `mainNodeName`: must match one of the `nodes[].name` values, and must not be the destination of any edge.
  • `nodes`: at least one. Each node has a unique `name` and a `function` reference (by `functionName` or `functionID`, optionally pinned to a `versionNum`).
  • `edges`: optional for single-node workflows. For branching sources (Classify, semantic Split), each edge carries a `destinationName` matching a `classifications[].name` or `itemClasses[].name` on the source function.

The created workflow is at `versionNum: 1`. Subsequent `PATCH /v3/workflows/{workflowName}` calls produce new versions.

## Common patterns

  • **Single-node**: one extract/classify function, no edges.
  • **Sequential**: extract → enrich → payload_shaping (linear edges).
  • **Branching**: classify → multiple extracts (one edge per classification name).
  • **Split-then-process**: split → multiple extracts (one edge per item class).

See [Workflows explained](/guide/workflows-explained) for end-to-end examples of each pattern.

func (*WorkflowService) Update

func (r *WorkflowService) Update(ctx context.Context, workflowName string, body WorkflowUpdateParams, opts ...option.RequestOption) (res *WorkflowUpdateResponse, err error)

**Update a workflow. Updates create a new version.**

The previous version remains addressable and immutable. Pending and running calls captured at the old version continue against it; new calls run against the new version.

## Topology updates

To change the graph you must provide `mainNodeName`, `nodes`, AND `edges` together — partial topology updates are rejected. The full graph is replaced atomically.

## Metadata-only updates

Omit all three fields to update only `displayName`, `tags`, or `name` while keeping the topology of the current version.

## Reverting

To roll back, fetch the desired prior version and resubmit its `mainNodeName`/`nodes`/`edges` as a new update. Versions themselves are immutable — there is no "pin to version N" operation at the workflow level (use `nodes[].function.versionNum` to pin individual functions).

type WorkflowUpdateParams

type WorkflowUpdateParams struct {
	// Human-readable display name.
	DisplayName param.Opt[string] `json:"displayName,omitzero"`
	// `mainNodeName`, `nodes`, and `edges` must be provided together to update the DAG
	// topology. If none are provided the topology is copied unchanged from the current
	// version.
	MainNodeName param.Opt[string] `json:"mainNodeName,omitzero"`
	// New name for the workflow (renames it). Must match `^[a-zA-Z0-9_-]{1,128}$`.
	Name param.Opt[string] `json:"name,omitzero"`
	// Declarative, full-desired-state array of connectors. If omitted, existing
	// connectors are left unchanged. If provided, it replaces the current set: entries
	// with `connectorID` are updates, entries without are creates, and existing
	// connectors whose `connectorID` is absent are deleted.
	Connectors []WorkflowConnectorParam `json:"connectors,omitzero"`
	Edges      []WorkflowEdgeParam      `json:"edges,omitzero"`
	Nodes      []WorkflowNodeParam      `json:"nodes,omitzero"`
	// Tags to categorize and organize the workflow.
	Tags []string `json:"tags,omitzero"`
	// contains filtered or unexported fields
}

func (WorkflowUpdateParams) MarshalJSON

func (r WorkflowUpdateParams) MarshalJSON() (data []byte, err error)

func (*WorkflowUpdateParams) UnmarshalJSON

func (r *WorkflowUpdateParams) UnmarshalJSON(data []byte) error

type WorkflowUpdateResponse

type WorkflowUpdateResponse struct {
	// Per-connector failures from the diff/apply phase. Empty or omitted when all
	// operations succeeded.
	ConnectorErrors []WorkflowConnectorError `json:"connectorErrors"`
	// Error message if the workflow update failed.
	Error string `json:"error"`
	// V3 read representation of a workflow version.
	Workflow Workflow `json:"workflow"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConnectorErrors respjson.Field
		Error           respjson.Field
		Workflow        respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowUpdateResponse) RawJSON

func (r WorkflowUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowUpdateResponse) UnmarshalJSON

func (r *WorkflowUpdateResponse) UnmarshalJSON(data []byte) error

type WorkflowUsageInfo

type WorkflowUsageInfo struct {
	// Current version number of workflow, provided for reference - compare to
	// usedInWorkflowVersionNums to see whether the current version of the workflow
	// uses this function version.
	CurrentVersionNum int64 `json:"currentVersionNum" api:"required"`
	// Version numbers of workflows that this function version is used in.
	UsedInWorkflowVersionNums []int64 `json:"usedInWorkflowVersionNums" api:"required"`
	// Unique identifier of workflow.
	WorkflowID string `json:"workflowID" api:"required"`
	// Name of workflow.
	WorkflowName string `json:"workflowName" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CurrentVersionNum         respjson.Field
		UsedInWorkflowVersionNums respjson.Field
		WorkflowID                respjson.Field
		WorkflowName              respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowUsageInfo) RawJSON

func (r WorkflowUsageInfo) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowUsageInfo) UnmarshalJSON

func (r *WorkflowUsageInfo) UnmarshalJSON(data []byte) error

type WorkflowVersionGetParams

type WorkflowVersionGetParams struct {
	WorkflowName string `path:"workflowName" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type WorkflowVersionGetResponse

type WorkflowVersionGetResponse struct {
	// Error message if the workflow version retrieval failed.
	Error string `json:"error"`
	// V3 read representation of a workflow version.
	Workflow Workflow `json:"workflow"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Error       respjson.Field
		Workflow    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WorkflowVersionGetResponse) RawJSON

func (r WorkflowVersionGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WorkflowVersionGetResponse) UnmarshalJSON

func (r *WorkflowVersionGetResponse) UnmarshalJSON(data []byte) error

type WorkflowVersionListParams

type WorkflowVersionListParams struct {
	EndingBefore  param.Opt[int64] `query:"endingBefore,omitzero" json:"-"`
	Limit         param.Opt[int64] `query:"limit,omitzero" json:"-"`
	StartingAfter param.Opt[int64] `query:"startingAfter,omitzero" json:"-"`
	// Any of "asc", "desc".
	SortOrder WorkflowVersionListParamsSortOrder `query:"sortOrder,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (WorkflowVersionListParams) URLQuery

func (r WorkflowVersionListParams) URLQuery() (v url.Values, err error)

URLQuery serializes WorkflowVersionListParams's query parameters as `url.Values`.

type WorkflowVersionListParamsSortOrder

type WorkflowVersionListParamsSortOrder string
const (
	WorkflowVersionListParamsSortOrderAsc  WorkflowVersionListParamsSortOrder = "asc"
	WorkflowVersionListParamsSortOrderDesc WorkflowVersionListParamsSortOrder = "desc"
)

type WorkflowVersionService

type WorkflowVersionService struct {
	// contains filtered or unexported fields
}

Workflows orchestrate one or more functions into a directed acyclic graph (DAG) for document processing.

Use these endpoints to create, update, list, and manage workflows, and to invoke them with file input via `POST /v3/workflows/{workflowName}/call`.

The call endpoint accepts files as either multipart form data or JSON with base64-encoded content. In the Bem CLI, use `@path/to/file` inside JSON values to automatically read and encode files:

```

bem workflows call --workflow-name my-workflow \
  --input.single-file '{"inputContent": "@file.pdf", "inputType": "pdf"}' \
  --wait

```

WorkflowVersionService contains methods and other services that help with interacting with the bem API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWorkflowVersionService method instead.

func NewWorkflowVersionService

func NewWorkflowVersionService(opts ...option.RequestOption) (r WorkflowVersionService)

NewWorkflowVersionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*WorkflowVersionService) Get

**Retrieve a specific historical version of a workflow.**

Versions are immutable. Use this endpoint to see what a workflow looked like at the moment a particular call was made — every call record carries the workflow `versionNum` it ran against.

func (*WorkflowVersionService) List

**List every version of a workflow.**

Versions are immutable. Each row captures what the workflow looked like between updates: graph topology, metadata, and timestamps. Returns newest-first by default. Cursor pagination via `startingAfter` / `endingBefore` over `versionNum`.

func (*WorkflowVersionService) ListAutoPaging

**List every version of a workflow.**

Versions are immutable. Each row captures what the workflow looked like between updates: graph topology, metadata, and timestamps. Returns newest-first by default. Cursor pagination via `startingAfter` / `endingBefore` over `versionNum`.

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL