Updated on Sep 14, 2023

1

min read

API (/context)

GET

Updated on Sep 14, 2023

1

min read

API (/context)

GET

Updated on Sep 14, 2023

1

min read

API (/context)

GET

GET /context/[document_id]

Retrieve a relevant intelligence extracted from the given document, based on the collection's intelligence configuration (e.g. "what's the SOP for alert X?")

URL:

GET https://api.vesana.dev/v1/context/[document_id]

Headers:

x-Vesana-API-key: YOUR_API_KEY

Query Parameters:

  • text (str): The text to match against the intelligences (or the raw text)

  • num_chunks (int): The number of chunks to include in the results IFF the match is the raw text, if level != 1 (e.g. in a case where level=3 is "paragraph", how many paragraphs to get before and after the matching paragraph). All of the contents are returned if the text matches with a generated intelligence.

Response:

{ "status": "success", "result": { "document_id": "string", "context": "string"} }

Example:

GET /v1/context/12345?text="What's the SOP for when the water level goes over 30"&count=2 HTTP/1.1 Host: api.yourdomain.com x-Vesana-API-key: YOUR_API_KEY

Response:

{ "status": "success", "results": { "document_id": "12345", "context": "The SOP for when the water..." } }

See https://vesana.dev/docs/auth-error for error details in case of "status": "error"

GET /context/[document_id]

Retrieve a relevant intelligence extracted from the given document, based on the collection's intelligence configuration (e.g. "what's the SOP for alert X?")

URL:

GET https://api.vesana.dev/v1/context/[document_id]

Headers:

x-Vesana-API-key: YOUR_API_KEY

Query Parameters:

  • text (str): The text to match against the intelligences (or the raw text)

  • num_chunks (int): The number of chunks to include in the results IFF the match is the raw text, if level != 1 (e.g. in a case where level=3 is "paragraph", how many paragraphs to get before and after the matching paragraph). All of the contents are returned if the text matches with a generated intelligence.

Response:

{ "status": "success", "result": { "document_id": "string", "context": "string"} }

Example:

GET /v1/context/12345?text="What's the SOP for when the water level goes over 30"&count=2 HTTP/1.1 Host: api.yourdomain.com x-Vesana-API-key: YOUR_API_KEY

Response:

{ "status": "success", "results": { "document_id": "12345", "context": "The SOP for when the water..." } }

See https://vesana.dev/docs/auth-error for error details in case of "status": "error"

GET /context/[document_id]

Retrieve a relevant intelligence extracted from the given document, based on the collection's intelligence configuration (e.g. "what's the SOP for alert X?")

URL:

GET https://api.vesana.dev/v1/context/[document_id]

Headers:

x-Vesana-API-key: YOUR_API_KEY

Query Parameters:

  • text (str): The text to match against the intelligences (or the raw text)

  • num_chunks (int): The number of chunks to include in the results IFF the match is the raw text, if level != 1 (e.g. in a case where level=3 is "paragraph", how many paragraphs to get before and after the matching paragraph). All of the contents are returned if the text matches with a generated intelligence.

Response:

{ "status": "success", "result": { "document_id": "string", "context": "string"} }

Example:

GET /v1/context/12345?text="What's the SOP for when the water level goes over 30"&count=2 HTTP/1.1 Host: api.yourdomain.com x-Vesana-API-key: YOUR_API_KEY

Response:

{ "status": "success", "results": { "document_id": "12345", "context": "The SOP for when the water..." } }

See https://vesana.dev/docs/auth-error for error details in case of "status": "error"