# RAG

Retrieval, generative answer, and highlight related APIs

## GET /webapi/v2/highlights/{clue\_id}

> Get Highlight

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}},"schemas":{"HighlightResponse":{"properties":{"bboxes":{"items":{"$ref":"#/components/schemas/BboxResponse"},"title":"Bboxes","type":"array"},"type":{"$ref":"#/components/schemas/AnswerType"}},"required":["bboxes","type"],"title":"HighlightResponse","type":"object"},"BboxResponse":{"properties":{"left":{"title":"Left","type":"number"},"top":{"title":"Top","type":"number"},"right":{"title":"Right","type":"number"},"bottom":{"title":"Bottom","type":"number"}},"required":["left","top","right","bottom"],"title":"BboxResponse","type":"object"},"AnswerType":{"description":"Enum representing different types of answers that can be provided.","enum":["PARAGRAPH","TABLE","IMAGE"],"title":"AnswerType","type":"string"}}},"paths":{"/webapi/v2/highlights/{clue_id}":{"get":{"operationId":"django_server_rag_views_rest_answer_highlight_api_get_highlight","summary":"Get Highlight","parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"},{"in":"path","name":"clue_id","schema":{"title":"Clue Id","type":"string"},"required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HighlightResponse"}}}}},"tags":["RAG"]}}}}
```

## Rare Status

> Get RARE build/generate status for the project.

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}},"schemas":{"RareStatusResponse":{"properties":{"build_status":{"title":"Build Status","type":"string"},"job_status":{"title":"Job Status","type":"string"},"job_type":{"title":"Job Type","type":"string"},"build_run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Build Run Id"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"build_progress":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Build Progress"},"generate_progress":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Generate Progress"},"build_stats":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Build Stats"},"generate_stats":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Generate Stats"},"folder_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Folder Ids"},"default_model":{"default":"","title":"Default Model","type":"string"},"generation_model":{"default":"","title":"Generation Model","type":"string"}},"required":["build_status","job_status","job_type"],"title":"RareStatusResponse","type":"object"}}},"paths":{"/webapi/v2/rare/status":{"get":{"operationId":"django_server_rag_views_rest_rare_api_rare_status","summary":"Rare Status","parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RareStatusResponse"}}}}},"description":"Get RARE build/generate status for the project.","tags":["RAG"]}}}}
```

## Rare Build

> Start RARE build task.

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}},"schemas":{"RareJobResponse":{"properties":{"message":{"title":"Message","type":"string"},"task_id":{"title":"Task Id","type":"string"}},"required":["message","task_id"],"title":"RareJobResponse","type":"object"},"RareBuildRequest":{"properties":{"language":{"default":"Korean","title":"Language","type":"string"},"default_model":{"default":"gpt54_nano","title":"Default Model","type":"string"},"similarity_threshold":{"default":0.5,"title":"Similarity Threshold","type":"number"},"top_k_per_chunk":{"default":1,"title":"Top K Per Chunk","type":"integer"},"max_similar_items":{"default":256,"title":"Max Similar Items","type":"integer"},"max_workers":{"default":100,"title":"Max Workers","type":"integer"},"folder_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Folder Ids"}},"title":"RareBuildRequest","type":"object"}}},"paths":{"/webapi/v2/rare/build":{"post":{"operationId":"django_server_rag_views_rest_rare_api_rare_build","summary":"Rare Build","parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RareJobResponse"}}}}},"description":"Start RARE build task.","tags":["RAG"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RareBuildRequest"}}},"required":true}}}}}
```

## Rare Generate

> Start RARE generate task. Requires build to be completed first.

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}},"schemas":{"RareJobResponse":{"properties":{"message":{"title":"Message","type":"string"},"task_id":{"title":"Task Id","type":"string"}},"required":["message","task_id"],"title":"RareJobResponse","type":"object"},"RareGenerateRequest":{"properties":{"num_samples":{"default":10,"title":"Num Samples","type":"integer"},"input_pool_size":{"default":50,"title":"Input Pool Size","type":"integer"},"num_questions":{"default":10,"title":"Num Questions","type":"integer"},"num_information":{"default":2,"title":"Num Information","type":"integer"},"language":{"default":"Korean","title":"Language","type":"string"},"default_model":{"default":"gpt54_nano","title":"Default Model","type":"string"},"generation_model":{"default":"gpt54","title":"Generation Model","type":"string"},"rare_user_prompt":{"default":"","title":"Rare User Prompt","type":"string"}},"title":"RareGenerateRequest","type":"object"}}},"paths":{"/webapi/v2/rare/generate":{"post":{"operationId":"django_server_rag_views_rest_rare_api_rare_generate","summary":"Rare Generate","parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RareJobResponse"}}}}},"description":"Start RARE generate task. Requires build to be completed first.","tags":["RAG"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RareGenerateRequest"}}},"required":true}}}}}
```

## Rare Cancel

> Request cooperative cancellation for a running RARE job.

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}},"schemas":{"RareJobResponse":{"properties":{"message":{"title":"Message","type":"string"},"task_id":{"title":"Task Id","type":"string"}},"required":["message","task_id"],"title":"RareJobResponse","type":"object"}}},"paths":{"/webapi/v2/rare/cancel":{"post":{"operationId":"django_server_rag_views_rest_rare_api_rare_cancel","summary":"Rare Cancel","parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RareJobResponse"}}}}},"description":"Request cooperative cancellation for a running RARE job.","tags":["RAG"]}}}}
```

## Rare Results

> List recent RARE generate results for the project.

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}},"schemas":{"RareResultsResponse":{"properties":{"results":{"items":{"$ref":"#/components/schemas/RareResultItem"},"title":"Results","type":"array"}},"required":["results"],"title":"RareResultsResponse","type":"object"},"RareResultItem":{"properties":{"id":{"title":"Id","type":"string"},"created_at":{"title":"Created At","type":"string"},"n_samples":{"title":"N Samples","type":"integer"},"rare_config":{"title":"Rare Config","type":"string"},"result_file_url":{"title":"Result File Url","type":"string"}},"required":["id","created_at","n_samples","rare_config","result_file_url"],"title":"RareResultItem","type":"object"}}},"paths":{"/webapi/v2/rare/results":{"get":{"operationId":"django_server_rag_views_rest_rare_api_rare_results","summary":"Rare Results","parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RareResultsResponse"}}}}},"description":"List recent RARE generate results for the project.","tags":["RAG"]}}}}
```

## Rare Delete Result

> Delete a RARE generate result by ID.

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}}},"paths":{"/webapi/v2/rare/results/{result_id}":{"delete":{"operationId":"django_server_rag_views_rest_rare_api_rare_delete_result","summary":"Rare Delete Result","parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"},{"in":"path","name":"result_id","schema":{"title":"Result Id","type":"string"},"required":true}],"responses":{"200":{"description":"OK"}},"description":"Delete a RARE generate result by ID.","tags":["RAG"]}}}}
```

## Rare Csv

> Proxy RARE CSV file from storage. Returns JSON with headers + rows.

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}}},"paths":{"/webapi/v2/rare/csv":{"get":{"operationId":"django_server_rag_views_rest_rare_api_rare_csv","summary":"Rare Csv","parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"},{"in":"query","name":"path","schema":{"default":"","title":"Path","type":"string"},"required":false}],"responses":{"200":{"description":"OK"}},"description":"Proxy RARE CSV file from storage. Returns JSON with headers + rows.","tags":["RAG"]}}}}
```

## Run Bulk

> Start bulk processing (GA or RAG).\
> \
> Args:\
> &#x20;   file: CSV file with columns: question, model, search\_type.\
> &#x20;         Optional: target\_answer, target\_clue, hashtag, folder.\
> &#x20;   bulk\_type: "ga" (default) or "rag"

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}}},"paths":{"/webapi/v2/bulk_processing/run":{"post":{"operationId":"django_server_rag_views_rest_bulk_processing_api_run_bulk","summary":"Run Bulk","parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"},{"in":"query","name":"bulk_type","schema":{"default":"ga","enum":["ga","rag"],"title":"Bulk Type","type":"string"},"required":false}],"responses":{"200":{"description":"OK"}},"description":"Start bulk processing (GA or RAG).\n\nArgs:\n    file: CSV file with columns: question, model, search_type.\n          Optional: target_answer, target_clue, hashtag, folder.\n    bulk_type: \"ga\" (default) or \"rag\"","tags":["RAG"],"requestBody":{"content":{"multipart/form-data":{"schema":{"properties":{"file":{"format":"binary","title":"File","type":"string"}},"required":["file"],"title":"FileParams","type":"object"}}},"required":true}}}}}
```

## List Results

> List bulk processing results (GA + RAG combined, paginated).

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}}},"paths":{"/webapi/v2/bulk_processing/results":{"get":{"operationId":"django_server_rag_views_rest_bulk_processing_api_list_results","summary":"List Results","parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"},{"in":"query","name":"page","schema":{"default":1,"title":"Page","type":"integer"},"required":false}],"responses":{"200":{"description":"OK"}},"description":"List bulk processing results (GA + RAG combined, paginated).","tags":["RAG"]}}}}
```

## Download Result

> Download a bulk processing result CSV.

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}}},"paths":{"/webapi/v2/bulk_processing/download":{"get":{"operationId":"django_server_rag_views_rest_bulk_processing_api_download_result","summary":"Download Result","parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"},{"in":"query","name":"file_url","schema":{"title":"File Url","type":"string"},"required":true}],"responses":{"200":{"description":"OK"}},"description":"Download a bulk processing result CSV.","tags":["RAG"]}}}}
```

## Delete Result

> Delete a bulk processing result (GA or RAG) by ID.

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}}},"paths":{"/webapi/v2/bulk_processing/results/{result_id}":{"delete":{"operationId":"django_server_rag_views_rest_bulk_processing_api_delete_result","summary":"Delete Result","parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"},{"in":"path","name":"result_id","schema":{"title":"Result Id","type":"string"},"required":true}],"responses":{"200":{"description":"OK"}},"description":"Delete a bulk processing result (GA or RAG) by ID.","tags":["RAG"]}}}}
```

## Generative Answer API

> Generative Answer API finds an answer from your unstructured text documents, Q\&A, and even from complex tables. It synthesizes information from various sources to provide comprehensive responses to user queries.<br>

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}}},"paths":{"/webapi/generative_answer":{"post":{"tags":["RAG"],"operationId":"getGenerativeAnswer","summary":"Generative Answer API","description":"Generative Answer API finds an answer from your unstructured text documents, Q&A, and even from complex tables. It synthesizes information from various sources to provide comprehensive responses to user queries.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string","required":true,"description":"This is a query string."},"model":{"type":"string","description":"Utilize the LLM of your choice when generating answers. Default model is GPT4o. Please see documentation for available options.\n"},"answerFormat":{"type":"string","description":"Determine the format of the response given for easier integrations. Acceptable values are DRAFTJS and MARKDOWN. Default format is DRAFTJS.\n"},"isStateful":{"type":"boolean","description":"To use follow-up question, previous conversation history is required. The conversation history is managed by threadId. If you set isStateful option to True and enter a threadId, the query will be rewritten with reference to the previous conversation history. Default = False.\n"},"threadId":{"type":"string","format":"uuid","description":"threadId is used when isStateful = True. The first time you start a conversation, send it empty, and from the next query on, send it using the threadId from the output. However, if you want to set the threadId from the beginning, write it as a UUID and send it. Example UUID - 36e7bb2b-1063-47ec-. Default = None.\n"},"promptGroupId":{"type":"string","description":"Select which group prompt from your project to use for generating responses. The ID is located within the URL when viewing the group prompt within the Settings page. This is a very helpful option for a project with multiple different group prompts that are altered for specific tasks.\n"},"mode":{"type":"string","description":"Whether to output data as stream or sync. Current available values: sync OR stream (default=sync). When in stream mode, .json strings with the same output format as sync are outputted as streaming.\n"},"clueText":{"type":"boolean","description":"Whether to include the text of the document used as a clue. Default = False. ONLY works if clues is enabled.\n"},"clues":{"type":"boolean","description":"Whether to include clues in the output that will be used to create a generative answer. Default = False.\n"},"includeCitations":{"type":"boolean","description":"Whether to include detailed citation information in the response. Citations provide structured references to source documents used in generating the answer. Default = False.\n"},"hashtags":{"type":"object","description":"Utilize this feature to scope the search via hashtags on documents or Q&A's. You can include or exclude certain hashtags as well as provide an option of and/or for the hashtags selected.\n","properties":{"qnaInclude":{"type":"array","items":{"type":"string"},"description":"FAQ hashtags to include in the search"},"qnaIncludeOption":{"type":"string","enum":["and","or"],"default":"or","description":"Operator for FAQ include hashtags (and/or)"},"qnaExclude":{"type":"array","items":{"type":"string"},"description":"FAQ hashtags to exclude from the search"},"qnaExcludeOption":{"type":"string","enum":["and","or"],"default":"or","description":"Operator for FAQ exclude hashtags (and/or)"},"docsInclude":{"type":"array","items":{"type":"string"},"description":"Document hashtags to include in the search"},"docsIncludeOption":{"type":"string","enum":["and","or"],"default":"or","description":"Operator for document include hashtags (and/or)"},"docsExclude":{"type":"array","items":{"type":"string"},"description":"Document hashtags to exclude from the search"},"docsExcludeOption":{"type":"string","enum":["and","or"],"default":"or","description":"Operator for document exclude hashtags (and/or)"}}},"search_from":{"type":"array","items":{"type":"string"},"description":"Specifies the range of source data for Generative Answer to find data from. Currently available values are: web, qna, document, and enter data in the form of a list. For example -> [\"web\", \"qna\"]\n"},"temperature":{"type":"number","description":"Controls the randomness of the output. Higher values make the output more random. Default = 0."},"source":{"type":"object","description":"Source configuration for knowledge bases and folders. This is the preferred way to specify search scope. Use this instead of the legacy knowledgeBaseIds/folderIds parameters.\n","properties":{"sharedKnowledgeBaseNodeIds":{"type":"array","items":{"type":"string"},"description":"List of shared knowledge base or folder node IDs (global IDs) to search. Use empty array [] to search all shared documents. Use null to exclude shared documents from search.\n"},"personalKnowledgeBaseNodeIds":{"type":"array","items":{"type":"string"},"description":"List of personal knowledge base or folder node IDs (global IDs) to search. Use empty array [] to search all personal documents. Use null to exclude personal documents from search.\n"},"webSites":{"type":"array","items":{"type":"string"},"description":"List of web sites to search."}}},"knowledgeBaseIds":{"type":"array","items":{"type":"string"},"description":"(Legacy) Limits the search to specific knowledge base IDs. Use 'source' parameter instead for better control over shared/personal documents.\n"},"folderIds":{"type":"array","items":{"type":"string"},"description":"(Legacy) Limits the search to specific folder IDs. Use 'source' parameter instead for better control over shared/personal documents.\n"}}}}}},"responses":{"200":{"description":"Successfully generated answer","content":{"application/json":{"schema":{"type":"object","properties":{"answer":{"type":"object","description":"It's the answer extracted from uploaded documents in the dashboard, formatted according to the answerFormat parameter.\n"},"answerHash":{"type":"string","description":"This is used to identify the answer to give or cancel feedback."},"confidence":{"type":"number","description":"It shows the confidence value from AI model. Shown as a number value between 0 and 1.\n"},"effectiveConfidence":{"type":"number","description":"When you provide feedback to the query result, it automatically trains the AI model. Effective confidence is the adjusted score with these users' and agents' feedback. Shown as a number value between 0 and 1.\n"},"documentId":{"type":"string","description":"The document's ID where the answer is extracted from."},"documentName":{"type":"string","description":"The document's name where the answer is extracted from."},"hashtags":{"type":"array","description":"The hashtags attached to the document."},"pageNo":{"type":"integer","description":"The page number in the document where the answer was derived."},"createdDate":{"type":"string","format":"date","description":"The date when the document was uploaded."},"agentFeedback":{"type":"object","description":"The feedback from agents (through dashboard and REST calls) about this document."},"userFeedback":{"type":"object","description":"The feedback from users about this document."},"body":{"type":"string","description":"If returnPreview is true in the request, the html body of the document search preview is displayed."},"css":{"type":"string","description":"If returnPreview is true in the request, the css of the document search preview is displayed."},"pdfPreview":{"type":"string","description":"If returnPdfPreview is true in the request, the URL to a PDF preview of the document with the answer highlighted is displayed. Note that the URL can be restricted using the Download IP Allowlist setting.\n"},"folder":{"type":"string","description":"If the answer is found from a folder under the Documents database, the folder name will be returned here."},"editor":{"type":"array","items":{"type":"string"},"description":"List of the agents' email who has the editor access to the documents (if they're set in the Alli dashboard)."},"viewer":{"type":"array","items":{"type":"string"},"description":"List of the agents' email who has the viewer access to the documents (if they're set in the Alli dashboard)."},"threadId":{"type":"string","description":"A UUID that can be used for follow-up questions when isStateful is true."},"fuQuestion":{"type":"string","description":"Suggested follow-up question for the user when isStateful is true."},"intent":{"type":"string","description":"The detected intent of the query."},"clues":{"type":"array","description":"If clues is true in the request, the sources used to generate the answer are returned here.\n"},"citations":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","description":"Citation number referenced in the answer text as [1], [2], etc."},"clueId":{"type":"string","description":"Unique identifier for the source clue"},"source":{"type":"string","description":"Type of source (DOCUMENT, FAQ, WEB)"},"title":{"type":"string","description":"Title of the source document or FAQ"},"pageNo":{"type":"integer","description":"Page number in the source document"},"knowledgeBaseId":{"type":"string","description":"ID of the knowledge base document"},"faqId":{"type":"string","description":"ID of the FAQ entry"},"url":{"type":"string","description":"URL of web source"},"text":{"type":"string","description":"Excerpt of the source text (limited to 500 characters)"}}},"description":"If includeCitations is true in the request, structured citation information is returned here. Each citation corresponds to a [number] reference in the answer text.\n"}}}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"string","description":"Error message"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"string","description":"Error message"}}}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"string","description":"Rate Limit Exceed"}}}}}}},"parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"}]}}}}
```

## Alli Retrieval API

> The Retrieval API allows you to obtain the top N page information related to a question from documents uploaded to Alli. This API combines keyword search and semantic search capabilities to provide the most relevant document pages for your queries.<br>

```json
{"openapi":"3.1.0","info":{"title":"Alli API Documentation","version":"1.0.0"},"tags":[{"name":"RAG","description":"Retrieval, generative answer, and highlight related APIs"}],"servers":[{"url":"https://backend.alli.ai","description":"US"},{"url":"https://backend-ja.alli.ai","description":"JA"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"ProjectIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"API-KEY","description":"Your API key for authentication"},"TokenAuth":{"type":"http","scheme":"bearer","description":"Your token for authentication"}},"parameters":{"AgentEmailHeader":{"name":"AGENT-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email of the agent to use for this request"},"UserEmailHeader":{"name":"USER-EMAIL","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: Email address to associate with the user"},"OwnUserIdHeader":{"name":"OWN-USER-ID","in":"header","required":false,"schema":{"type":"string"},"description":"Optional: User ID to identify or create a user"}}},"paths":{"/webapi/retrieval":{"post":{"tags":["RAG"],"operationId":"retrievalPost","summary":"Alli Retrieval API","description":"The Retrieval API allows you to obtain the top N page information related to a question from documents uploaded to Alli. This API combines keyword search and semantic search capabilities to provide the most relevant document pages for your queries.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string","description":"Question to search for in the document base","required":true},"maxDocumentClues":{"type":"integer","description":"Determines how many related pages to retrieve. The default value is 3.\n"},"bm25_score_weight":{"type":"number","format":"float","description":"This is the weight for keyword search. The higher this value, the more the keyword score is reflected. Values between 0-9 are appropriate, with a value of 0 meaning keyword search is not used. The default value is 9.\n"},"text_vector_score_weight":{"type":"number","format":"float","description":"This is the weight for semantic search on document content. The higher this value, the more it is reflected. Values between 0-9 are appropriate, with a value of 0 meaning semantic search on document content is not used. The default value is 1.\n"},"title_vector_score_weight":{"type":"number","format":"float","description":"This is the weight for semantic search on document titles. Similarly, values between 0-9 are appropriate, with a value of 0 meaning semantic search on document titles is not used. The default value is 0.\n"},"hashtags":{"type":"array","items":{"type":"string"},"description":"Filter results to include only documents with these hashtags"},"hashtags_operator":{"type":"string","enum":["and","or"],"description":"Logical operator for hashtags (default is \"or\")"},"exclude_hashtags":{"type":"array","items":{"type":"string"},"description":"Filter results to exclude documents with these hashtags"},"exclude_hashtags_operator":{"type":"string","enum":["and","or"],"description":"Logical operator for exclude_hashtags (default is \"or\")"},"targetFolders":{"type":"array","items":{"type":"string"},"description":"Names of folders to search within"},"folderIds":{"type":"array","items":{"type":"string"},"description":"IDs of folders to search within"},"knowledgeBaseIds":{"type":"array","items":{"type":"string"},"description":"IDs of specific knowledge bases to search within"},"use_keywords":{"type":"boolean","description":"Whether to extract and use keywords for search"},"use_clue_feedback":{"type":"boolean","description":"Whether to use feedback data to improve search results"},"use_reranker":{"type":"boolean","description":"Overrides the project's cognitive_config.use_reranker for this request. When omitted, the project config value is used.\n"},"reranker_candidates_num":{"type":"integer","description":"Overrides the number of candidate pages passed to the reranker. Only effective when reranking is enabled. Defaults to 16 when omitted.\n"},"reranker_max_tokens":{"type":"integer","description":"Overrides the maximum token length per candidate sent to the reranker. Only effective when reranking is enabled. Defaults to 1024 when omitted.\n"}}}}}},"responses":{"200":{"description":"Successfully retrieved results","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"array","items":{"type":"object","properties":{"ranking":{"type":"integer","description":"Rank of the page related to the question"},"title":{"type":"string","description":"Title of the document related to the question"},"text":{"type":"string","description":"Content of the page related to the question"},"pageNo":{"type":"integer","description":"Page number"},"kb_id":{"type":"string","description":"ID of the knowledge base document"}}}}}}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}},"parameters":[{"$ref":"#/components/parameters/AgentEmailHeader"},{"$ref":"#/components/parameters/UserEmailHeader"},{"$ref":"#/components/parameters/OwnUserIdHeader"}]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.allganize.ai/api-reference/rag.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
