> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aryn.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit Plan

> Take an existing plan and user feedback to rewrite it.



## OpenAPI

````yaml api-reference/endpoint/platform/openapi.json patch /v1/query/plan
openapi: 3.1.0
info:
  title: Aryn Platform API
  version: 0.1.0
servers:
  - url: https://api.aryn.cloud
    description: US Region
  - url: https://api.aryn.ai
    description: US Region
  - url: https://api.us.aryn.cloud
    description: US Region
  - url: https://api.us.aryn.ai
    description: US Region
security: []
paths:
  /v1/query/plan:
    patch:
      tags:
        - Query
      summary: Edit Plan
      description: Take an existing plan and user feedback to rewrite it.
      operationId: edit_plan_v1_query_plan_patch
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_edit_plan_v1_query_plan_patch'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogicalPlan'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    Body_edit_plan_v1_query_plan_patch:
      properties:
        query:
          $ref: '#/components/schemas/Query'
        feedback:
          type: string
          title: Feedback
          description: Feedback about the existing plan or instructions to modify it.
      type: object
      required:
        - query
        - feedback
      title: Body_edit_plan_v1_query_plan_patch
    LogicalPlan:
      properties:
        query:
          type: string
          title: Query
          description: The query that the plan is for.
        nodes:
          additionalProperties:
            $ref: '#/components/schemas/Node'
          type: object
          title: Nodes
          description: A mapping of node IDs to nodes in the query plan.
        result_node:
          type: integer
          title: Result Node
          description: The ID of the node that is the result of the query.
        llm_prompt:
          anyOf:
            - {}
            - type: 'null'
          title: Llm Prompt
          description: The LLM prompt that was used to generate this query plan.
        llm_plan:
          anyOf:
            - type: string
            - type: 'null'
          title: Llm Plan
          description: The result generated by the LLM.
      type: object
      required:
        - query
        - nodes
        - result_node
      title: LogicalPlan
      description: A logical query plan used to evaluate a query.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Query:
      properties:
        docset_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Docset Id
          description: The docset against which to run the query
        query:
          anyOf:
            - type: string
            - type: 'null'
          title: Query
          description: >-
            The natural language query to run. if specified, `plan` must not be
            set.
        plan:
          anyOf:
            - $ref: '#/components/schemas/LogicalPlan'
            - type: 'null'
          description: >-
            The logical query plan to run. If specified, `query` must not be
            set.
        stream:
          type: boolean
          title: Stream
          description: >-
            If true, query results will be streamed back to the client as they
            are generated. Applies only when calling the query api.
          default: false
        summarize_result:
          type: boolean
          title: Summarize Result
          description: >-
            If true, an english summary of the result in context of the original
            query will be returned.

            Applies only when calling the query API and only available when
            `stream=True`
          default: false
        rag_mode:
          type: boolean
          title: Rag Mode
          description: If true, the query will only run a RAG query plan.
          default: false
      type: object
      title: Query
      description: >-
        A query against a DocSet. Contains either a natural language string or a
        query plan.
    Node:
      properties:
        node_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Node Type
          description: The type of this node.
        node_id:
          type: integer
          title: Node Id
          description: A unique integer ID representing this node.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: >-
            A detailed description of why this operator was chosen for this
            query plan.
          exclude_from_comparison: true
        inputs:
          items:
            type: integer
          type: array
          title: Inputs
          description: A list of node IDs that this operation depends on.
          default: []
      additionalProperties: true
      type: object
      required:
        - node_id
      title: Node
      description: A single operation in a logical plan.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````