LogoLogo
Home
  • Introduction
  • Quickstart
    • Starter guide
    • Core Concepts
      • Stack Type
      • Data Loader
      • Inputs/Outputs
      • Text Splitters
      • Embedding Model
      • Vector Store
      • Large Language Model
      • Memory
      • Chain
    • Testing Stack
    • Deployment
    • Knowledge Base
    • Organization and Teams
    • Secret Keys
    • Logs
  • Components
    • Inputs
    • Outputs
    • Document Loaders
    • Prompts
    • Text Splitters
    • Embeddings
    • Vector Store
    • Retrievers
    • Multi Modals
    • Agents
    • Large Language Models
    • Memories
    • Chains
    • Output Parsers
  • Customization
    • Writing Custom Components in GenAI Stack
    • Build your own custom component
    • Define parameters used for required components
  • Usecases
    • Simple QA using Open Source Large Language Models
    • Multilingual Indic Language Translation
    • Document Search and Chat
    • Chat with Multiple Documents
  • Terminologies
    • RAG - Retrieval Augmented Generation
    • Hybrid Search - Ensemble Retriever
  • REST APIs
    • GenAI Stack REST APIs
    • Chat API Reference
    • Text Generation API Reference
    • Rate Limiting and Sleep Mode
  • Troubleshooting
    • How to verify what is loaded and chunked from the loader?
  • Acknowledgements
    • Special Mentions
Powered by GitBook
On this page

Was this helpful?

  1. REST APIs

Text Generation API Reference

PreviousChat API ReferenceNextRate Limiting and Sleep Mode

Last updated 1 year ago

Was this helpful?

Following are the steps to use Test it feature.

  • Replace the {{url}} with the deployed url.

  • Get the from the GenAI Stack for authentication.

  • Now you're ready to test the APIs.

api key

Health

get
Responses
200
Successful Response
application/json
Responseany
get
GET /health HTTP/1.1
Host: {{url}}
Accept: */*
200

Successful Response

No content

Get Stack App

get

Retrieve the stack app instance.

This endpoint fetches the stack app, including its associated chat sessions or text generations based on the interface type selected, using the provided token/api key.

Parameters:

  • authorization: str - Provide your API key as a Bearer token in the Authorization header to authenticate requests.

Responses:

  • 200 OK: Returns a detailed view of the stack app including chat sessions and text generations.
  • 404 Not Found: If no stack app is found for the given criteria.

Exceptions:

  • Raises a 404 HTTPException if no stack app is found.
Query parameters
tokenstringOptional
Header parameters
authorizationstringOptional
Responses
200
Successful Response
application/json
422
Validation Error
application/json
get
GET /api/v1/apps HTTP/1.1
Host: {{url}}
Accept: */*
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "data": {},
  "form_keys_data": {},
  "stack_type": "chat",
  "chat_sessions": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "title": "text",
      "data": [
        {
          "is_bot": true,
          "message": "text",
          "chatKey": "text",
          "type": "text",
          "intermediate_steps": "text",
          "files": []
        }
      ]
    }
  ],
  "text_generations": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "title": "text",
      "inputs": {},
      "outputs": {},
      "logs": "text",
      "meta_data": {},
      "status": "pending"
    }
  ]
}

List Text Generations

get

Retrieves a list of text generations created by the authenticated user, ordered by creation date in descending order.

Parameters:

  • authorization: str - Provide your API key as a Bearer token in the Authorization header to authenticate requests.

Responses:

  • 200 OK: Returns a list of TextGenerationRead objects, each representing a text generation instance.
  • 401 Unauthorized: User authentication failed.

Exceptions:

  • Raises 401 HTTPException for unauthorized access.

This endpoint allows users to view all their text generation activities within the system, providing a comprehensive history of generated texts.

Query parameters
tokenstringOptional
Header parameters
authorizationstringOptional
Responses
200
Successful Response
application/json
422
Validation Error
application/json
get
GET /api/v1/generations HTTP/1.1
Host: {{url}}
Accept: */*
[
  {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "title": "text",
    "inputs": {},
    "outputs": {},
    "logs": "text",
    "meta_data": {},
    "status": "pending"
  }
]

Create Text Generation

post

Creates a new text generation request based on the input provided and associates it with the authenticated user.

Parameters:

  • request: Request - The request object, allowing access to the request body.
  • authorization: str - Provide your API key as a Bearer token in the Authorization header to authenticate requests.

Request Body: The body should contain form data representing the inputs for text generation. form data should be a list of dict(s).

  • input_key: str - A key for identifying a input or the specific pipeline this upload is associated with.
  • input_value: str | UploadFile - A resource to be associated with the input_key for Text Generation session.

Responses:

  • 200 OK: Successfully creates a new text generation instance and returns its details as a TextGenerationRead object.
  • 401 Unauthorized: User authentication failed.

Exceptions:

  • Raises 401 HTTPException for unauthorized access.

Upon successful creation, this endpoint asynchronously triggers the text generation process and returns the created instance's details without waiting for the generation to complete.

Query parameters
tokenstringOptional
Header parameters
authorizationstringOptional
Responses
200
Successful Response
application/json
422
Validation Error
application/json
post
POST /api/v1/generations HTTP/1.1
Host: {{url}}
Accept: */*
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "title": "text",
  "inputs": {},
  "outputs": {},
  "logs": "text",
  "meta_data": {},
  "status": "pending"
}

Read Text Generation

get

Retrieves the details of a specific text generation instance by its ID, for the authenticated user.

Parameters:

  • text_gen_id: str - The unique identifier of the text generation instance to retrieve.
  • authorization: str - Provide your API key as a Bearer token in the Authorization header to authenticate requests.

Responses:

  • 200 OK: Returns the details of the specified text generation instance as a TextGenerationRead object.
  • 400 Bad Request: If the text_gen_id is not a valid UUID.
  • 401 Unauthorized: User authentication failed.
  • 404 Not Found: If no text generation instance is found matching the text_gen_id for the authenticated user.

This endpoint allows users to access detailed information about a specific text generation activity, including its inputs and any generated outputs.

Path parameters
text_gen_idstringRequired
Query parameters
tokenstringOptional
Header parameters
authorizationstringOptional
Responses
200
Successful Response
application/json
422
Validation Error
application/json
get
GET /api/v1/generations/{text_gen_id} HTTP/1.1
Host: {{url}}
Accept: */*
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "title": "text",
  "inputs": {},
  "outputs": {},
  "logs": "text",
  "meta_data": {},
  "status": "pending"
}
  • GETHealth
  • GETGet Stack App
  • GETList Text Generations
  • POSTCreate Text Generation
  • GETRead Text Generation
  • PATCHUpdate Text Generation

Update Text Generation

patch

Updates the title of a text generation session.

Parameters:

  • TextGenerationUpdate - The request body containing the title to be updated.
  • text_gen_id: str - The unique identifier of the text generation instance to retrieve.
  • authorization: str - Provide your API key as a Bearer token in the Authorization header to authenticate requests.

Responses:

  • 200 OK: Returns the details of the specified text generation instance as a TextGenerationRead object after updating it.
  • 400 Bad Request: If the text_gen_id is not a valid UUID.
  • 401 Unauthorized: User authentication failed.
  • 404 Not Found: If no text generation instance is found matching the text_gen_id for the authenticated user.

This endpoint allows users to update the title of text generation session.

Path parameters
text_gen_idstringRequired
Query parameters
tokenstringOptional
Header parameters
authorizationstringOptional
Body
titleany ofOptional
stringOptional
or
nullOptional
Responses
200
Successful Response
application/json
422
Validation Error
application/json
patch
PATCH /api/v1/generations/{text_gen_id} HTTP/1.1
Host: {{url}}
Content-Type: application/json
Accept: */*
Content-Length: 16

{
  "title": "text"
}
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "title": "text",
  "inputs": {},
  "outputs": {},
  "logs": "text",
  "meta_data": {},
  "status": "pending"
}