List all instructions.
from ragie import Ragie
with Ragie(
auth="<YOUR_BEARER_TOKEN_HERE>",
) as r_client:
res = r_client.entities.list_instructions()
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
List[models.Instruction]
| Error Type |
Status Code |
Content Type |
| models.ErrorMessage |
401, 402, 429 |
application/json |
| models.ErrorMessage |
500 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Create a new instruction. Instructions are applied to documents as they are created or updated. The results of the instruction are stored as structured data in the schema defined by the entity_schema parameter. The prompt parameter is a natural language instruction which will be applied to documents. This feature is in beta and may change in the future.
import ragie
from ragie import Ragie
with Ragie(
auth="<YOUR_BEARER_TOKEN_HERE>",
) as r_client:
res = r_client.entities.create_instruction(request={
"name": "Find all pizzas",
"scope": ragie.CreateInstructionParamsScope.DOCUMENT,
"prompt": "Find all pizzas described in the text.",
"context_template": "Document: {{document.name}} {{document.metadata.key_foo}}",
"entity_schema": {
"key": "<value>",
"key1": "<value>",
},
"filter_": {
"toppings": {
"$in": [
"pizza",
"mushrooms",
],
},
},
"partition": "<value>",
})
# Handle response
print(res)
models.Instruction
| Error Type |
Status Code |
Content Type |
| models.HTTPValidationError |
422 |
application/json |
| models.ErrorMessage |
401, 402, 429 |
application/json |
| models.ErrorMessage |
500 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Delete an instruction. This will delete the instruction and all entities generated by it. This operation is irreversible.
from ragie import Ragie
with Ragie(
auth="<YOUR_BEARER_TOKEN_HERE>",
) as r_client:
res = r_client.entities.delete_instruction(instruction_id="00000000-0000-0000-0000-000000000000")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
Example |
instruction_id |
str |
✔️ |
The ID of the instruction. |
00000000-0000-0000-0000-000000000000 |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
Dict[str, str]
| Error Type |
Status Code |
Content Type |
| models.HTTPValidationError |
422 |
application/json |
| models.ErrorMessage |
401, 402, 429 |
application/json |
| models.ErrorMessage |
500 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Patch Instruction
import ragie
from ragie import Ragie
with Ragie(
auth="<YOUR_BEARER_TOKEN_HERE>",
) as r_client:
res = r_client.entities.update_instruction(instruction_id="00000000-0000-0000-0000-000000000000", patch_instruction_params={
"name": "Find all pizzas",
"active": True,
"scope": ragie.PatchInstructionParamsScope.DOCUMENT,
"prompt": "Find all pizzas described in the text.",
"context_template": "Document: {{document.name}} {{document.metadata.key_foo}}",
"filter_": {
"toppings": {
"$in": [
"pizza",
"mushrooms",
],
},
},
})
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
Example |
instruction_id |
str |
✔️ |
The ID of the instruction. |
00000000-0000-0000-0000-000000000000 |
patch_instruction_params |
models.PatchInstructionParams |
✔️ |
N/A |
|
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
models.Instruction
| Error Type |
Status Code |
Content Type |
| models.HTTPValidationError |
422 |
application/json |
| models.ErrorMessage |
401, 402, 429 |
application/json |
| models.ErrorMessage |
500 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Get Instruction Extracted Entities
from ragie import Ragie
with Ragie(
auth="<YOUR_BEARER_TOKEN_HERE>",
) as r_client:
res = r_client.entities.list_by_instruction(request={
"instruction_id": "00000000-0000-0000-0000-000000000000",
"partition": "acme_customer_id",
})
while res is not None:
# Handle items
res = res.next()
models.ListEntitiesByInstructionResponse
| Error Type |
Status Code |
Content Type |
| models.HTTPValidationError |
422 |
application/json |
| models.ErrorMessage |
401, 402, 429 |
application/json |
| models.ErrorMessage |
500 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
list_extraction_logs
List entity extraction logs for an instruction. Results are attempt-level and include both successful and unsuccessful extraction outcomes. Results are sorted by created_at in descending order and paginated. Historical extraction attempts before 2026-03-06 are unavailable in this endpoint.
from ragie import Ragie
with Ragie(
auth="<YOUR_BEARER_TOKEN_HERE>",
) as r_client:
res = r_client.entities.list_extraction_logs(request={
"instruction_id": "00000000-0000-0000-0000-000000000000",
"partition": "acme_customer_id",
})
while res is not None:
# Handle items
res = res.next()
models.ListInstructionEntityExtractionLogsResponse
| Error Type |
Status Code |
Content Type |
| models.HTTPValidationError |
422 |
application/json |
| models.ErrorMessage |
401, 402, 429 |
application/json |
| models.ErrorMessage |
500 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |
Get Document Extracted Entities
from ragie import Ragie
with Ragie(
auth="<YOUR_BEARER_TOKEN_HERE>",
) as r_client:
res = r_client.entities.list_by_document(request={
"document_id": "00000000-0000-0000-0000-000000000000",
"partition": "acme_customer_id",
})
while res is not None:
# Handle items
res = res.next()
models.ListEntitiesByDocumentResponse
| Error Type |
Status Code |
Content Type |
| models.HTTPValidationError |
422 |
application/json |
| models.ErrorMessage |
401, 402, 429 |
application/json |
| models.ErrorMessage |
500 |
application/json |
| models.SDKError |
4XX, 5XX |
*/* |