github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/chatgpt-retrieval-plugin/templates/configmap.yaml (about)

     1  apiVersion: v1
     2  kind: ConfigMap
     3  metadata:
     4    name: gptplugin-config
     5    namespace: {{ .Release.Namespace | quote }}
     6    labels:
     7    {{- include "gptplugin.labels" . | nindent 4 }}
     8  
     9  data:
    10    ai-plugin.json: |-
    11      {
    12        "schema_version": "v1",
    13        "name_for_model": "retrieval",
    14        "name_for_human": "Retrieval Plugin",
    15        "description_for_model": "Plugin for searching through the user's documents (such as files, emails, and more) to find answers to questions and retrieve relevant information. Use it whenever a user asks something that might be found in their personal information, or asks you to save information for later.",
    16        "description_for_human": "Search through your documents.",
    17        "auth": {
    18          "type": "user_http",
    19          "authorization_type": "bearer"
    20        },
    21        "api": {
    22          "type": "openapi",
    23          "url": "{{- .Values.website.url | default "https://your-app-url.com/.well-known/openapi.yaml"}}",
    24          "has_user_authentication": false
    25        },
    26        "logo_url": "{{- .Values.website.logo_url | default "https://your-app-url.com/.well-known/logo.png"}}",
    27        "contact_email": "{{- .Values.website.contact_email | default "admin@kubeblocks.io"}}",
    28        "legal_info_url": "{{- .Values.website.legal_info_url | default "admin@kubeblocks.io"}}"
    29      }
    30    openapi.yaml: |-
    31      openapi: 3.0.2
    32      info:
    33        title: Retrieval Plugin API
    34        description: A retrieval API for querying and filtering documents based on natural language queries and metadata
    35        version: 1.0.0
    36      servers:
    37        - url: "{{- .Values.servers.url | default "https://your-app-url.com"}}"
    38      paths:
    39        /upsert:
    40          post:
    41            summary: Upsert
    42            description: Save chat information. Accepts an array of documents with text (potential questions + conversation text), metadata (source 'chat' and timestamp, no ID as this will be generated). Confirm with the user before saving, ask for more details/context.
    43            operationId: upsert_upsert_post
    44            requestBody:
    45              content:
    46                application/json:
    47                  schema:
    48                    $ref: "#/components/schemas/UpsertRequest"
    49              required: true
    50            responses:
    51              "200":
    52                description: Successful Response
    53                content:
    54                  application/json:
    55                    schema:
    56                      $ref: "#/components/schemas/UpsertResponse"
    57              "422":
    58                description: Validation Error
    59                content:
    60                  application/json:
    61                    schema:
    62                      $ref: "#/components/schemas/HTTPValidationError"
    63            security:
    64              - HTTPBearer: [ ]
    65        /query:
    66          post:
    67            summary: Query
    68            description: Accepts search query objects array each with query and optional filter. Break down complex questions into sub-questions. Refine results by criteria, e.g. time / source, don't do this often. Split queries if ResponseTooLargeError occurs.
    69            operationId: query_query_post
    70            requestBody:
    71              content:
    72                application/json:
    73                  schema:
    74                    $ref: "#/components/schemas/QueryRequest"
    75              required: true
    76            responses:
    77              "200":
    78                description: Successful Response
    79                content:
    80                  application/json:
    81                    schema:
    82                      $ref: "#/components/schemas/QueryResponse"
    83              "422":
    84                description: Validation Error
    85                content:
    86                  application/json:
    87                    schema:
    88                      $ref: "#/components/schemas/HTTPValidationError"
    89            security:
    90              - HTTPBearer: [ ]
    91      components:
    92        schemas:
    93          Document:
    94            title: Document
    95            required:
    96              - text
    97            type: object
    98            properties:
    99              id:
   100                title: Id
   101                type: string
   102              text:
   103                title: Text
   104                type: string
   105              metadata:
   106                $ref: "#/components/schemas/DocumentMetadata"
   107          DocumentChunkMetadata:
   108            title: DocumentChunkMetadata
   109            type: object
   110            properties:
   111              source:
   112                $ref: "#/components/schemas/Source"
   113              source_id:
   114                title: Source Id
   115                type: string
   116              url:
   117                title: Url
   118                type: string
   119              created_at:
   120                title: Created At
   121                type: string
   122              author:
   123                title: Author
   124                type: string
   125              document_id:
   126                title: Document Id
   127                type: string
   128          DocumentChunkWithScore:
   129            title: DocumentChunkWithScore
   130            required:
   131              - text
   132              - metadata
   133              - score
   134            type: object
   135            properties:
   136              id:
   137                title: Id
   138                type: string
   139              text:
   140                title: Text
   141                type: string
   142              metadata:
   143                $ref: "#/components/schemas/DocumentChunkMetadata"
   144              embedding:
   145                title: Embedding
   146                type: array
   147                items:
   148                  type: number
   149              score:
   150                title: Score
   151                type: number
   152          DocumentMetadata:
   153            title: DocumentMetadata
   154            type: object
   155            properties:
   156              source:
   157                $ref: "#/components/schemas/Source"
   158              source_id:
   159                title: Source Id
   160                type: string
   161              url:
   162                title: Url
   163                type: string
   164              created_at:
   165                title: Created At
   166                type: string
   167              author:
   168                title: Author
   169                type: string
   170          DocumentMetadataFilter:
   171            title: DocumentMetadataFilter
   172            type: object
   173            properties:
   174              document_id:
   175                title: Document Id
   176                type: string
   177              source:
   178                $ref: "#/components/schemas/Source"
   179              source_id:
   180                title: Source Id
   181                type: string
   182              author:
   183                title: Author
   184                type: string
   185              start_date:
   186                title: Start Date
   187                type: string
   188              end_date:
   189                title: End Date
   190                type: string
   191          HTTPValidationError:
   192            title: HTTPValidationError
   193            type: object
   194            properties:
   195              detail:
   196                title: Detail
   197                type: array
   198                items:
   199                  $ref: "#/components/schemas/ValidationError"
   200          Query:
   201            title: Query
   202            required:
   203              - query
   204            type: object
   205            properties:
   206              query:
   207                title: Query
   208                type: string
   209              filter:
   210                $ref: "#/components/schemas/DocumentMetadataFilter"
   211              top_k:
   212                title: Top K
   213                type: integer
   214                default: 3
   215          QueryRequest:
   216            title: QueryRequest
   217            required:
   218              - queries
   219            type: object
   220            properties:
   221              queries:
   222                title: Queries
   223                type: array
   224                items:
   225                  $ref: "#/components/schemas/Query"
   226          QueryResponse:
   227            title: QueryResponse
   228            required:
   229              - results
   230            type: object
   231            properties:
   232              results:
   233                title: Results
   234                type: array
   235                items:
   236                  $ref: "#/components/schemas/QueryResult"
   237          QueryResult:
   238            title: QueryResult
   239            required:
   240              - query
   241              - results
   242            type: object
   243            properties:
   244              query:
   245                title: Query
   246                type: string
   247              results:
   248                title: Results
   249                type: array
   250                items:
   251                  $ref: "#/components/schemas/DocumentChunkWithScore"
   252          Source:
   253            title: Source
   254            enum:
   255              - email
   256              - file
   257              - chat
   258            type: string
   259            description: An enumeration.
   260          UpsertRequest:
   261            title: UpsertRequest
   262            required:
   263              - documents
   264            type: object
   265            properties:
   266              documents:
   267                title: Documents
   268                type: array
   269                items:
   270                  $ref: "#/components/schemas/Document"
   271          UpsertResponse:
   272            title: UpsertResponse
   273            required:
   274              - ids
   275            type: object
   276            properties:
   277              ids:
   278                title: Ids
   279                type: array
   280                items:
   281                  type: string
   282          ValidationError:
   283            title: ValidationError
   284            required:
   285              - loc
   286              - msg
   287              - type
   288            type: object
   289            properties:
   290              loc:
   291                title: Location
   292                type: array
   293                items:
   294                  anyOf:
   295                    - type: string
   296                    - type: integer
   297              msg:
   298                title: Message
   299                type: string
   300              type:
   301                title: Error Type
   302                type: string
   303        securitySchemes:
   304          HTTPBearer:
   305            type: http
   306            scheme: bearer