Documentation
¶
Overview ¶
Package redpine is the Go client for the Redpine search API.
client, err := redpine.New() // reads REDPINE_API_KEY
r, err := client.Search(ctx, "crispr", redpine.SearchOptions{
Collections: []string{"corpus"},
Filters: redpine.F("issn").Eq("1664-302X").Or(redpine.F("issn").Eq("1932-6203")),
})
Package redpine provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.
Index ¶
- Constants
- func NewGetCachedResultRequest(server string, queryId string) (*http.Request, error)
- func NewGetQuotaRequest(server string) (*http.Request, error)
- func NewListCollectionsRequest(server string) (*http.Request, error)
- func NewSearchAssistedRequest(server string, body SearchAssistedJSONRequestBody) (*http.Request, error)
- func NewSearchAssistedRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewSearchCollectionRequest(server string, collection string, body SearchCollectionJSONRequestBody) (*http.Request, error)
- func NewSearchCollectionRequestWithBody(server string, collection string, contentType string, body io.Reader) (*http.Request, error)
- func NewSearchQueryRequest(server string, body SearchQueryJSONRequestBody) (*http.Request, error)
- func NewSearchQueryRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- type APIError
- type AccessDeniedError
- type AssistedBillingInfo
- type AssistedSearchOptions
- type AssistedSearchRequest
- type AssistedSearchResponse
- type AssistedSearchResponseStatus
- type AssistedSearchResult
- type AssistedUnavailableError
- type AuthError
- type ClarificationInfo
- type Client
- func (c *Client) GetCachedResult(ctx context.Context, queryId string, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetQuota(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) ListCollections(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) SearchAssisted(ctx context.Context, body SearchAssistedJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) SearchAssistedWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) SearchCollection(ctx context.Context, collection string, body SearchCollectionJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) SearchCollectionWithBody(ctx context.Context, collection string, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) SearchQuery(ctx context.Context, body SearchQueryJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) SearchQueryWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) GetCachedResultWithResponse(ctx context.Context, queryId string, reqEditors ...RequestEditorFn) (*GetCachedResultResponse, error)
- func (c *ClientWithResponses) GetQuotaWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetQuotaResponse, error)
- func (c *ClientWithResponses) ListCollectionsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListCollectionsResponse, error)
- func (c *ClientWithResponses) SearchAssistedWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*SearchAssistedResponse, error)
- func (c *ClientWithResponses) SearchAssistedWithResponse(ctx context.Context, body SearchAssistedJSONRequestBody, ...) (*SearchAssistedResponse, error)
- func (c *ClientWithResponses) SearchCollectionWithBodyWithResponse(ctx context.Context, collection string, contentType string, body io.Reader, ...) (*SearchCollectionResponse, error)
- func (c *ClientWithResponses) SearchCollectionWithResponse(ctx context.Context, collection string, body SearchCollectionJSONRequestBody, ...) (*SearchCollectionResponse, error)
- func (c *ClientWithResponses) SearchQueryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*SearchQueryResponse, error)
- func (c *ClientWithResponses) SearchQueryWithResponse(ctx context.Context, body SearchQueryJSONRequestBody, ...) (*SearchQueryResponse, error)
- type ClientWithResponsesInterface
- type CollectionsResponse
- type Error
- type Field
- func (fd Field) Between(lo, hi any) Filter
- func (fd Field) Eq(v any) Filter
- func (fd Field) Gt(v any) Filter
- func (fd Field) Gte(v any) Filter
- func (fd Field) In(v ...any) Filter
- func (fd Field) Lt(v any) Filter
- func (fd Field) Lte(v any) Filter
- func (fd Field) Ne(v any) Filter
- func (fd Field) NotIn(v ...any) Filter
- type Filter
- type FilterWarning
- type GetCachedResultResponse
- func (r GetCachedResultResponse) ContentType() string
- func (r GetCachedResultResponse) GetBody() []byte
- func (r GetCachedResultResponse) GetJSON200() *SearchResponse
- func (r GetCachedResultResponse) GetJSON401() *Error
- func (r GetCachedResultResponse) GetJSON404() *Error
- func (r GetCachedResultResponse) GetJSON410() *Error
- func (r GetCachedResultResponse) Status() string
- func (r GetCachedResultResponse) StatusCode() int
- type GetCachedResultResponse200Headers
- type GetQuotaResponse
- type HttpRequestDoer
- type JournalMetricExpansion
- type ListCollectionsResponse
- func (r ListCollectionsResponse) ContentType() string
- func (r ListCollectionsResponse) GetBody() []byte
- func (r ListCollectionsResponse) GetJSON200() *CollectionsResponse
- func (r ListCollectionsResponse) GetJSON401() *Error
- func (r ListCollectionsResponse) GetJSON403() *Error
- func (r ListCollectionsResponse) GetJSON429() *Error
- func (r ListCollectionsResponse) Status() string
- func (r ListCollectionsResponse) StatusCode() int
- type NotFoundError
- type Option
- type QueryUnderstanding
- type QuotaExceededError
- type QuotaInfo
- type Redpine
- func (c *Redpine) AssistedSearch(ctx context.Context, query string, o AssistedSearchOptions) (*AssistedSearchResponse, error)
- func (c *Redpine) Collections(ctx context.Context) (*CollectionsResponse, error)
- func (c *Redpine) GetResults(ctx context.Context, queryID string) (*SearchResponse, error)
- func (c *Redpine) Quota(ctx context.Context) (*QuotaInfo, error)
- func (c *Redpine) Search(ctx context.Context, query string, o SearchOptions) (*SearchResponse, error)
- func (c *Redpine) SearchCollection(ctx context.Context, collection, query string, o SearchCollectionOptions) (*SearchResponse, error)
- type RelevanceInfo
- type RequestEditorFn
- type SearchAssistedJSONRequestBody
- type SearchAssistedResponse
- func (r SearchAssistedResponse) ContentType() string
- func (r SearchAssistedResponse) GetBody() []byte
- func (r SearchAssistedResponse) GetJSON200() *AssistedSearchResponse
- func (r SearchAssistedResponse) GetJSON401() *Error
- func (r SearchAssistedResponse) GetJSON403() *Error
- func (r SearchAssistedResponse) GetJSON422() *Error
- func (r SearchAssistedResponse) GetJSON429() *Error
- func (r SearchAssistedResponse) GetJSON503() *Error
- func (r SearchAssistedResponse) Status() string
- func (r SearchAssistedResponse) StatusCode() int
- type SearchAssistedResponse200Headers
- type SearchCollectionJSONBody
- type SearchCollectionJSONRequestBody
- type SearchCollectionOptions
- type SearchCollectionResponse
- func (r SearchCollectionResponse) ContentType() string
- func (r SearchCollectionResponse) GetBody() []byte
- func (r SearchCollectionResponse) GetJSON200() *SearchResponse
- func (r SearchCollectionResponse) GetJSON401() *Error
- func (r SearchCollectionResponse) GetJSON403() *Error
- func (r SearchCollectionResponse) GetJSON404() *Error
- func (r SearchCollectionResponse) GetJSON422() *Error
- func (r SearchCollectionResponse) GetJSON429() *Error
- func (r SearchCollectionResponse) GetJSON503() *Error
- func (r SearchCollectionResponse) Status() string
- func (r SearchCollectionResponse) StatusCode() int
- type SearchCollectionResponse200Headers
- type SearchOptions
- type SearchQueryJSONRequestBody
- type SearchQueryResponse
- func (r SearchQueryResponse) ContentType() string
- func (r SearchQueryResponse) GetBody() []byte
- func (r SearchQueryResponse) GetJSON200() *SearchResponse
- func (r SearchQueryResponse) GetJSON401() *Error
- func (r SearchQueryResponse) GetJSON403() *Error
- func (r SearchQueryResponse) GetJSON404() *Error
- func (r SearchQueryResponse) GetJSON422() *Error
- func (r SearchQueryResponse) GetJSON429() *Error
- func (r SearchQueryResponse) GetJSON503() *Error
- func (r SearchQueryResponse) Status() string
- func (r SearchQueryResponse) StatusCode() int
- type SearchQueryResponse200Headers
- type SearchRequest
- type SearchResponse
- type SearchResult
- type ValidationError
Constants ¶
const DefaultBaseURL = "https://api.redpine.ai"
DefaultBaseURL is the production API. Override only via env REDPINE_BASE_URL.
Variables ¶
This section is empty.
Functions ¶
func NewGetCachedResultRequest ¶
NewGetCachedResultRequest constructs an http.Request for the GetCachedResult method
func NewGetQuotaRequest ¶
NewGetQuotaRequest constructs an http.Request for the GetQuota method
func NewListCollectionsRequest ¶
NewListCollectionsRequest constructs an http.Request for the ListCollections method
func NewSearchAssistedRequest ¶
func NewSearchAssistedRequest(server string, body SearchAssistedJSONRequestBody) (*http.Request, error)
NewSearchAssistedRequest calls the generic SearchAssisted builder with application/json body
func NewSearchAssistedRequestWithBody ¶
func NewSearchAssistedRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewSearchAssistedRequestWithBody constructs an http.Request for the SearchAssisted method, with any body, and a specified content type
func NewSearchCollectionRequest ¶
func NewSearchCollectionRequest(server string, collection string, body SearchCollectionJSONRequestBody) (*http.Request, error)
NewSearchCollectionRequest calls the generic SearchCollection builder with application/json body
func NewSearchCollectionRequestWithBody ¶
func NewSearchCollectionRequestWithBody(server string, collection string, contentType string, body io.Reader) (*http.Request, error)
NewSearchCollectionRequestWithBody constructs an http.Request for the SearchCollection method, with any body, and a specified content type
func NewSearchQueryRequest ¶
func NewSearchQueryRequest(server string, body SearchQueryJSONRequestBody) (*http.Request, error)
NewSearchQueryRequest calls the generic SearchQuery builder with application/json body
Types ¶
type APIError ¶
APIError is the base for every error the SDK returns on a non-2xx response. (Named APIError because the generated code already declares the model type Error.)
type AccessDeniedError ¶
type AccessDeniedError struct{ APIError }
AccessDeniedError is 403: key has no access to the requested collection.
func (*AccessDeniedError) Unwrap ¶
func (e *AccessDeniedError) Unwrap() error
type AssistedBillingInfo ¶
type AssistedBillingInfo struct {
// ChargedResults Number of results billed
ChargedResults int `json:"chargedResults"`
// TokensCharged Tokens billed (0 for clarification/no-result)
TokensCharged int `json:"tokensCharged"`
}
AssistedBillingInfo What was actually charged — only delivered, verified results are billed.
type AssistedSearchOptions ¶
type AssistedSearchOptions struct {
Collection string
Collections []string
Limit int
Filters any
AllowClarification *bool
IncludeMetadata *bool
}
AssistedSearchOptions for AssistedSearch. Exactly one of Collection / Collections is required. IncludeFigures is not offered here: the API always forces it false for assisted search (matches the TS client), so there is no user-facing knob for it.
type AssistedSearchRequest ¶
type AssistedSearchRequest struct {
// AllowClarification If true, the endpoint may return a clarifying question instead of results when the query is too underspecified. Set false if your client cannot do a follow-up turn.
AllowClarification *bool `json:"allowClarification,omitempty"`
// Collection Collection to search. Provide either this or `collections`, not both.
Collection *string `json:"collection,omitempty"`
// Collections Collections to search together (max 5). Results are merged into one relevance-ranked list and each result is labeled with its origin collection. Provide either this or 'collection', not both.
Collections *[]string `json:"collections,omitempty"`
// Filters Same filter forms as `/api/v1/search/query`; applied to every internal search.
Filters *map[string]interface{} `json:"filters,omitempty"`
// ImageMaxHeight Maximum image height in pixels
ImageMaxHeight *int `json:"imageMaxHeight,omitempty"`
// ImageMaxWidth Maximum image width in pixels
ImageMaxWidth *int `json:"imageMaxWidth,omitempty"`
// ImageQuality JPEG quality for fetched images
ImageQuality *int `json:"imageQuality,omitempty"`
// IncludeFigures Fetch and attach figure images (base64, in metadata.figures[].image_data) for the delivered results only. Adds latency; requires `includeMetadata`. `includeImages` is accepted as a deprecated alias.
IncludeFigures *bool `json:"includeFigures,omitempty"`
// IncludeMetadata Whether to include metadata in results
IncludeMetadata *bool `json:"includeMetadata,omitempty"`
// Limit Maximum verified results to return.
Limit *int `json:"limit,omitempty"`
// Query Search query text
Query string `json:"query"`
}
AssistedSearchRequest defines model for AssistedSearchRequest.
type AssistedSearchResponse ¶
type AssistedSearchResponse struct {
// Billing What was billed
Billing AssistedBillingInfo `json:"billing"`
// Clarification Set only when status is `clarification_needed`.
Clarification *ClarificationInfo `json:"clarification,omitempty"`
// FilterWarnings Advisory warnings about the supplied filter — for example filtering on a field with no payload index, which is matched by scanning. The search still runs. Omitted when there are none.
FilterWarnings *[]FilterWarning `json:"filterWarnings,omitempty"`
// IterationsRun Number of search+replan rounds executed
IterationsRun int `json:"iterationsRun"`
// JournalMetricExpansions How each journal-metric condition resolved to ISSNs; omitted when no metric filter was used
JournalMetricExpansions *[]JournalMetricExpansion `json:"journalMetricExpansions,omitempty"`
// LatencyMs End-to-end latency in milliseconds
LatencyMs int `json:"latencyMs"`
// QueryId Query ID for audit reference
QueryId string `json:"queryId"`
// QueryUnderstanding How the query was interpreted
QueryUnderstanding QueryUnderstanding `json:"queryUnderstanding"`
// Results Verified results (empty unless status='results')
Results *[]AssistedSearchResult `json:"results,omitempty"`
// Status Outcome of the assisted search
Status AssistedSearchResponseStatus `json:"status"`
}
AssistedSearchResponse defines model for AssistedSearchResponse.
type AssistedSearchResponseStatus ¶
type AssistedSearchResponseStatus string
AssistedSearchResponseStatus Outcome of the assisted search
const ( ClarificationNeeded AssistedSearchResponseStatus = "clarification_needed" NoRelevantResults AssistedSearchResponseStatus = "no_relevant_results" Results AssistedSearchResponseStatus = "results" )
Defines values for AssistedSearchResponseStatus.
func (AssistedSearchResponseStatus) Valid ¶
func (e AssistedSearchResponseStatus) Valid() bool
Valid indicates whether the value is a known member of the AssistedSearchResponseStatus enum.
type AssistedSearchResult ¶
type AssistedSearchResult struct {
// Collection Origin collection of this result. Populated only for requests made with the 'collections' (multi-collection) form.
Collection *string `json:"collection,omitempty"`
// DoiUrl Resolvable DOI link (https://doi.org/{doi})
DoiUrl *string `json:"doiUrl,omitempty"`
// Id Chunk/point ID
Id string `json:"id"`
// Metadata Document metadata (title, authors, journal, etc.). Null when includeMetadata is false.
Metadata *map[string]interface{} `json:"metadata,omitempty"`
// Relevance Relevance verdict for this result
Relevance RelevanceInfo `json:"relevance"`
// Section Comma-joined source section(s) of the article, from the normalized vocabulary (abstract, introduction, background, methods, results, discussion, conclusion, case, supplementary, other)
Section *string `json:"section,omitempty"`
// Text Chunk text content
Text string `json:"text"`
}
AssistedSearchResult defines model for AssistedSearchResult.
type AssistedUnavailableError ¶
AssistedUnavailableError is 503: assisted search temporarily unavailable.
func (*AssistedUnavailableError) Unwrap ¶
func (e *AssistedUnavailableError) Unwrap() error
type ClarificationInfo ¶
type ClarificationInfo struct {
// Question The clarifying question to ask the user
Question string `json:"question"`
// Reason Why clarification is needed
Reason *string `json:"reason,omitempty"`
}
ClarificationInfo defines model for ClarificationInfo.
type Client ¶
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) GetCachedResult ¶
func (c *Client) GetCachedResult(ctx context.Context, queryId string, reqEditors ...RequestEditorFn) (*http.Response, error)
GetCachedResult Re-fetch cached results
Retrieve previously returned search results using the queryId from a prior search response. Returns the same results without billing. The request must use the same API key that performed the original search. Results are available for 7 days.
Corresponds with GET /api/v1/search/results/{queryId} (the `GetCachedResult` operationId).
func (*Client) GetQuota ¶
func (c *Client) GetQuota(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
GetQuota Current quota usage and limits
Daily and monthly query usage and limits for the authenticated organization.
Corresponds with GET /api/v1/search/quota (the `GetQuota` operationId).
func (*Client) ListCollections ¶
func (c *Client) ListCollections(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
ListCollections List collections
List all document collections accessible to the authenticated API key.
Corresponds with GET /api/v1/search/collections (the `ListCollections` operationId).
func (*Client) SearchAssisted ¶
func (c *Client) SearchAssisted(ctx context.Context, body SearchAssistedJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
SearchAssisted Assisted search (verified results only)
Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.
**Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.
Accepts the same `filters` as `/search/query`, applied to every internal search.
Takes a body of the `application/json` content type.
Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).
func (*Client) SearchAssistedWithBody ¶
func (c *Client) SearchAssistedWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
SearchAssistedWithBody Assisted search (verified results only)
Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.
**Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.
Accepts the same `filters` as `/search/query`, applied to every internal search.
Takes any type of body and a specified content type.
Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).
func (*Client) SearchCollection ¶
func (c *Client) SearchCollection(ctx context.Context, collection string, body SearchCollectionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
SearchCollection Search a single collection by name
Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.
Takes a body of the `application/json` content type.
Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).
func (*Client) SearchCollectionWithBody ¶
func (c *Client) SearchCollectionWithBody(ctx context.Context, collection string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
SearchCollectionWithBody Search a single collection by name
Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.
Takes any type of body and a specified content type.
Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).
func (*Client) SearchQuery ¶
func (c *Client) SearchQuery(ctx context.Context, body SearchQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
SearchQuery Search documents
Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.
Takes a body of the `application/json` content type.
Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).
func (*Client) SearchQueryWithBody ¶
func (c *Client) SearchQueryWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
SearchQueryWithBody Search documents
Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.
Takes any type of body and a specified content type.
Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).
type ClientInterface ¶
type ClientInterface interface {
// SearchAssistedWithBody Assisted search (verified results only)
//
// Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.
//
// **Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.
//
// Accepts the same `filters` as `/search/query`, applied to every internal search.
//
// Takes any type of body and a specified content type.
//
// Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).
SearchAssistedWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// SearchAssisted Assisted search (verified results only)
//
// Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.
//
// **Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.
//
// Accepts the same `filters` as `/search/query`, applied to every internal search.
//
// Takes a body of the `application/json` content type.
//
// Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).
SearchAssisted(ctx context.Context, body SearchAssistedJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// ListCollections List collections
//
// List all document collections accessible to the authenticated API key.
//
// Corresponds with GET /api/v1/search/collections (the `ListCollections` operationId).
ListCollections(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// SearchQueryWithBody Search documents
//
// Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.
//
// Takes any type of body and a specified content type.
//
// Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).
SearchQueryWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// SearchQuery Search documents
//
// Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.
//
// Takes a body of the `application/json` content type.
//
// Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).
SearchQuery(ctx context.Context, body SearchQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetQuota Current quota usage and limits
//
// Daily and monthly query usage and limits for the authenticated organization.
//
// Corresponds with GET /api/v1/search/quota (the `GetQuota` operationId).
GetQuota(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetCachedResult Re-fetch cached results
//
// Retrieve previously returned search results using the queryId from a prior search response. Returns the same results without billing. The request must use the same API key that performed the original search. Results are available for 7 days.
//
// Corresponds with GET /api/v1/search/results/{queryId} (the `GetCachedResult` operationId).
GetCachedResult(ctx context.Context, queryId string, reqEditors ...RequestEditorFn) (*http.Response, error)
// SearchCollectionWithBody Search a single collection by name
//
// Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.
//
// Takes any type of body and a specified content type.
//
// Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).
SearchCollectionWithBody(ctx context.Context, collection string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// SearchCollection Search a single collection by name
//
// Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.
//
// Takes a body of the `application/json` content type.
//
// Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).
SearchCollection(ctx context.Context, collection string, body SearchCollectionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) GetCachedResultWithResponse ¶
func (c *ClientWithResponses) GetCachedResultWithResponse(ctx context.Context, queryId string, reqEditors ...RequestEditorFn) (*GetCachedResultResponse, error)
GetCachedResultWithResponse Re-fetch cached results
Retrieve previously returned search results using the queryId from a prior search response. Returns the same results without billing. The request must use the same API key that performed the original search. Results are available for 7 days.
Returns a wrapper object for the known response body format(s).
Corresponds with GET /api/v1/search/results/{queryId} (the `GetCachedResult` operationId).
func (*ClientWithResponses) GetQuotaWithResponse ¶
func (c *ClientWithResponses) GetQuotaWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetQuotaResponse, error)
GetQuotaWithResponse Current quota usage and limits
Daily and monthly query usage and limits for the authenticated organization.
Returns a wrapper object for the known response body format(s).
Corresponds with GET /api/v1/search/quota (the `GetQuota` operationId).
func (*ClientWithResponses) ListCollectionsWithResponse ¶
func (c *ClientWithResponses) ListCollectionsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListCollectionsResponse, error)
ListCollectionsWithResponse List collections
List all document collections accessible to the authenticated API key.
Returns a wrapper object for the known response body format(s).
Corresponds with GET /api/v1/search/collections (the `ListCollections` operationId).
func (*ClientWithResponses) SearchAssistedWithBodyWithResponse ¶
func (c *ClientWithResponses) SearchAssistedWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchAssistedResponse, error)
SearchAssistedWithBodyWithResponse Assisted search (verified results only)
Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.
**Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.
Accepts the same `filters` as `/search/query`, applied to every internal search.
Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).
func (*ClientWithResponses) SearchAssistedWithResponse ¶
func (c *ClientWithResponses) SearchAssistedWithResponse(ctx context.Context, body SearchAssistedJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchAssistedResponse, error)
SearchAssistedWithResponse Assisted search (verified results only)
Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.
**Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.
Accepts the same `filters` as `/search/query`, applied to every internal search.
Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).
func (*ClientWithResponses) SearchCollectionWithBodyWithResponse ¶
func (c *ClientWithResponses) SearchCollectionWithBodyWithResponse(ctx context.Context, collection string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchCollectionResponse, error)
SearchCollectionWithBodyWithResponse Search a single collection by name
Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.
Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).
func (*ClientWithResponses) SearchCollectionWithResponse ¶
func (c *ClientWithResponses) SearchCollectionWithResponse(ctx context.Context, collection string, body SearchCollectionJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchCollectionResponse, error)
SearchCollectionWithResponse Search a single collection by name
Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.
Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).
func (*ClientWithResponses) SearchQueryWithBodyWithResponse ¶
func (c *ClientWithResponses) SearchQueryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchQueryResponse, error)
SearchQueryWithBodyWithResponse Search documents
Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.
Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).
func (*ClientWithResponses) SearchQueryWithResponse ¶
func (c *ClientWithResponses) SearchQueryWithResponse(ctx context.Context, body SearchQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchQueryResponse, error)
SearchQueryWithResponse Search documents
Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.
Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// SearchAssistedWithBodyWithResponse Assisted search (verified results only)
//
// Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.
//
// **Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.
//
// Accepts the same `filters` as `/search/query`, applied to every internal search.
//
// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).
SearchAssistedWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchAssistedResponse, error)
// SearchAssistedWithResponse Assisted search (verified results only)
//
// Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.
//
// **Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.
//
// Accepts the same `filters` as `/search/query`, applied to every internal search.
//
// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).
SearchAssistedWithResponse(ctx context.Context, body SearchAssistedJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchAssistedResponse, error)
// ListCollectionsWithResponse List collections
//
// List all document collections accessible to the authenticated API key.
//
// Returns a wrapper object for the known response body format(s).
//
// Corresponds with GET /api/v1/search/collections (the `ListCollections` operationId).
ListCollectionsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListCollectionsResponse, error)
// SearchQueryWithBodyWithResponse Search documents
//
// Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.
//
// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).
SearchQueryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchQueryResponse, error)
// SearchQueryWithResponse Search documents
//
// Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.
//
// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).
SearchQueryWithResponse(ctx context.Context, body SearchQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchQueryResponse, error)
// GetQuotaWithResponse Current quota usage and limits
//
// Daily and monthly query usage and limits for the authenticated organization.
//
// Returns a wrapper object for the known response body format(s).
//
// Corresponds with GET /api/v1/search/quota (the `GetQuota` operationId).
GetQuotaWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetQuotaResponse, error)
// GetCachedResultWithResponse Re-fetch cached results
//
// Retrieve previously returned search results using the queryId from a prior search response. Returns the same results without billing. The request must use the same API key that performed the original search. Results are available for 7 days.
//
// Returns a wrapper object for the known response body format(s).
//
// Corresponds with GET /api/v1/search/results/{queryId} (the `GetCachedResult` operationId).
GetCachedResultWithResponse(ctx context.Context, queryId string, reqEditors ...RequestEditorFn) (*GetCachedResultResponse, error)
// SearchCollectionWithBodyWithResponse Search a single collection by name
//
// Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.
//
// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).
SearchCollectionWithBodyWithResponse(ctx context.Context, collection string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchCollectionResponse, error)
// SearchCollectionWithResponse Search a single collection by name
//
// Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.
//
// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).
SearchCollectionWithResponse(ctx context.Context, collection string, body SearchCollectionJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchCollectionResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type CollectionsResponse ¶
type CollectionsResponse struct {
// Collections List of accessible collections.
Collections []struct {
// DocumentCount Number of documents in the collection.
DocumentCount int `json:"documentCount"`
// Name Collection name.
Name string `json:"name"`
} `json:"collections"`
// Count Total number of accessible collections.
Count int `json:"count"`
}
CollectionsResponse defines model for CollectionsResponse.
type Error ¶
type Error struct {
Error struct {
// Code Machine-readable error code.
//
// Examples: UNAUTHORIZED, FORBIDDEN, NOT_FOUND, VALIDATION_ERROR, RATE_LIMITED
Code string `json:"code"`
// Message Human-readable error description.
Message string `json:"message"`
// RequestId Request ID for debugging.
RequestId *string `json:"requestId,omitempty"`
} `json:"error"`
}
Error defines model for Error.
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
Field names a filterable field; apply one operator to get a Filter.
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is an immutable node of the structured filter DSL the search API accepts:
leaf {"field": name, "<op>": value}
combinator {"and"|"or"|"not": [nodes]} (always a list)
ops eq ne in not_in gt gte lt lte between ([lo, hi])
F("issn").Eq("1664-302X").Or(F("issn").Eq("1932-6203"))
F("journal_metric.2yr_mean_citedness").Gte(5).And(F("doi").Eq("10.1/x").Not())
type FilterWarning ¶
type FilterWarning struct {
// Code Machine-readable code, e.g. `unindexed_filter_field`.
Code string `json:"code"`
// Field The filter field the warning concerns.
Field string `json:"field"`
// Message Human-readable explanation.
Message string `json:"message"`
}
FilterWarning defines model for FilterWarning.
type GetCachedResultResponse ¶
type GetCachedResultResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *SearchResponse
// JSON401 the response for an HTTP 401 `application/json` response
JSON401 *Error
// JSON404 the response for an HTTP 404 `application/json` response
JSON404 *Error
// JSON410 the response for an HTTP 410 `application/json` response
JSON410 *Error
// Headers200 the parsed response headers for an HTTP 200 response
Headers200 *GetCachedResultResponse200Headers
}
func ParseGetCachedResultResponse ¶
func ParseGetCachedResultResponse(rsp *http.Response) (*GetCachedResultResponse, error)
ParseGetCachedResultResponse parses an HTTP response from a GetCachedResultWithResponse call
func (GetCachedResultResponse) ContentType ¶
func (r GetCachedResultResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (GetCachedResultResponse) GetBody ¶
func (r GetCachedResultResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (GetCachedResultResponse) GetJSON200 ¶
func (r GetCachedResultResponse) GetJSON200() *SearchResponse
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (GetCachedResultResponse) GetJSON401 ¶
func (r GetCachedResultResponse) GetJSON401() *Error
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (GetCachedResultResponse) GetJSON404 ¶
func (r GetCachedResultResponse) GetJSON404() *Error
GetJSON404 returns the response for an HTTP 404 `application/json` response
func (GetCachedResultResponse) GetJSON410 ¶
func (r GetCachedResultResponse) GetJSON410() *Error
GetJSON410 returns the response for an HTTP 410 `application/json` response
func (GetCachedResultResponse) Status ¶
func (r GetCachedResultResponse) Status() string
Status returns HTTPResponse.Status
func (GetCachedResultResponse) StatusCode ¶
func (r GetCachedResultResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetCachedResultResponse200Headers ¶
GetCachedResultResponse200Headers the declared response headers of an HTTP 200 response for GetCachedResult
type GetQuotaResponse ¶
type GetQuotaResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *QuotaInfo
// JSON401 the response for an HTTP 401 `application/json` response
JSON401 *Error
}
func ParseGetQuotaResponse ¶
func ParseGetQuotaResponse(rsp *http.Response) (*GetQuotaResponse, error)
ParseGetQuotaResponse parses an HTTP response from a GetQuotaWithResponse call
func (GetQuotaResponse) ContentType ¶
func (r GetQuotaResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (GetQuotaResponse) GetBody ¶
func (r GetQuotaResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (GetQuotaResponse) GetJSON200 ¶
func (r GetQuotaResponse) GetJSON200() *QuotaInfo
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (GetQuotaResponse) GetJSON401 ¶
func (r GetQuotaResponse) GetJSON401() *Error
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (GetQuotaResponse) Status ¶
func (r GetQuotaResponse) Status() string
Status returns HTTPResponse.Status
func (GetQuotaResponse) StatusCode ¶
func (r GetQuotaResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type JournalMetricExpansion ¶
type JournalMetricExpansion struct {
// Condition Threshold applied, e.g. `gte 5.0`.
Condition string `json:"condition"`
// Field Metric field expanded, e.g. `journal_metric.2yr_mean_citedness`.
Field string `json:"field"`
// IssnCount ISSNs pushed down (a journal usually has both a print and an electronic ISSN).
IssnCount int `json:"issnCount"`
// MatchedJournals Distinct journals matching the threshold.
MatchedJournals int `json:"matchedJournals"`
// SampleIssns First few ISSNs, for inspection.
SampleIssns *[]string `json:"sampleIssns,omitempty"`
}
JournalMetricExpansion defines model for JournalMetricExpansion.
type ListCollectionsResponse ¶
type ListCollectionsResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *CollectionsResponse
// JSON401 the response for an HTTP 401 `application/json` response
JSON401 *Error
// JSON403 the response for an HTTP 403 `application/json` response
JSON403 *Error
// JSON429 the response for an HTTP 429 `application/json` response
JSON429 *Error
}
func ParseListCollectionsResponse ¶
func ParseListCollectionsResponse(rsp *http.Response) (*ListCollectionsResponse, error)
ParseListCollectionsResponse parses an HTTP response from a ListCollectionsWithResponse call
func (ListCollectionsResponse) ContentType ¶
func (r ListCollectionsResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (ListCollectionsResponse) GetBody ¶
func (r ListCollectionsResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (ListCollectionsResponse) GetJSON200 ¶
func (r ListCollectionsResponse) GetJSON200() *CollectionsResponse
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (ListCollectionsResponse) GetJSON401 ¶
func (r ListCollectionsResponse) GetJSON401() *Error
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (ListCollectionsResponse) GetJSON403 ¶
func (r ListCollectionsResponse) GetJSON403() *Error
GetJSON403 returns the response for an HTTP 403 `application/json` response
func (ListCollectionsResponse) GetJSON429 ¶
func (r ListCollectionsResponse) GetJSON429() *Error
GetJSON429 returns the response for an HTTP 429 `application/json` response
func (ListCollectionsResponse) Status ¶
func (r ListCollectionsResponse) Status() string
Status returns HTTPResponse.Status
func (ListCollectionsResponse) StatusCode ¶
func (r ListCollectionsResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type NotFoundError ¶
type NotFoundError struct{ APIError }
NotFoundError is 404: collection or queryId not found.
func (*NotFoundError) Unwrap ¶
func (e *NotFoundError) Unwrap() error
type Option ¶
type Option func(*config)
Option configures New.
func WithAPIKey ¶
func WithMaxRetries ¶
func WithTimeout ¶
type QueryUnderstanding ¶
type QueryUnderstanding struct {
// Aspects Facets asked about the entity (e.g. mechanism of action, dermal penetration, clinical outcomes)
Aspects *[]string `json:"aspects,omitempty"`
// Entities Entities the query is about (substances, genes, diseases, organisms, methods)
Entities *[]string `json:"entities,omitempty"`
// Filters Structured metadata constraints read off the query. Possible keys (snake_case, present only when the query named the constraint): 'journal' (str), 'publisher' (str), 'article_type' (str, JATS vocabulary), 'publication_date' ({'gte'?: 'YYYY-MM-DD', 'lt'?: 'YYYY-MM-DD'}). Empty object when the query named none.
Filters *map[string]interface{} `json:"filters,omitempty"`
// Intent What the query is asking for
Intent *string `json:"intent,omitempty"`
}
QueryUnderstanding How the endpoint read the query.
type QuotaExceededError ¶
QuotaExceededError is 429. RetryAfter is seconds when the server said.
func (*QuotaExceededError) Unwrap ¶
func (e *QuotaExceededError) Unwrap() error
type QuotaInfo ¶
type QuotaInfo struct {
// DailyLimit Max queries per day.
DailyLimit int `json:"dailyLimit"`
// DailyRemaining Queries remaining today.
DailyRemaining int `json:"dailyRemaining"`
// DailyUsed Queries used today.
DailyUsed int `json:"dailyUsed"`
// MonthlyLimit Max queries per month.
MonthlyLimit int `json:"monthlyLimit"`
// MonthlyRemaining Queries remaining this month.
MonthlyRemaining int `json:"monthlyRemaining"`
// MonthlyUsed Queries used this month.
MonthlyUsed int `json:"monthlyUsed"`
}
QuotaInfo defines model for QuotaInfo.
type Redpine ¶
type Redpine struct {
// contains filtered or unexported fields
}
Redpine is the hand-written client over the generated core. Named Redpine (not Client) because generated.go already declares a low-level type Client; mirrors the TS SDK's exported Redpine class.
func New ¶
New builds a Redpine client. Key from WithAPIKey, else REDPINE_API_KEY, else CONNECT_API_KEY.
func (*Redpine) AssistedSearch ¶
func (c *Redpine) AssistedSearch(ctx context.Context, query string, o AssistedSearchOptions) (*AssistedSearchResponse, error)
func (*Redpine) Collections ¶
func (c *Redpine) Collections(ctx context.Context) (*CollectionsResponse, error)
func (*Redpine) GetResults ¶
func (*Redpine) Search ¶
func (c *Redpine) Search(ctx context.Context, query string, o SearchOptions) (*SearchResponse, error)
func (*Redpine) SearchCollection ¶
func (c *Redpine) SearchCollection(ctx context.Context, collection, query string, o SearchCollectionOptions) (*SearchResponse, error)
type RelevanceInfo ¶
type RelevanceInfo struct {
// JudgeScore Relevance score assigned by the judge (0..1)
JudgeScore float32 `json:"judgeScore"`
// MatchedTerms Entity/synonym surface forms found in the chunk (for highlighting)
MatchedTerms *[]string `json:"matchedTerms,omitempty"`
// Rationale One-sentence explanation of relevance
Rationale *string `json:"rationale,omitempty"`
}
RelevanceInfo Why a result was judged relevant.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type SearchAssistedJSONRequestBody ¶
type SearchAssistedJSONRequestBody = AssistedSearchRequest
SearchAssistedJSONRequestBody defines body for SearchAssisted for application/json ContentType.
type SearchAssistedResponse ¶
type SearchAssistedResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *AssistedSearchResponse
// JSON401 the response for an HTTP 401 `application/json` response
JSON401 *Error
// JSON403 the response for an HTTP 403 `application/json` response
JSON403 *Error
// JSON422 the response for an HTTP 422 `application/json` response
JSON422 *Error
// JSON429 the response for an HTTP 429 `application/json` response
JSON429 *Error
// JSON503 the response for an HTTP 503 `application/json` response
JSON503 *Error
// Headers200 the parsed response headers for an HTTP 200 response
Headers200 *SearchAssistedResponse200Headers
}
func ParseSearchAssistedResponse ¶
func ParseSearchAssistedResponse(rsp *http.Response) (*SearchAssistedResponse, error)
ParseSearchAssistedResponse parses an HTTP response from a SearchAssistedWithResponse call
func (SearchAssistedResponse) ContentType ¶
func (r SearchAssistedResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (SearchAssistedResponse) GetBody ¶
func (r SearchAssistedResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (SearchAssistedResponse) GetJSON200 ¶
func (r SearchAssistedResponse) GetJSON200() *AssistedSearchResponse
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (SearchAssistedResponse) GetJSON401 ¶
func (r SearchAssistedResponse) GetJSON401() *Error
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (SearchAssistedResponse) GetJSON403 ¶
func (r SearchAssistedResponse) GetJSON403() *Error
GetJSON403 returns the response for an HTTP 403 `application/json` response
func (SearchAssistedResponse) GetJSON422 ¶
func (r SearchAssistedResponse) GetJSON422() *Error
GetJSON422 returns the response for an HTTP 422 `application/json` response
func (SearchAssistedResponse) GetJSON429 ¶
func (r SearchAssistedResponse) GetJSON429() *Error
GetJSON429 returns the response for an HTTP 429 `application/json` response
func (SearchAssistedResponse) GetJSON503 ¶
func (r SearchAssistedResponse) GetJSON503() *Error
GetJSON503 returns the response for an HTTP 503 `application/json` response
func (SearchAssistedResponse) Status ¶
func (r SearchAssistedResponse) Status() string
Status returns HTTPResponse.Status
func (SearchAssistedResponse) StatusCode ¶
func (r SearchAssistedResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type SearchAssistedResponse200Headers ¶
type SearchAssistedResponse200Headers struct {
XBillingMode *string
XCreditsRemaining *string
XQueryCost *string
XRateLimitLimit *int
XRateLimitRemaining *int
XRateLimitReset *int
XTokensUsed *int
}
SearchAssistedResponse200Headers the declared response headers of an HTTP 200 response for SearchAssisted
type SearchCollectionJSONBody ¶
type SearchCollectionJSONBody struct {
// Filters Optional metadata filter. Two accepted forms.
//
// Flat (top-level keys are ANDed): `{"journal": "Nature", "publication_date": {"gte": "2020-01-01"}}`.
//
// Structured DSL (for OR / nesting): `{"and": [{"field": "journal", "eq": "Nature"}]}`. Operators: `eq`, `ne`, `in`, `not_in`, `gt`, `gte`, `lt`, `lte`, `between`. Combinators: `and`, `or`, `not`.
//
// Exclusion uses `ne` / `not_in` / `not` — there is no separate syntax: `{"and": [{"field": "issn", "not_in": ["1234-5678"]}]}`.
//
// Indexed on every collection (any other field is matched by scanning and returns a `filterWarnings` entry): `article_type`, `doc_id`, `doi`, `issn`, `journal`, `keywords`, `publication_date`, `publisher`, `section`.
//
// Indexed on the editorial collections only (People Inc): `medical_board_approved`, `topic`, `url`.
//
// `issn` accepts hyphenated or bare, upper- or lower-case X (`"1664-302X"`, `"1664302x"`). `doi` is matched case-insensitively and an optional `https://doi.org/` or `doi:` prefix is accepted.
//
// `journal_metric.2yr_mean_citedness`, `journal_metric.h_index` and `journal_metric.i10_index` accept range operators only and are resolved server-side into the matching ISSNs; see `journalMetricExpansions` in the response.
Filters *map[string]interface{} `json:"filters,omitempty"`
// ImageMaxHeight Maximum image height in pixels
ImageMaxHeight *int `json:"imageMaxHeight,omitempty"`
// ImageMaxWidth Maximum image width in pixels
ImageMaxWidth *int `json:"imageMaxWidth,omitempty"`
// ImageQuality JPEG quality for fetched images
ImageQuality *int `json:"imageQuality,omitempty"`
// IncludeFigures Fetch and include figure images as base64 in metadata (adds latency). includeImages is accepted as a deprecated alias.
IncludeFigures *bool `json:"includeFigures,omitempty"`
// IncludeMetadata Whether to include metadata in results
IncludeMetadata *bool `json:"includeMetadata,omitempty"`
// Limit Maximum results to return (default 10, max 30)
Limit *int `json:"limit,omitempty"`
// Query Natural language or keyword search query.
Query string `json:"query"`
}
SearchCollectionJSONBody defines parameters for SearchCollection.
type SearchCollectionJSONRequestBody ¶
type SearchCollectionJSONRequestBody SearchCollectionJSONBody
SearchCollectionJSONRequestBody defines body for SearchCollection for application/json ContentType.
type SearchCollectionOptions ¶
type SearchCollectionOptions struct {
Limit int
Filters any
IncludeMetadata *bool
IncludeFigures *bool
}
SearchCollectionOptions for SearchCollection.
type SearchCollectionResponse ¶
type SearchCollectionResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *SearchResponse
// JSON401 the response for an HTTP 401 `application/json` response
JSON401 *Error
// JSON403 the response for an HTTP 403 `application/json` response
JSON403 *Error
// JSON404 the response for an HTTP 404 `application/json` response
JSON404 *Error
// JSON422 the response for an HTTP 422 `application/json` response
JSON422 *Error
// JSON429 the response for an HTTP 429 `application/json` response
JSON429 *Error
// JSON503 the response for an HTTP 503 `application/json` response
JSON503 *Error
// Headers200 the parsed response headers for an HTTP 200 response
Headers200 *SearchCollectionResponse200Headers
}
func ParseSearchCollectionResponse ¶
func ParseSearchCollectionResponse(rsp *http.Response) (*SearchCollectionResponse, error)
ParseSearchCollectionResponse parses an HTTP response from a SearchCollectionWithResponse call
func (SearchCollectionResponse) ContentType ¶
func (r SearchCollectionResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (SearchCollectionResponse) GetBody ¶
func (r SearchCollectionResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (SearchCollectionResponse) GetJSON200 ¶
func (r SearchCollectionResponse) GetJSON200() *SearchResponse
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (SearchCollectionResponse) GetJSON401 ¶
func (r SearchCollectionResponse) GetJSON401() *Error
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (SearchCollectionResponse) GetJSON403 ¶
func (r SearchCollectionResponse) GetJSON403() *Error
GetJSON403 returns the response for an HTTP 403 `application/json` response
func (SearchCollectionResponse) GetJSON404 ¶
func (r SearchCollectionResponse) GetJSON404() *Error
GetJSON404 returns the response for an HTTP 404 `application/json` response
func (SearchCollectionResponse) GetJSON422 ¶
func (r SearchCollectionResponse) GetJSON422() *Error
GetJSON422 returns the response for an HTTP 422 `application/json` response
func (SearchCollectionResponse) GetJSON429 ¶
func (r SearchCollectionResponse) GetJSON429() *Error
GetJSON429 returns the response for an HTTP 429 `application/json` response
func (SearchCollectionResponse) GetJSON503 ¶
func (r SearchCollectionResponse) GetJSON503() *Error
GetJSON503 returns the response for an HTTP 503 `application/json` response
func (SearchCollectionResponse) Status ¶
func (r SearchCollectionResponse) Status() string
Status returns HTTPResponse.Status
func (SearchCollectionResponse) StatusCode ¶
func (r SearchCollectionResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type SearchCollectionResponse200Headers ¶
type SearchCollectionResponse200Headers struct {
XBillingMode *string
XCacheExpires *time.Time
XCreditsRemaining *string
XQueryCost *string
XRateLimitLimit *int
XRateLimitRemaining *int
XRateLimitReset *int
XTokensUsed *int
}
SearchCollectionResponse200Headers the declared response headers of an HTTP 200 response for SearchCollection
type SearchOptions ¶
type SearchOptions struct {
Collection string
Collections []string
Limit int
Filters any // Filter, map[string]any, or nil
IncludeMetadata *bool
IncludeFigures *bool
}
SearchOptions for Search. Exactly one of Collection / Collections is required.
type SearchQueryJSONRequestBody ¶
type SearchQueryJSONRequestBody = SearchRequest
SearchQueryJSONRequestBody defines body for SearchQuery for application/json ContentType.
type SearchQueryResponse ¶
type SearchQueryResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *SearchResponse
// JSON401 the response for an HTTP 401 `application/json` response
JSON401 *Error
// JSON403 the response for an HTTP 403 `application/json` response
JSON403 *Error
// JSON404 the response for an HTTP 404 `application/json` response
JSON404 *Error
// JSON422 the response for an HTTP 422 `application/json` response
JSON422 *Error
// JSON429 the response for an HTTP 429 `application/json` response
JSON429 *Error
// JSON503 the response for an HTTP 503 `application/json` response
JSON503 *Error
// Headers200 the parsed response headers for an HTTP 200 response
Headers200 *SearchQueryResponse200Headers
}
func ParseSearchQueryResponse ¶
func ParseSearchQueryResponse(rsp *http.Response) (*SearchQueryResponse, error)
ParseSearchQueryResponse parses an HTTP response from a SearchQueryWithResponse call
func (SearchQueryResponse) ContentType ¶
func (r SearchQueryResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (SearchQueryResponse) GetBody ¶
func (r SearchQueryResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (SearchQueryResponse) GetJSON200 ¶
func (r SearchQueryResponse) GetJSON200() *SearchResponse
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (SearchQueryResponse) GetJSON401 ¶
func (r SearchQueryResponse) GetJSON401() *Error
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (SearchQueryResponse) GetJSON403 ¶
func (r SearchQueryResponse) GetJSON403() *Error
GetJSON403 returns the response for an HTTP 403 `application/json` response
func (SearchQueryResponse) GetJSON404 ¶
func (r SearchQueryResponse) GetJSON404() *Error
GetJSON404 returns the response for an HTTP 404 `application/json` response
func (SearchQueryResponse) GetJSON422 ¶
func (r SearchQueryResponse) GetJSON422() *Error
GetJSON422 returns the response for an HTTP 422 `application/json` response
func (SearchQueryResponse) GetJSON429 ¶
func (r SearchQueryResponse) GetJSON429() *Error
GetJSON429 returns the response for an HTTP 429 `application/json` response
func (SearchQueryResponse) GetJSON503 ¶
func (r SearchQueryResponse) GetJSON503() *Error
GetJSON503 returns the response for an HTTP 503 `application/json` response
func (SearchQueryResponse) Status ¶
func (r SearchQueryResponse) Status() string
Status returns HTTPResponse.Status
func (SearchQueryResponse) StatusCode ¶
func (r SearchQueryResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type SearchQueryResponse200Headers ¶
type SearchQueryResponse200Headers struct {
XBillingMode *string
XCacheExpires *time.Time
XCreditsRemaining *string
XQueryCost *string
XRateLimitLimit *int
XRateLimitRemaining *int
XRateLimitReset *int
XTokensUsed *int
}
SearchQueryResponse200Headers the declared response headers of an HTTP 200 response for SearchQuery
type SearchRequest ¶
type SearchRequest struct {
// Collection Name of the collection to search. Mutually exclusive with `collections`.
Collection *string `json:"collection,omitempty"`
// Collections Collections to search together (max 5, unique). Each collection is searched with its own access entitlements and the results are merged into one relevance-ranked list; each result carries its origin `collection`. Mutually exclusive with `collection`.
Collections *[]string `json:"collections,omitempty"`
// Filters Optional metadata filter. Two accepted forms.
//
// Flat (top-level keys are ANDed): `{"journal": "Nature", "publication_date": {"gte": "2020-01-01"}}`.
//
// Structured DSL (for OR / nesting): `{"and": [{"field": "journal", "eq": "Nature"}]}`. Operators: `eq`, `ne`, `in`, `not_in`, `gt`, `gte`, `lt`, `lte`, `between`. Combinators: `and`, `or`, `not`.
//
// Exclusion uses `ne` / `not_in` / `not` — there is no separate syntax: `{"and": [{"field": "issn", "not_in": ["1234-5678"]}]}`.
//
// Indexed on every collection (any other field is matched by scanning and returns a `filterWarnings` entry): `article_type`, `doc_id`, `doi`, `issn`, `journal`, `keywords`, `publication_date`, `publisher`, `section`.
//
// Indexed on the editorial collections only (People Inc): `medical_board_approved`, `topic`, `url`.
//
// `issn` accepts hyphenated or bare, upper- or lower-case X (`"1664-302X"`, `"1664302x"`). `doi` is matched case-insensitively and an optional `https://doi.org/` or `doi:` prefix is accepted.
//
// `journal_metric.2yr_mean_citedness`, `journal_metric.h_index` and `journal_metric.i10_index` accept range operators only and are resolved server-side into the matching ISSNs; see `journalMetricExpansions` in the response.
Filters *map[string]interface{} `json:"filters,omitempty"`
// ImageMaxHeight Maximum image height in pixels
ImageMaxHeight *int `json:"imageMaxHeight,omitempty"`
// ImageMaxWidth Maximum image width in pixels
ImageMaxWidth *int `json:"imageMaxWidth,omitempty"`
// ImageQuality JPEG quality for fetched images
ImageQuality *int `json:"imageQuality,omitempty"`
// IncludeFigures Fetch and include figure images as base64 in metadata (adds latency). includeImages is accepted as a deprecated alias.
IncludeFigures *bool `json:"includeFigures,omitempty"`
// IncludeMetadata Whether to include metadata in results
IncludeMetadata *bool `json:"includeMetadata,omitempty"`
// Limit Maximum results to return (default 10, max 30)
Limit *int `json:"limit,omitempty"`
// Query Natural language or keyword search query.
Query string `json:"query"`
}
SearchRequest Provide exactly one of `collection` (single) or `collections` (multi-collection search).
type SearchResponse ¶
type SearchResponse struct {
// FilterWarnings Advisory warnings about the supplied filter — for example filtering on a field with no payload index, which is matched by scanning. The search still runs. Omitted when there are none.
FilterWarnings *[]FilterWarning `json:"filterWarnings,omitempty"`
// JournalMetricExpansions How each journal-metric condition resolved to ISSNs; omitted when no metric filter was used
JournalMetricExpansions *[]JournalMetricExpansion `json:"journalMetricExpansions,omitempty"`
// LatencyMs Search latency in milliseconds
LatencyMs int `json:"latencyMs"`
// QueryId Unique identifier for this query. Use it to re-fetch the same results for free within 7 days via GET /api/v1/search/results/{queryId}.
QueryId string `json:"queryId"`
// Results Ranked list of matching document chunks.
Results []SearchResult `json:"results"`
}
SearchResponse defines model for SearchResponse.
type SearchResult ¶
type SearchResult struct {
// Collection Origin collection of this result — the name as requested, so a logical collection reports the logical name rather than the physical one it resolves to. Always populated.
Collection *string `json:"collection,omitempty"`
// Id Chunk/point ID
Id string `json:"id"`
// Metadata Document metadata (title, authors, journal, etc.). Null when includeMetadata is false.
Metadata *map[string]interface{} `json:"metadata,omitempty"`
// Text Chunk text content
Text string `json:"text"`
}
SearchResult defines model for SearchResult.
type ValidationError ¶
type ValidationError struct{ APIError }
ValidationError is 422: request rejected (query too long, bad filter, ...).
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error