Documentation
¶
Index ¶
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- type Error
- type ResearchFileListParams
- type ResearchFileListResponse
- type ResearchFileNewParams
- type ResearchFileNewResponse
- type ResearchFileService
- func (r *ResearchFileService) List(ctx context.Context, query ResearchFileListParams, ...) (res *pagination.Pagination[ResearchFileListResponse], err error)
- func (r *ResearchFileService) ListAutoPaging(ctx context.Context, query ResearchFileListParams, ...) *pagination.PaginationAutoPager[ResearchFileListResponse]
- func (r *ResearchFileService) New(ctx context.Context, body ResearchFileNewParams, opts ...option.RequestOption) (res *ResearchFileNewResponse, err error)
- type ResearchGetResponse
- type ResearchGetResponseResult
- type ResearchGetResponseStatus
- type ResearchListParams
- type ResearchListResponse
- type ResearchListResponseResult
- type ResearchListResponseStatus
- type ResearchNewParams
- type ResearchNewResponse
- type ResearchNewResponseStatus
- type ResearchResultGetContentParams
- type ResearchResultGetContentResponse
- type ResearchResultService
- type ResearchService
- func (r *ResearchService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *ResearchGetResponse, err error)
- func (r *ResearchService) List(ctx context.Context, query ResearchListParams, opts ...option.RequestOption) (res *pagination.Pagination[ResearchListResponse], err error)
- func (r *ResearchService) ListAutoPaging(ctx context.Context, query ResearchListParams, opts ...option.RequestOption) *pagination.PaginationAutoPager[ResearchListResponse]
- func (r *ResearchService) New(ctx context.Context, body ResearchNewParams, opts ...option.RequestOption) (res *ResearchNewResponse, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (CAESAR_API_KEY, CAESAR_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type Client ¶
type Client struct { Options []option.RequestOption Research ResearchService }
Client creates a struct with services and top level methods that help with interacting with the caesar 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 (CAESAR_API_KEY, CAESAR_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.
type ResearchFileListParams ¶
type ResearchFileListParams struct { // Page size (items per page). Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // 1-based page index. Page param.Opt[int64] `query:"page,omitzero" json:"-"` // contains filtered or unexported fields }
func (ResearchFileListParams) URLQuery ¶
func (r ResearchFileListParams) URLQuery() (v url.Values, err error)
URLQuery serializes ResearchFileListParams's query parameters as `url.Values`.
type ResearchFileListResponse ¶
type ResearchFileListResponse struct { // Unique identifier for the file. ID string `json:"id,required" format:"uuid"` // MIME type of the file as detected/stored. ContentType string `json:"content_type,required"` // Original uploaded filename. FileName string `json:"file_name,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field ContentType respjson.Field FileName respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (ResearchFileListResponse) RawJSON ¶
func (r ResearchFileListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResearchFileListResponse) UnmarshalJSON ¶
func (r *ResearchFileListResponse) UnmarshalJSON(data []byte) error
type ResearchFileNewParams ¶
type ResearchFileNewParams struct { File io.Reader `json:"file,omitzero,required" format:"binary"` // contains filtered or unexported fields }
func (ResearchFileNewParams) MarshalMultipart ¶
func (r ResearchFileNewParams) MarshalMultipart() (data []byte, contentType string, err error)
type ResearchFileNewResponse ¶
type ResearchFileNewResponse struct { // Unique identifier for the file. ID string `json:"id,required" format:"uuid"` // MIME type of the file as detected/stored. ContentType string `json:"content_type,required"` // Original uploaded filename. FileName string `json:"file_name,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field ContentType respjson.Field FileName respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (ResearchFileNewResponse) RawJSON ¶
func (r ResearchFileNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResearchFileNewResponse) UnmarshalJSON ¶
func (r *ResearchFileNewResponse) UnmarshalJSON(data []byte) error
type ResearchFileService ¶
type ResearchFileService struct {
Options []option.RequestOption
}
ResearchFileService contains methods and other services that help with interacting with the caesar 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 NewResearchFileService method instead.
func NewResearchFileService ¶
func NewResearchFileService(opts ...option.RequestOption) (r ResearchFileService)
NewResearchFileService 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 (*ResearchFileService) List ¶
func (r *ResearchFileService) List(ctx context.Context, query ResearchFileListParams, opts ...option.RequestOption) (res *pagination.Pagination[ResearchFileListResponse], err error)
Returns a paginated list of Research File objects.
func (*ResearchFileService) ListAutoPaging ¶
func (r *ResearchFileService) ListAutoPaging(ctx context.Context, query ResearchFileListParams, opts ...option.RequestOption) *pagination.PaginationAutoPager[ResearchFileListResponse]
Returns a paginated list of Research File objects.
func (*ResearchFileService) New ¶
func (r *ResearchFileService) New(ctx context.Context, body ResearchFileNewParams, opts ...option.RequestOption) (res *ResearchFileNewResponse, err error)
Upload a file via multipart form and create a Research File object.
type ResearchGetResponse ¶
type ResearchGetResponse struct { // Research job identifier. ID string `json:"id,required" format:"uuid"` // ISO 8601 timestamp when the job was created. CreatedAt time.Time `json:"created_at,required" format:"date-time"` // Original query. Query string `json:"query,required"` // Ranked retrieval results and citations. Results []ResearchGetResponseResult `json:"results,required"` // Current status of the research job. // // Any of "queued", "searching", "summarizing", "analyzing", "completed", "failed", // "researching". Status ResearchGetResponseStatus `json:"status,required"` // Final content/synthesis (null until available). Content string `json:"content,nullable"` // Post-processed content (e.g., formatted/converted). TransformedContent string `json:"transformed_content,nullable"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field CreatedAt respjson.Field Query respjson.Field Results respjson.Field Status respjson.Field Content respjson.Field TransformedContent respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (ResearchGetResponse) RawJSON ¶
func (r ResearchGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResearchGetResponse) UnmarshalJSON ¶
func (r *ResearchGetResponse) UnmarshalJSON(data []byte) error
type ResearchGetResponseResult ¶
type ResearchGetResponseResult struct { // Result object identifier. ID string `json:"id,required" format:"uuid"` // Relevance score (0–1). Score float64 `json:"score,required"` // Result title. Title string `json:"title,required"` // Canonical URL of the result. URL string `json:"url,required" format:"uri"` // Index used for inline citations (if present). CitationIndex int64 `json:"citation_index"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field Score respjson.Field Title respjson.Field URL respjson.Field CitationIndex respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (ResearchGetResponseResult) RawJSON ¶
func (r ResearchGetResponseResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResearchGetResponseResult) UnmarshalJSON ¶
func (r *ResearchGetResponseResult) UnmarshalJSON(data []byte) error
type ResearchGetResponseStatus ¶
type ResearchGetResponseStatus string
Current status of the research job.
const ( ResearchGetResponseStatusQueued ResearchGetResponseStatus = "queued" ResearchGetResponseStatusSearching ResearchGetResponseStatus = "searching" ResearchGetResponseStatusSummarizing ResearchGetResponseStatus = "summarizing" ResearchGetResponseStatusAnalyzing ResearchGetResponseStatus = "analyzing" ResearchGetResponseStatusCompleted ResearchGetResponseStatus = "completed" ResearchGetResponseStatusFailed ResearchGetResponseStatus = "failed" ResearchGetResponseStatusResearching ResearchGetResponseStatus = "researching" )
type ResearchListParams ¶
type ResearchListParams struct { // Page size (items per page). Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // 1-based page index. Page param.Opt[int64] `query:"page,omitzero" json:"-"` // contains filtered or unexported fields }
func (ResearchListParams) URLQuery ¶
func (r ResearchListParams) URLQuery() (v url.Values, err error)
URLQuery serializes ResearchListParams's query parameters as `url.Values`.
type ResearchListResponse ¶
type ResearchListResponse struct { // Research job identifier. ID string `json:"id,required" format:"uuid"` // ISO 8601 timestamp when the job was created. CreatedAt time.Time `json:"created_at,required" format:"date-time"` // Original query. Query string `json:"query,required"` // Ranked retrieval results and citations. Results []ResearchListResponseResult `json:"results,required"` // Current status of the research job. // // Any of "queued", "searching", "summarizing", "analyzing", "completed", "failed", // "researching". Status ResearchListResponseStatus `json:"status,required"` // Final content/synthesis (null until available). Content string `json:"content,nullable"` // Post-processed content (e.g., formatted/converted). TransformedContent string `json:"transformed_content,nullable"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field CreatedAt respjson.Field Query respjson.Field Results respjson.Field Status respjson.Field Content respjson.Field TransformedContent respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (ResearchListResponse) RawJSON ¶
func (r ResearchListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResearchListResponse) UnmarshalJSON ¶
func (r *ResearchListResponse) UnmarshalJSON(data []byte) error
type ResearchListResponseResult ¶
type ResearchListResponseResult struct { // Result object identifier. ID string `json:"id,required" format:"uuid"` // Relevance score (0–1). Score float64 `json:"score,required"` // Result title. Title string `json:"title,required"` // Canonical URL of the result. URL string `json:"url,required" format:"uri"` // Index used for inline citations (if present). CitationIndex int64 `json:"citation_index"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field Score respjson.Field Title respjson.Field URL respjson.Field CitationIndex respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (ResearchListResponseResult) RawJSON ¶
func (r ResearchListResponseResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResearchListResponseResult) UnmarshalJSON ¶
func (r *ResearchListResponseResult) UnmarshalJSON(data []byte) error
type ResearchListResponseStatus ¶
type ResearchListResponseStatus string
Current status of the research job.
const ( ResearchListResponseStatusQueued ResearchListResponseStatus = "queued" ResearchListResponseStatusSearching ResearchListResponseStatus = "searching" ResearchListResponseStatusSummarizing ResearchListResponseStatus = "summarizing" ResearchListResponseStatusAnalyzing ResearchListResponseStatus = "analyzing" ResearchListResponseStatusCompleted ResearchListResponseStatus = "completed" ResearchListResponseStatusFailed ResearchListResponseStatus = "failed" ResearchListResponseStatusResearching ResearchListResponseStatus = "researching" )
type ResearchNewParams ¶
type ResearchNewParams struct { // Primary research question or instruction. Query string `json:"query,required"` // Optional compute budget for the job. Defaults to 1. ComputeUnits param.Opt[int64] `json:"compute_units,omitzero"` // Optional system prompt to steer the assistant. SystemPrompt param.Opt[string] `json:"system_prompt,omitzero"` // IDs of previously uploaded files to include. Files []string `json:"files,omitzero" format:"uuid"` // contains filtered or unexported fields }
func (ResearchNewParams) MarshalJSON ¶
func (r ResearchNewParams) MarshalJSON() (data []byte, err error)
func (*ResearchNewParams) UnmarshalJSON ¶
func (r *ResearchNewParams) UnmarshalJSON(data []byte) error
type ResearchNewResponse ¶
type ResearchNewResponse struct { // Research job identifier. ID string `json:"id,required" format:"uuid"` // Current status of the research job. // // Any of "queued", "searching", "summarizing", "analyzing", "completed", "failed", // "researching". Status ResearchNewResponseStatus `json:"status,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field Status respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (ResearchNewResponse) RawJSON ¶
func (r ResearchNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResearchNewResponse) UnmarshalJSON ¶
func (r *ResearchNewResponse) UnmarshalJSON(data []byte) error
type ResearchNewResponseStatus ¶
type ResearchNewResponseStatus string
Current status of the research job.
const ( ResearchNewResponseStatusQueued ResearchNewResponseStatus = "queued" ResearchNewResponseStatusSearching ResearchNewResponseStatus = "searching" ResearchNewResponseStatusSummarizing ResearchNewResponseStatus = "summarizing" ResearchNewResponseStatusAnalyzing ResearchNewResponseStatus = "analyzing" ResearchNewResponseStatusCompleted ResearchNewResponseStatus = "completed" ResearchNewResponseStatusFailed ResearchNewResponseStatus = "failed" ResearchNewResponseStatusResearching ResearchNewResponseStatus = "researching" )
type ResearchResultGetContentParams ¶
type ResearchResultGetContentParams struct { ID string `path:"id,required" format:"uuid" json:"-"` // contains filtered or unexported fields }
type ResearchResultGetContentResponse ¶
type ResearchResultGetContentResponse struct { // Raw extracted content for this result (may include HTML, markdown, or plain // text). Content string `json:"content,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Content respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (ResearchResultGetContentResponse) RawJSON ¶
func (r ResearchResultGetContentResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResearchResultGetContentResponse) UnmarshalJSON ¶
func (r *ResearchResultGetContentResponse) UnmarshalJSON(data []byte) error
type ResearchResultService ¶
type ResearchResultService struct {
Options []option.RequestOption
}
ResearchResultService contains methods and other services that help with interacting with the caesar 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 NewResearchResultService method instead.
func NewResearchResultService ¶
func NewResearchResultService(opts ...option.RequestOption) (r ResearchResultService)
NewResearchResultService 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 (*ResearchResultService) GetContent ¶
func (r *ResearchResultService) GetContent(ctx context.Context, resultID string, query ResearchResultGetContentParams, opts ...option.RequestOption) (res *ResearchResultGetContentResponse, err error)
Returns the raw content for a specific result within a research object.
type ResearchService ¶
type ResearchService struct { Options []option.RequestOption Files ResearchFileService Results ResearchResultService }
ResearchService contains methods and other services that help with interacting with the caesar 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 NewResearchService method instead.
func NewResearchService ¶
func NewResearchService(opts ...option.RequestOption) (r ResearchService)
NewResearchService 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 (*ResearchService) Get ¶
func (r *ResearchService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *ResearchGetResponse, err error)
Retrieve a single research object by ID.
func (*ResearchService) List ¶
func (r *ResearchService) List(ctx context.Context, query ResearchListParams, opts ...option.RequestOption) (res *pagination.Pagination[ResearchListResponse], err error)
Returns a paginated list of research objects.
func (*ResearchService) ListAutoPaging ¶
func (r *ResearchService) ListAutoPaging(ctx context.Context, query ResearchListParams, opts ...option.RequestOption) *pagination.PaginationAutoPager[ResearchListResponse]
Returns a paginated list of research objects.
func (*ResearchService) New ¶
func (r *ResearchService) New(ctx context.Context, body ResearchNewParams, opts ...option.RequestOption) (res *ResearchNewResponse, err error)
Start a new research job using a query and optional file IDs.
Source Files
¶
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
|
|