// This file is auto-generated by @hey-api/openapi-ts

export type ClientOptions = {
  baseUrl: `${string}://${string}/v1` | (string & {})
}

export type AgentThought = {
  answer?: string | null
  chain_id?: string | null
  created_at?: number | null
  files: Array<string>
  id: string
  message_id: string
  observation?: string | null
  position: number
  thought?: string | null
  tool?: string | null
  tool_input?: string | null
  tool_labels: JsonValue
}

export type Annotation = {
  answer?: string | null
  created_at?: number | null
  hit_count?: number | null
  id: string
  question?: string | null
}

export type AnnotationCreatePayload = {
  answer: string
  question: string
}

export type AnnotationJobStatusDetailResponse = {
  error_msg?: string
  job_id: string
  job_status: 'completed' | 'error' | 'processing' | 'waiting' | string
}

export type AnnotationJobStatusResponse = {
  job_id: string
  job_status: 'completed' | 'error' | 'processing' | 'waiting' | string
}

export type AnnotationList = {
  data: Array<Annotation>
  has_more: boolean
  limit: number
  page: number
  total: number
}

export type AnnotationListQuery = {
  keyword?: string
  limit?: number
  page?: number
}

export type AnnotationReplyActionPayload = {
  embedding_model_name: string
  embedding_provider_name: string
  score_threshold: number
}

export type AppFeedbackListResponse = {
  data: Array<AppFeedbackResponse>
}

export type AppFeedbackResponse = {
  app_id: string
  content?: string | null
  conversation_id: string
  created_at: string
  from_account_id?: string | null
  from_end_user_id?: string | null
  from_source: string
  id: string
  message_id: string
  rating: string
  updated_at: string
}

export type AppInfoResponse = {
  author_name: string | null
  description: string | null
  mode: string
  name: string
  tags: Array<string>
}

export type AppMetaResponse = {
  tool_icons?: {
    [key: string]: unknown
  }
}

export type AudioBinaryResponse = Blob | File

export type AudioTranscriptResponse = {
  text: string
}

export type BinaryFileResponse = Blob | File

export type ButtonStyle = 'accent' | 'default' | 'ghost' | 'primary'

export type ChatRequestPayload = {
  auto_generate_name?: boolean
  conversation_id?: string | null
  files?: Array<{
    transfer_method: 'local_file' | 'remote_url'
    type: 'audio' | 'custom' | 'document' | 'image' | 'video'
    upload_file_id?: string
    url?: string
  }> | null
  inputs: {
    [key: string]: unknown
  }
  query: string
  response_mode?: 'blocking' | 'streaming' | null
  workflow_id?: string | null
}

export type ChatRequestPayloadWithUser = {
  auto_generate_name?: boolean
  conversation_id?: string | null
  files?: Array<{
    transfer_method: 'local_file' | 'remote_url'
    type: 'audio' | 'custom' | 'document' | 'image' | 'video'
    upload_file_id?: string
    url?: string
  }> | null
  inputs: {
    [key: string]: unknown
  }
  query: string
  response_mode?: 'blocking' | 'streaming' | null
  user: string
  workflow_id?: string | null
}

export type ChildChunkCreatePayload = {
  content: string
}

export type ChildChunkDetailResponse = {
  data: ChildChunkResponse
}

export type ChildChunkListQuery = {
  keyword?: string | null
  limit?: number
  page?: number
}

export type ChildChunkListResponse = {
  data: Array<ChildChunkResponse>
  limit: number
  page: number
  total: number
  total_pages: number
}

export type ChildChunkResponse = {
  content: string
  created_at: number
  id: string
  position: number
  segment_id: string
  type: string
  updated_at: number
  word_count: number
}

export type ChildChunkUpdatePayload = {
  content: string
}

export type CompletionRequestPayload = {
  files?: Array<{
    transfer_method: 'local_file' | 'remote_url'
    type: 'audio' | 'custom' | 'document' | 'image' | 'video'
    upload_file_id?: string
    url?: string
  }> | null
  inputs: {
    [key: string]: unknown
  }
  query?: string
  response_mode?: 'blocking' | 'streaming' | null
}

export type CompletionRequestPayloadWithUser = {
  files?: Array<{
    transfer_method: 'local_file' | 'remote_url'
    type: 'audio' | 'custom' | 'document' | 'image' | 'video'
    upload_file_id?: string
    url?: string
  }> | null
  inputs: {
    [key: string]: unknown
  }
  query?: string
  response_mode?: 'blocking' | 'streaming' | null
  user: string
}

export type Condition = {
  comparison_operator:
    | '<'
    | '='
    | '>'
    | 'after'
    | 'before'
    | 'contains'
    | 'empty'
    | 'end with'
    | 'in'
    | 'is'
    | 'is not'
    | 'not contains'
    | 'not empty'
    | 'not in'
    | 'start with'
    | '≠'
    | '≤'
    | '≥'
  name: string
  value?: string | Array<string> | number | null
}

export type ConversationInfiniteScrollPagination = {
  data: Array<SimpleConversation>
  has_more: boolean
  limit: number
}

export type ConversationListQuery = {
  last_id?: string | null
  limit?: number
  sort_by?: '-created_at' | '-updated_at' | 'created_at' | 'updated_at'
}

export type ConversationRenamePayload = (
  | {
      auto_generate: true
      name?: string | null
    }
  | {
      auto_generate?: false
      name: string
    }
) & {
  auto_generate?: boolean
  name?: string | null
}

export type ConversationRenamePayloadWithUser = (
  | {
      auto_generate: true
      name?: string | null
      user?: string
    }
  | {
      auto_generate?: false
      name: string
      user?: string
    }
) & {
  auto_generate?: boolean
  name?: string | null
  user?: string
}

export type ConversationVariableInfiniteScrollPaginationResponse = {
  data: Array<ConversationVariableResponse>
  has_more: boolean
  limit: number
}

export type ConversationVariableResponse = {
  created_at?: number | null
  description?: string | null
  id: string
  name: string
  updated_at?: number | null
  value?: string | null
  value_type: string
}

export type ConversationVariableUpdatePayload = {
  value: unknown
}

export type ConversationVariableUpdatePayloadWithUser = {
  user?: string
  value: unknown
}

export type ConversationVariablesQuery = {
  last_id?: string | null
  limit?: number
  variable_name?: string | null
}

export type CustomConfigurationStatus = 'active' | 'no-configure'

export type DatasetBoundTagListResponse = {
  data: Array<DatasetBoundTagResponse>
  total: number
}

export type DatasetBoundTagResponse = {
  id: string
  name: string
}

export type DatasetCreatePayload = {
  description?: string
  embedding_model?: string | null
  embedding_model_provider?: string | null
  external_knowledge_api_id?: string | null
  external_knowledge_id?: string | null
  indexing_technique?: 'economy' | 'high_quality' | null
  name: string
  permission?: PermissionEnum | null
  provider?: 'external' | 'vendor'
  retrieval_model?: RetrievalModel | null
  summary_index_setting?: {
    enable?: boolean
    model_name?: string
    model_provider_name?: string
    summary_prompt?: string
  } | null
}

export type DatasetDetailResponse = {
  app_count: number
  author_name: string | null
  built_in_field_enabled: boolean
  chunk_structure: string | null
  created_at: number
  created_by: string
  data_source_type: string | null
  description: string | null
  doc_form: string | null
  doc_metadata: Array<DatasetDocMetadataResponse>
  document_count: number
  embedding_available?: boolean | null
  embedding_model: string | null
  embedding_model_provider: string | null
  enable_api: boolean
  external_knowledge_info?: DatasetExternalKnowledgeInfoResponse
  external_retrieval_model: DatasetExternalRetrievalModelResponse | null
  icon_info?: DatasetIconInfoResponse
  id: string
  indexing_technique: string | null
  is_multimodal: boolean
  is_published: boolean
  maintainer?: string | null
  name: string
  permission: string
  permission_keys?: Array<string>
  pipeline_id: string | null
  provider: string
  retrieval_model_dict: DatasetRetrievalModelResponse
  runtime_mode: string | null
  summary_index_setting?: DatasetSummaryIndexSettingResponse
  tags: Array<DatasetTagResponse>
  total_available_documents: number
  total_documents: number
  updated_at: number
  updated_by: string | null
  word_count: number
}

export type DatasetDetailWithPartialMembersResponse = {
  app_count: number
  author_name: string | null
  built_in_field_enabled: boolean
  chunk_structure: string | null
  created_at: number
  created_by: string
  data_source_type: string | null
  description: string | null
  doc_form: string | null
  doc_metadata: Array<DatasetDocMetadataResponse>
  document_count: number
  embedding_available?: boolean | null
  embedding_model: string | null
  embedding_model_provider: string | null
  enable_api: boolean
  external_knowledge_info?: DatasetExternalKnowledgeInfoResponse
  external_retrieval_model: DatasetExternalRetrievalModelResponse | null
  icon_info?: DatasetIconInfoResponse
  id: string
  indexing_technique: string | null
  is_multimodal: boolean
  is_published: boolean
  maintainer?: string | null
  name: string
  partial_member_list?: Array<string> | null
  permission: string
  permission_keys?: Array<string>
  pipeline_id: string | null
  provider: string
  retrieval_model_dict: DatasetRetrievalModelResponse
  runtime_mode: string | null
  summary_index_setting?: DatasetSummaryIndexSettingResponse
  tags: Array<DatasetTagResponse>
  total_available_documents: number
  total_documents: number
  updated_at: number
  updated_by: string | null
  word_count: number
}

export type DatasetDocMetadataResponse = {
  id: string
  name: string
  type: string
}

export type DatasetExternalKnowledgeInfoResponse = {
  external_knowledge_api_endpoint?: string | null
  external_knowledge_api_id?: string | null
  external_knowledge_api_name?: string | null
  external_knowledge_id?: string | null
}

export type DatasetExternalRetrievalModelResponse = {
  score_threshold?: number | null
  score_threshold_enabled?: boolean | null
  top_k: number
}

export type DatasetIconInfoResponse = {
  icon?: string | null
  icon_background?: string | null
  icon_type?: string | null
  icon_url?: string | null
}

export type DatasetKeywordSettingResponse = {
  keyword_weight?: number | null
}

export type DatasetListQuery = {
  include_all?: boolean
  keyword?: string | null
  limit?: number
  page?: number
  tag_ids?: Array<string>
}

export type DatasetListResponse = {
  data: Array<DatasetDetailResponse>
  has_more: boolean
  limit: number
  page: number
  total: number
}

export type DatasetMetadataActionResponse = {
  result: string
}

export type DatasetMetadataBuiltInFieldResponse = {
  name: string
  type: string
}

export type DatasetMetadataBuiltInFieldsResponse = {
  fields: Array<DatasetMetadataBuiltInFieldResponse>
}

export type DatasetMetadataListItemResponse = {
  count?: number
  id: string
  name: string
  type: string
}

export type DatasetMetadataListResponse = {
  built_in_field_enabled: boolean
  doc_metadata: Array<DatasetMetadataListItemResponse>
}

export type DatasetMetadataResponse = {
  id: string
  name: string
  type: string
}

export type DatasetRerankingModelResponse = {
  reranking_model_name?: string | null
  reranking_provider_name?: string | null
}

export type DatasetRetrievalModelResponse = {
  reranking_enable: boolean
  reranking_mode?: string | null
  reranking_model?: DatasetRerankingModelResponse
  score_threshold?: number | null
  score_threshold_enabled: boolean
  search_method: string
  top_k: number
  weights?: DatasetWeightedScoreResponse | null
}

export type DatasetSummaryIndexSettingResponse = {
  enable?: boolean | null
  model_name?: string | null
  model_provider_name?: string | null
  summary_prompt?: string | null
}

export type DatasetTagResponse = {
  id: string
  name: string
  type: string
}

export type DatasetUpdatePayload = {
  description?: string | null
  embedding_model?: string | null
  embedding_model_provider?: string | null
  external_knowledge_api_id?: string | null
  external_knowledge_id?: string | null
  external_retrieval_model?: {
    score_threshold?: number
    score_threshold_enabled?: boolean
    top_k?: number
  } | null
  indexing_technique?: 'economy' | 'high_quality' | null
  name?: string | null
  partial_member_list?: Array<{
    user_id?: string
  }> | null
  permission?: PermissionEnum | null
  retrieval_model?: RetrievalModel | null
}

export type DatasetVectorSettingResponse = {
  embedding_model_name?: string | null
  embedding_provider_name?: string | null
  vector_weight?: number | null
}

export type DatasetWeightedScoreResponse = {
  keyword_setting?: DatasetKeywordSettingResponse
  vector_setting?: DatasetVectorSettingResponse
  weight_type?: string | null
}

export type DatasourceCredentialInfoResponse = {
  id?: string | null
  is_default?: boolean | null
  name?: string | null
  type?: string | null
}

export type DatasourceNodeRunPayload = {
  credential_id?: string | null
  datasource_type: 'local_file' | 'online_document' | 'online_drive' | 'website_crawl'
  inputs: {
    [key: string]: unknown
  }
  is_published: boolean
}

export type DatasourcePluginListResponse = Array<DatasourcePluginResponse>

export type DatasourcePluginResponse = {
  credentials?: Array<DatasourceCredentialInfoResponse>
  datasource_type?: string | null
  node_id?: string | null
  plugin_id?: string | null
  provider_name?: string | null
  title?: string | null
  user_input_variables?: Array<{
    [key: string]: unknown
  }>
}

export type DatasourcePluginsQuery = {
  is_published?: boolean
}

export type DocumentAndBatchResponse = {
  batch: string
  document: DocumentResponse
}

export type DocumentBatchDownloadZipPayload = {
  document_ids: Array<string>
}

export type DocumentDetailResponse = {
  archived?: boolean
  average_segment_length?: number | number
  completed_at?: number | null
  created_at?: number
  created_by?: string
  created_from?: string
  data_source_info?: {
    [key: string]: unknown
  }
  data_source_type?: string
  dataset_process_rule?: {
    [key: string]: unknown
  }
  dataset_process_rule_id?: string | null
  disabled_at?: number | null
  disabled_by?: string | null
  display_status?: string | null
  doc_form?: string
  doc_language?: string | null
  doc_metadata?:
    | Array<DocumentMetadataResponse>
    | {
        [key: string]: unknown
      }
    | null
  doc_type?: string | null
  document_process_rule?: {
    [key: string]: unknown
  }
  enabled?: boolean
  error?: string | null
  hit_count?: number
  id: string
  indexing_latency?: number | null
  indexing_status?: string
  name?: string
  need_summary?: boolean
  position?: number
  segment_count?: number
  summary_index_status?: string | null
  tokens?: number | null
  updated_at?: number | null
}

export type DocumentGetQuery = {
  metadata?: 'all' | 'only' | 'without'
}

export type DocumentListQuery = {
  keyword?: string | null
  limit?: number
  page?: number
  status?:
    | 'archived'
    | 'available'
    | 'disabled'
    | 'error'
    | 'indexing'
    | 'paused'
    | 'queuing'
    | null
}

export type DocumentListResponse = {
  data: Array<DocumentResponse>
  has_more: boolean
  limit: number
  page: number
  total: number
}

export type DocumentMetadataOperation = {
  document_id: string
  metadata_list: Array<MetadataDetail>
  partial_update?: boolean
}

export type DocumentMetadataResponse = {
  id: string
  name: string
  type: string
  value?: string | number | number | boolean | null
}

export type DocumentResponse = {
  archived?: boolean | null
  created_at?: number | null
  created_by?: string | null
  created_from?: string | null
  data_source_detail_dict?: unknown
  data_source_info?: unknown
  data_source_type?: string | null
  dataset_process_rule_id?: string | null
  disabled_at?: number | null
  disabled_by?: string | null
  display_status?: string | null
  doc_form?: string | null
  doc_metadata?: Array<DocumentMetadataResponse>
  enabled?: boolean | null
  error?: string | null
  hit_count?: number | null
  id: string
  indexing_status?: string | null
  name: string
  need_summary?: boolean | null
  position?: number | null
  summary_index_status?: string | null
  tokens?: number | null
  word_count?: number | null
}

export type DocumentStatusListResponse = {
  data: Array<DocumentStatusResponse>
}

export type DocumentStatusPayload = {
  document_ids?: Array<string>
}

export type DocumentStatusResponse = {
  cleaning_completed_at: number | null
  completed_at: number | null
  completed_segments?: number | null
  error: string | null
  id: string
  indexing_status: string
  parsing_completed_at: number | null
  paused_at: number | null
  processing_started_at: number | null
  splitting_completed_at: number | null
  stopped_at: number | null
  total_segments?: number | null
}

export type DocumentTextCreatePayload = {
  doc_form?: 'hierarchical_model' | 'qa_model' | 'text_model'
  doc_language?: string
  embedding_model?: string | null
  embedding_model_provider?: string | null
  indexing_technique?: 'economy' | 'high_quality' | null
  name: string
  original_document_id?: string | null
  process_rule?: ProcessRule | null
  retrieval_model?: RetrievalModel | null
  text: string
}

export type DocumentTextUpdate = (
  | {
      doc_form?: 'hierarchical_model' | 'qa_model' | 'text_model'
      doc_language?: string
      name: string
      process_rule?: ProcessRule | null
      retrieval_model?: RetrievalModel | null
      text: string
    }
  | {
      doc_form?: 'hierarchical_model' | 'qa_model' | 'text_model'
      doc_language?: string
      name?: string | null
      process_rule?: ProcessRule | null
      retrieval_model?: RetrievalModel | null
      text?: null
    }
) & {
  doc_form?: 'hierarchical_model' | 'qa_model' | 'text_model'
  doc_language?: string
  name?: string | null
  process_rule?: ProcessRule | null
  retrieval_model?: RetrievalModel | null
  text?: string | null
}

export type EndUserDetail = {
  app_id?: string | null
  created_at: string
  external_user_id?: string | null
  id: string
  is_anonymous: boolean
  name?: string | null
  session_id: string
  tenant_id: string
  type: string
  updated_at: string
}

export type EventStreamResponse = string

export type ExecutionContentType = 'human_input'

export type FeedbackListQuery = {
  limit?: number
  page?: number
}

export type FetchFrom = 'customizable-model' | 'predefined-model'

export type FileInputConfig = {
  allowed_file_extensions?: Array<string>
  allowed_file_types?: Array<FileType>
  allowed_file_upload_methods?: Array<FileTransferMethod>
  output_variable_name: string
  type?: 'file'
}

export type FileListInputConfig = {
  allowed_file_extensions?: Array<string>
  allowed_file_types?: Array<FileType>
  allowed_file_upload_methods?: Array<FileTransferMethod>
  number_limits?: number
  output_variable_name: string
  type?: 'file-list'
}

export type FilePreviewQuery = {
  as_attachment?: boolean
}

export type FileResponse = {
  conversation_id?: string | null
  created_at?: number | null
  created_by?: string | null
  extension?: string | null
  file_key?: string | null
  id: string
  mime_type?: string | null
  name: string
  original_url?: string | null
  preview_url?: string | null
  reference?: string | null
  size: number
  source_url?: string | null
  tenant_id?: string | null
  user_id?: string | null
}

export type FileTransferMethod = 'datasource_file' | 'local_file' | 'remote_url' | 'tool_file'

export type FileType = 'audio' | 'custom' | 'document' | 'image' | 'video'

export type FormInputConfig =
  | ({
      type: 'paragraph'
    } & ParagraphInputConfig)
  | ({
      type: 'select'
    } & SelectInputConfig)
  | ({
      type: 'file'
    } & FileInputConfig)
  | ({
      type: 'file-list'
    } & FileListInputConfig)

export type GeneratedAppResponse = JsonValue

export type HitTestingChildChunk = {
  content: string
  id: string
  position: number
  score: number
}

export type HitTestingDocument = {
  data_source_type: string
  doc_metadata: unknown | null
  doc_type: string | null
  id: string
  name: string
}

export type HitTestingFile = {
  extension: string
  id: string
  mime_type: string
  name: string
  size: number
  source_url: string
}

export type HitTestingPayload = {
  attachment_ids?: Array<string> | null
  external_retrieval_model?: {
    score_threshold?: number
    score_threshold_enabled?: boolean
    top_k?: number
  } | null
  query: string
  retrieval_model?: RetrievalModel | null
}

export type HitTestingQuery = {
  content: string
}

export type HitTestingRecord = {
  child_chunks: Array<HitTestingChildChunk>
  files: Array<HitTestingFile>
  score: number | null
  segment: HitTestingSegment
  summary: string | null
  tsne_position: unknown | null
}

export type HitTestingResponse = {
  query: HitTestingQuery
  records: Array<HitTestingRecord>
}

export type HitTestingSegment = {
  answer: string | null
  completed_at: number | null
  content: string
  created_at: number
  created_by: string
  disabled_at: number | null
  disabled_by: string | null
  document: HitTestingDocument
  document_id: string
  enabled: boolean
  error: string | null
  hit_count: number
  id: string
  index_node_hash: string | null
  index_node_id: string | null
  indexing_at: number | null
  keywords: Array<string>
  position: number
  sign_content: string | null
  status: string
  stopped_at: number | null
  tokens: number
  word_count: number
}

export type HumanInputContent = {
  form_definition?: HumanInputFormDefinition | null
  form_submission_data?: HumanInputFormSubmissionData | null
  submitted: boolean
  type?: ExecutionContentType
  workflow_run_id: string
}

export type HumanInputFormDefinition = {
  actions?: Array<UserActionConfig>
  display_in_ui?: boolean
  expiration_time: number
  form_content: string
  form_id: string
  form_token?: string | null
  inputs?: Array<FormInputConfig>
  node_id: string
  node_title: string
  resolved_default_values?: {
    [key: string]: unknown
  }
}

export type HumanInputFormDefinitionResponse = {
  expiration_time?: number | null
  form_content: string
  inputs?: Array<{
    [key: string]: unknown
  }>
  resolved_default_values: {
    [key: string]: string
  }
  user_actions?: Array<{
    [key: string]: unknown
  }>
}

export type HumanInputFormSubmissionData = {
  action_id: string
  action_text: string
  node_id: string
  node_title: string
  rendered_content: string
  submitted_data?: {
    [key: string]: JsonValue2
  } | null
}

export type HumanInputFormSubmitPayload = {
  action: string
  inputs: {
    [key: string]: JsonValue2
  }
}

export type HumanInputFormSubmitPayloadWithUser = {
  action: string
  inputs: {
    [key: string]: JsonValue2
  }
  user: string
}

export type HumanInputFormSubmitResponse = {
  [key: string]: never
}

export type I18nObject = {
  en_US: string
  zh_Hans?: string | null
}

export type IndexInfoResponse = {
  api_version: string
  server_version: string
  welcome: string
}

export type JsonObject = {
  [key: string]: unknown
}

export type JsonValue =
  | string
  | number
  | number
  | boolean
  | {
      [key: string]: unknown
    }
  | Array<unknown>
  | null

export type JsonValueType = unknown

export type JsonValue2 = unknown

export type KnowledgeTagListResponse = Array<KnowledgeTagResponse>

export type KnowledgeTagResponse = {
  binding_count?: string | null
  id: string
  name: string
  type: string
}

export type MessageFeedbackPayload = {
  content?: string | null
  rating?: 'dislike' | 'like' | null
}

export type MessageFeedbackPayloadWithUser = {
  content?: string | null
  rating?: 'dislike' | 'like' | null
  user: string
}

export type MessageFile = {
  belongs_to?: string | null
  filename: string
  id: string
  mime_type?: string | null
  size?: number | null
  transfer_method: string
  type: string
  upload_file_id?: string | null
  url?: string | null
}

export type MessageInfiniteScrollPagination = {
  data: Array<MessageListItem>
  has_more: boolean
  limit: number
}

export type MessageListItem = {
  agent_thoughts: Array<AgentThought>
  answer: string
  answer_tokens?: number
  conversation_id: string
  created_at?: number | null
  currency?: string | null
  error?: string | null
  extra_contents: Array<HumanInputContent>
  feedback?: SimpleFeedback | null
  id: string
  inputs: {
    [key: string]: JsonValueType
  }
  message_files: Array<MessageFile>
  message_tokens?: number
  parent_message_id?: string | null
  provider_response_latency?: number
  query: string
  retriever_resources: Array<RetrieverResource>
  status: string
  total_price?: string | null
  readonly total_tokens: number
}

export type MessageListQuery = {
  conversation_id: string
  first_id?: string | null
  limit?: number
}

export type MetadataArgs = {
  name: string
  type: 'number' | 'string' | 'time'
}

export type MetadataDetail = {
  id: string
  name: string
  value?: string | number | number | null
}

export type MetadataFilteringCondition = {
  conditions?: Array<Condition> | null
  logical_operator?: 'and' | 'or' | null
}

export type MetadataOperationData = {
  operation_data: Array<DocumentMetadataOperation>
}

export type MetadataUpdatePayload = {
  name: string
}

export type ModelFeature =
  | 'agent-thought'
  | 'audio'
  | 'document'
  | 'multi-tool-call'
  | 'polling'
  | 'stream-tool-call'
  | 'structured-output'
  | 'tool-call'
  | 'video'
  | 'vision'

export type ModelPropertyKey =
  | 'audio_type'
  | 'context_size'
  | 'default_voice'
  | 'file_upload_limit'
  | 'max_characters_per_chunk'
  | 'max_chunks'
  | 'max_workers'
  | 'mode'
  | 'supported_file_extensions'
  | 'voices'
  | 'word_limit'

export type ModelStatus =
  | 'active'
  | 'credential-removed'
  | 'disabled'
  | 'no-configure'
  | 'no-permission'
  | 'quota-exceeded'

export type ModelType = 'llm' | 'moderation' | 'rerank' | 'speech2text' | 'text-embedding' | 'tts'

export type OptionalServiceApiUserPayload = {
  user?: string
}

export type ParagraphInputConfig = {
  default?: StringSource | null
  output_variable_name: string
  type?: 'paragraph'
}

export type Parameters = {
  annotation_reply: JsonObject
  file_upload: JsonObject
  more_like_this: JsonObject
  opening_statement?: string | null
  retriever_resource: JsonObject
  sensitive_word_avoidance: JsonObject
  speech_to_text: JsonObject
  suggested_questions: Array<string>
  suggested_questions_after_answer: JsonObject
  system_parameters: SystemParameters
  text_to_speech: JsonObject
  user_input_form: Array<JsonObject>
}

export type PermissionEnum = 'all_team_members' | 'only_me' | 'partial_members'

export type PipelineRunApiEntity = {
  datasource_info_list: Array<
    | {
        name?: string
        reference: string
      }
    | {
        credential_id?: string
        page: {
          page_id: string
          page_name?: string
          type: string
        }
        workspace_id: string
      }
    | {
        title?: string
        url: string
      }
    | {
        bucket?: string
        id: string
        name?: string
        type: 'file' | 'folder'
      }
  >
  datasource_type: 'local_file' | 'online_document' | 'online_drive' | 'website_crawl'
  inputs: {
    [key: string]: unknown
  }
  is_published: boolean
  response_mode: 'blocking' | 'streaming'
  start_node_id: string
}

export type PipelineUploadFileResponse = {
  created_at?: string | null
  created_by: string
  extension: string
  id: string
  mime_type?: string | null
  name: string
  size: number
}

export type PreProcessingRule = {
  enabled: boolean
  id: 'remove_extra_spaces' | 'remove_stopwords' | 'remove_urls_emails'
}

export type ProcessRule = {
  mode: ProcessRuleMode
  rules?: Rule | null
}

export type ProcessRuleMode = 'automatic' | 'custom' | 'hierarchical'

export type ProviderModelWithStatusEntity = {
  deprecated?: boolean
  features?: Array<ModelFeature> | null
  fetch_from: FetchFrom
  has_invalid_load_balancing_configs?: boolean
  label: I18nObject
  load_balancing_enabled?: boolean
  model: string
  model_properties: {
    [key in ModelPropertyKey]?: unknown
  }
  model_type: ModelType
  status: ModelStatus
}

export type ProviderWithModelsListResponse = {
  data: Array<ProviderWithModelsResponse>
}

export type ProviderWithModelsResponse = {
  icon_small?: I18nObject | null
  icon_small_dark?: I18nObject | null
  label: I18nObject
  models: Array<ProviderModelWithStatusEntity>
  provider: string
  status: CustomConfigurationStatus
  tenant_id: string
}

export type RequiredServiceApiUserPayload = {
  user: string
}

export type RerankingModel = {
  reranking_model_name?: string | null
  reranking_provider_name?: string | null
}

export type ResultResponse = {
  result: string
}

export type RetrievalMethod =
  | 'full_text_search'
  | 'hybrid_search'
  | 'keyword_search'
  | 'semantic_search'

export type RetrievalModel = {
  metadata_filtering_conditions?: MetadataFilteringCondition | null
  reranking_enable: boolean
  reranking_mode?: 'reranking_model' | 'weighted_score' | null
  reranking_model?: RerankingModel | null
  score_threshold?: number | null
  score_threshold_enabled: boolean
  search_method: RetrievalMethod
  top_k: number
  weights?: WeightModel | null
}

export type RetrieverResource = {
  content?: string | null
  created_at?: number | null
  data_source_type?: string | null
  dataset_id?: string | null
  dataset_name?: string | null
  document_id?: string | null
  document_name?: string | null
  hit_count?: number | null
  id?: string
  index_node_hash?: string | null
  message_id?: string
  position: number
  score?: number | null
  segment_id?: string | null
  segment_position?: number | null
  summary?: string | null
  word_count?: number | null
}

export type Rule = {
  parent_mode?: 'full-doc' | 'paragraph' | null
  pre_processing_rules?: Array<PreProcessingRule> | null
  segmentation?: Segmentation | null
  subchunk_segmentation?: Segmentation | null
}

export type SegmentAttachmentResponse = {
  extension: string
  id: string
  mime_type: string | null
  name: string
  size: number
  source_url: string
}

export type SegmentCreateItemPayload = {
  answer?: string | null
  attachment_ids?: Array<string> | null
  content: string
  keywords?: Array<string> | null
}

export type SegmentCreateListResponse = {
  data: Array<SegmentResponse>
  doc_form: string
}

export type SegmentCreatePayload = {
  segments: Array<SegmentCreateItemPayload>
}

export type SegmentDetailResponse = {
  data: SegmentResponse
  doc_form: string
}

export type SegmentListQuery = {
  keyword?: string | null
  limit?: number
  page?: number
  status?: Array<string>
}

export type SegmentListResponse = {
  data: Array<SegmentResponse>
  doc_form: string
  has_more: boolean
  limit: number
  page: number
  total: number
}

export type SegmentResponse = {
  answer: string | null
  attachments: Array<SegmentAttachmentResponse>
  child_chunks: Array<ChildChunkResponse>
  completed_at: number | null
  content: string
  created_at: number
  created_by: string
  disabled_at: number | null
  disabled_by: string | null
  document_id: string
  enabled: boolean
  error: string | null
  hit_count: number
  id: string
  index_node_hash: string | null
  index_node_id: string | null
  indexing_at: number | null
  keywords: Array<string> | null
  position: number
  sign_content: string
  status: string
  stopped_at: number | null
  summary: string | null
  tokens: number
  updated_at: number
  updated_by: string | null
  word_count: number
}

export type SegmentUpdateArgs = {
  answer?: string | null
  attachment_ids?: Array<string> | null
  content?: string | null
  enabled?: boolean | null
  keywords?: Array<string> | null
  regenerate_child_chunks?: boolean
  summary?: string | null
}

export type SegmentUpdatePayload = {
  segment: SegmentUpdateArgs
}

export type Segmentation = {
  chunk_overlap?: number
  max_tokens: number
  separator?: string
}

export type SelectInputConfig = {
  option_source: StringListSource
  output_variable_name: string
  type?: 'select'
}

export type SimpleAccountResponse = {
  email: string
  id: string
  name: string
}

export type SimpleConversation = {
  created_at?: number | null
  id: string
  inputs: {
    [key: string]: JsonValue
  }
  introduction?: string | null
  name: string
  status: string
  updated_at?: number | null
}

export type SimpleEndUser = {
  id: string
  is_anonymous: boolean
  session_id?: string | null
  type: string
}

export type SimpleFeedback = {
  rating?: string | null
}

export type SimpleResultResponse = {
  result: string
}

export type SimpleResultStringListResponse = {
  data: Array<string>
  result: string
}

export type Site = {
  chat_color_theme?: string | null
  chat_color_theme_inverted: boolean
  copyright?: string | null
  custom_disclaimer?: string | null
  default_language: string
  description?: string | null
  icon?: string | null
  icon_background?: string | null
  icon_type?: string | null
  readonly icon_url: string | null
  input_placeholder?: string | null
  privacy_policy?: string | null
  show_workflow_steps: boolean
  title: string
  use_icon_as_answer_icon: boolean
}

export type StringListSource = {
  selector?: Array<string>
  type: ValueSourceType
  value?: Array<string>
}

export type StringSource = {
  selector?: Array<string>
  type: ValueSourceType
  value?: string
}

export type SystemParameters = {
  audio_file_size_limit: number
  file_size_limit: number
  image_file_size_limit: number
  video_file_size_limit: number
  workflow_file_upload_limit: number
}

export type TagBindingPayload = {
  tag_ids: Array<string>
  target_id: string
}

export type TagCreatePayload = {
  name: string
}

export type TagDeletePayload = {
  tag_id: string
}

export type TagUnbindingPayload =
  | {
      tag_id: string
      tag_ids?: Array<string>
      target_id: string
    }
  | {
      tag_id?: string
      tag_ids: Array<string>
      target_id: string
    }

export type TagUpdatePayload = {
  name: string
  tag_id: string
}

export type TextToAudioPayload = {
  message_id?: string | null
  streaming?: boolean | null
  text?: string | null
  voice?: string | null
}

export type TextToAudioPayloadWithUser = {
  message_id?: string | null
  streaming?: boolean | null
  text?: string | null
  user?: string
  voice?: string | null
}

export type UrlResponse = {
  url: string
}

export type UserActionConfig = {
  button_style?: ButtonStyle
  id: string
  title: string
}

export type ValueSourceType = 'constant' | 'variable'

export type WeightKeywordSetting = {
  keyword_weight: number
}

export type WeightModel = {
  keyword_setting?: WeightKeywordSetting | null
  vector_setting?: WeightVectorSetting | null
  weight_type?: 'customized' | 'keyword_first' | 'semantic_first' | null
}

export type WeightVectorSetting = {
  embedding_model_name: string
  embedding_provider_name: string
  vector_weight: number
}

export type WorkflowAppLogPaginationResponse = {
  data: Array<WorkflowAppLogPartialResponse>
  has_more: boolean
  limit: number
  page: number
  total: number
}

export type WorkflowAppLogPartialResponse = {
  created_at?: number | null
  created_by_account?: SimpleAccountResponse | null
  created_by_end_user?: SimpleEndUser | null
  created_by_role?: string | null
  created_from?: string | null
  details?:
    | {
        [key: string]: unknown
      }
    | Array<unknown>
    | string
    | number
    | number
    | boolean
    | null
  id: string
  workflow_run?: WorkflowRunForLogResponse | null
}

export type WorkflowEventsQuery = {
  continue_on_pause?: boolean
  include_state_snapshot?: boolean
  user: string
}

export type WorkflowLogQuery = {
  created_at__after?: string | null
  created_at__before?: string | null
  created_by_account?: string | null
  created_by_end_user_session_id?: string | null
  keyword?: string | null
  limit?: number
  page?: number
  status?: 'failed' | 'stopped' | 'succeeded' | null
}

export type WorkflowRunForLogResponse = {
  created_at?: number | null
  elapsed_time?: number | number | null
  error?: string | null
  exceptions_count?: number | null
  finished_at?: number | null
  id: string
  status?: string | null
  total_steps?: number | null
  total_tokens?: number | null
  triggered_from?: string | null
  version?: string | null
}

export type WorkflowRunPayload = {
  files?: Array<{
    transfer_method: 'local_file' | 'remote_url'
    type: 'audio' | 'custom' | 'document' | 'image' | 'video'
    upload_file_id?: string
    url?: string
  }> | null
  inputs: {
    [key: string]: unknown
  }
  response_mode?: 'blocking' | 'streaming' | null
}

export type WorkflowRunPayloadWithUser = {
  files?: Array<{
    transfer_method: 'local_file' | 'remote_url'
    type: 'audio' | 'custom' | 'document' | 'image' | 'video'
    upload_file_id?: string
    url?: string
  }> | null
  inputs: {
    [key: string]: unknown
  }
  response_mode?: 'blocking' | 'streaming' | null
  user: string
}

export type WorkflowRunResponse = {
  created_at?: number | null
  elapsed_time?: number | number | null
  error?: string | null
  finished_at?: number | null
  id: string
  inputs?:
    | {
        [key: string]: unknown
      }
    | Array<unknown>
    | string
    | number
    | number
    | boolean
    | null
  outputs?: {
    [key: string]: unknown
  }
  status: string
  total_steps?: number | null
  total_tokens?: number | null
  workflow_id: string
}

export type GeneratedAppResponseWritable = JsonValue

export type HumanInputFormSubmitResponseWritable = {
  [key: string]: never
}

export type MessageInfiniteScrollPaginationWritable = {
  data: Array<MessageListItemWritable>
  has_more: boolean
  limit: number
}

export type MessageListItemWritable = {
  agent_thoughts: Array<AgentThought>
  answer: string
  answer_tokens?: number
  conversation_id: string
  created_at?: number | null
  currency?: string | null
  error?: string | null
  extra_contents: Array<HumanInputContent>
  feedback?: SimpleFeedback | null
  id: string
  inputs: {
    [key: string]: JsonValueType
  }
  message_files: Array<MessageFile>
  message_tokens?: number
  parent_message_id?: string | null
  provider_response_latency?: number
  query: string
  retriever_resources: Array<RetrieverResource>
  status: string
  total_price?: string | null
}

export type SiteWritable = {
  chat_color_theme?: string | null
  chat_color_theme_inverted: boolean
  copyright?: string | null
  custom_disclaimer?: string | null
  default_language: string
  description?: string | null
  icon?: string | null
  icon_background?: string | null
  icon_type?: string | null
  input_placeholder?: string | null
  privacy_policy?: string | null
  show_workflow_steps: boolean
  title: string
  use_icon_as_answer_icon: boolean
}

export type GetRootData = {
  body?: never
  path?: never
  query?: never
  url: '/'
}

export type GetRootResponses = {
  200: IndexInfoResponse
}

export type GetRootResponse = GetRootResponses[keyof GetRootResponses]

export type GetAppFeedbacksData = {
  body?: never
  path?: never
  query?: {
    limit?: number
    page?: number
  }
  url: '/app/feedbacks'
}

export type GetAppFeedbacksErrors = {
  401: unknown
  403: unknown
}

export type GetAppFeedbacksResponses = {
  200: AppFeedbackListResponse
}

export type GetAppFeedbacksResponse = GetAppFeedbacksResponses[keyof GetAppFeedbacksResponses]

export type PostAppsAnnotationReplyByActionData = {
  body: AnnotationReplyActionPayload
  path: {
    action: 'disable' | 'enable'
  }
  query?: never
  url: '/apps/annotation-reply/{action}'
}

export type PostAppsAnnotationReplyByActionErrors = {
  401: unknown
  403: unknown
}

export type PostAppsAnnotationReplyByActionResponses = {
  200: AnnotationJobStatusResponse
}

export type PostAppsAnnotationReplyByActionResponse =
  PostAppsAnnotationReplyByActionResponses[keyof PostAppsAnnotationReplyByActionResponses]

export type GetAppsAnnotationReplyByActionStatusByJobIdData = {
  body?: never
  path: {
    action: 'disable' | 'enable'
    job_id: string
  }
  query?: never
  url: '/apps/annotation-reply/{action}/status/{job_id}'
}

export type GetAppsAnnotationReplyByActionStatusByJobIdErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type GetAppsAnnotationReplyByActionStatusByJobIdResponses = {
  200: AnnotationJobStatusDetailResponse
}

export type GetAppsAnnotationReplyByActionStatusByJobIdResponse =
  GetAppsAnnotationReplyByActionStatusByJobIdResponses[keyof GetAppsAnnotationReplyByActionStatusByJobIdResponses]

export type GetAppsAnnotationsData = {
  body?: never
  path?: never
  query?: {
    keyword?: string
    limit?: number
    page?: number
  }
  url: '/apps/annotations'
}

export type GetAppsAnnotationsErrors = {
  401: unknown
  403: unknown
}

export type GetAppsAnnotationsResponses = {
  200: AnnotationList
}

export type GetAppsAnnotationsResponse =
  GetAppsAnnotationsResponses[keyof GetAppsAnnotationsResponses]

export type PostAppsAnnotationsData = {
  body: AnnotationCreatePayload
  path?: never
  query?: never
  url: '/apps/annotations'
}

export type PostAppsAnnotationsErrors = {
  401: unknown
  403: unknown
}

export type PostAppsAnnotationsResponses = {
  201: Annotation
}

export type PostAppsAnnotationsResponse =
  PostAppsAnnotationsResponses[keyof PostAppsAnnotationsResponses]

export type DeleteAppsAnnotationsByAnnotationIdData = {
  body?: never
  path: {
    annotation_id: string
  }
  query?: never
  url: '/apps/annotations/{annotation_id}'
}

export type DeleteAppsAnnotationsByAnnotationIdErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type DeleteAppsAnnotationsByAnnotationIdResponses = {
  204: void
}

export type DeleteAppsAnnotationsByAnnotationIdResponse =
  DeleteAppsAnnotationsByAnnotationIdResponses[keyof DeleteAppsAnnotationsByAnnotationIdResponses]

export type PutAppsAnnotationsByAnnotationIdData = {
  body: AnnotationCreatePayload
  path: {
    annotation_id: string
  }
  query?: never
  url: '/apps/annotations/{annotation_id}'
}

export type PutAppsAnnotationsByAnnotationIdErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type PutAppsAnnotationsByAnnotationIdResponses = {
  200: Annotation
}

export type PutAppsAnnotationsByAnnotationIdResponse =
  PutAppsAnnotationsByAnnotationIdResponses[keyof PutAppsAnnotationsByAnnotationIdResponses]

export type PostAudioToTextData = {
  body: {
    file: Blob | File
    user?: string
  }
  path?: never
  query?: never
  url: '/audio-to-text'
}

export type PostAudioToTextErrors = {
  400: unknown
  401: unknown
  403: unknown
  413: unknown
  415: unknown
  500: unknown
}

export type PostAudioToTextResponses = {
  200: AudioTranscriptResponse
}

export type PostAudioToTextResponse = PostAudioToTextResponses[keyof PostAudioToTextResponses]

export type PostChatMessagesData = {
  body: ChatRequestPayloadWithUser
  path?: never
  query?: never
  url: '/chat-messages'
}

export type PostChatMessagesErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
  429: unknown
  500: unknown
}

export type PostChatMessagesResponses = {
  200: {
    [key: string]: unknown
  }
}

export type PostChatMessagesResponse = PostChatMessagesResponses[keyof PostChatMessagesResponses]

export type PostChatMessagesByTaskIdStopData = {
  body: RequiredServiceApiUserPayload
  path: {
    task_id: string
  }
  query?: never
  url: '/chat-messages/{task_id}/stop'
}

export type PostChatMessagesByTaskIdStopErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type PostChatMessagesByTaskIdStopResponses = {
  200: SimpleResultResponse
}

export type PostChatMessagesByTaskIdStopResponse =
  PostChatMessagesByTaskIdStopResponses[keyof PostChatMessagesByTaskIdStopResponses]

export type PostCompletionMessagesData = {
  body: CompletionRequestPayloadWithUser
  path?: never
  query?: never
  url: '/completion-messages'
}

export type PostCompletionMessagesErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
  429: unknown
  500: unknown
}

export type PostCompletionMessagesResponses = {
  200: {
    [key: string]: unknown
  }
}

export type PostCompletionMessagesResponse =
  PostCompletionMessagesResponses[keyof PostCompletionMessagesResponses]

export type PostCompletionMessagesByTaskIdStopData = {
  body: RequiredServiceApiUserPayload
  path: {
    task_id: string
  }
  query?: never
  url: '/completion-messages/{task_id}/stop'
}

export type PostCompletionMessagesByTaskIdStopErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type PostCompletionMessagesByTaskIdStopResponses = {
  200: SimpleResultResponse
}

export type PostCompletionMessagesByTaskIdStopResponse =
  PostCompletionMessagesByTaskIdStopResponses[keyof PostCompletionMessagesByTaskIdStopResponses]

export type GetConversationsData = {
  body?: never
  path?: never
  query?: {
    last_id?: string
    limit?: number
    sort_by?: '-created_at' | '-updated_at' | 'created_at' | 'updated_at'
    user?: string
  }
  url: '/conversations'
}

export type GetConversationsErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type GetConversationsResponses = {
  200: ConversationInfiniteScrollPagination
}

export type GetConversationsResponse = GetConversationsResponses[keyof GetConversationsResponses]

export type DeleteConversationsByCIdData = {
  body: OptionalServiceApiUserPayload
  path: {
    c_id: string
  }
  query?: never
  url: '/conversations/{c_id}'
}

export type DeleteConversationsByCIdErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type DeleteConversationsByCIdResponses = {
  204: void
}

export type DeleteConversationsByCIdResponse =
  DeleteConversationsByCIdResponses[keyof DeleteConversationsByCIdResponses]

export type PostConversationsByCIdNameData = {
  body: ConversationRenamePayloadWithUser
  path: {
    c_id: string
  }
  query?: never
  url: '/conversations/{c_id}/name'
}

export type PostConversationsByCIdNameErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type PostConversationsByCIdNameResponses = {
  200: SimpleConversation
}

export type PostConversationsByCIdNameResponse =
  PostConversationsByCIdNameResponses[keyof PostConversationsByCIdNameResponses]

export type GetConversationsByCIdVariablesData = {
  body?: never
  path: {
    c_id: string
  }
  query?: {
    last_id?: string
    limit?: number
    user?: string
    variable_name?: string
  }
  url: '/conversations/{c_id}/variables'
}

export type GetConversationsByCIdVariablesErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type GetConversationsByCIdVariablesResponses = {
  200: ConversationVariableInfiniteScrollPaginationResponse
}

export type GetConversationsByCIdVariablesResponse =
  GetConversationsByCIdVariablesResponses[keyof GetConversationsByCIdVariablesResponses]

export type PutConversationsByCIdVariablesByVariableIdData = {
  body: ConversationVariableUpdatePayloadWithUser
  path: {
    c_id: string
    variable_id: string
  }
  query?: never
  url: '/conversations/{c_id}/variables/{variable_id}'
}

export type PutConversationsByCIdVariablesByVariableIdErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type PutConversationsByCIdVariablesByVariableIdResponses = {
  200: ConversationVariableResponse
}

export type PutConversationsByCIdVariablesByVariableIdResponse =
  PutConversationsByCIdVariablesByVariableIdResponses[keyof PutConversationsByCIdVariablesByVariableIdResponses]

export type GetDatasetsData = {
  body?: never
  path?: never
  query?: {
    include_all?: boolean
    keyword?: string
    limit?: number
    page?: number
    tag_ids?: Array<string>
  }
  url: '/datasets'
}

export type GetDatasetsErrors = {
  401: unknown
  403: unknown
}

export type GetDatasetsResponses = {
  200: DatasetListResponse
}

export type GetDatasetsResponse = GetDatasetsResponses[keyof GetDatasetsResponses]

export type PostDatasetsData = {
  body: DatasetCreatePayload
  path?: never
  query?: never
  url: '/datasets'
}

export type PostDatasetsErrors = {
  400: unknown
  401: unknown
  403: unknown
  409: unknown
}

export type PostDatasetsResponses = {
  200: DatasetDetailResponse
}

export type PostDatasetsResponse = PostDatasetsResponses[keyof PostDatasetsResponses]

export type PostDatasetsPipelineFileUploadData = {
  body: {
    file: Blob | File
  }
  path?: never
  query?: never
  url: '/datasets/pipeline/file-upload'
}

export type PostDatasetsPipelineFileUploadErrors = {
  400: unknown
  401: unknown
  403: unknown
  413: unknown
  415: unknown
}

export type PostDatasetsPipelineFileUploadResponses = {
  201: PipelineUploadFileResponse
}

export type PostDatasetsPipelineFileUploadResponse =
  PostDatasetsPipelineFileUploadResponses[keyof PostDatasetsPipelineFileUploadResponses]

export type DeleteDatasetsTagsData = {
  body: TagDeletePayload
  path?: never
  query?: never
  url: '/datasets/tags'
}

export type DeleteDatasetsTagsErrors = {
  401: unknown
  403: unknown
}

export type DeleteDatasetsTagsResponses = {
  204: void
}

export type DeleteDatasetsTagsResponse =
  DeleteDatasetsTagsResponses[keyof DeleteDatasetsTagsResponses]

export type GetDatasetsTagsData = {
  body?: never
  path?: never
  query?: never
  url: '/datasets/tags'
}

export type GetDatasetsTagsErrors = {
  401: unknown
  403: unknown
}

export type GetDatasetsTagsResponses = {
  200: KnowledgeTagListResponse
}

export type GetDatasetsTagsResponse = GetDatasetsTagsResponses[keyof GetDatasetsTagsResponses]

export type PatchDatasetsTagsData = {
  body: TagUpdatePayload
  path?: never
  query?: never
  url: '/datasets/tags'
}

export type PatchDatasetsTagsErrors = {
  401: unknown
  403: unknown
}

export type PatchDatasetsTagsResponses = {
  200: KnowledgeTagResponse
}

export type PatchDatasetsTagsResponse = PatchDatasetsTagsResponses[keyof PatchDatasetsTagsResponses]

export type PostDatasetsTagsData = {
  body: TagCreatePayload
  path?: never
  query?: never
  url: '/datasets/tags'
}

export type PostDatasetsTagsErrors = {
  401: unknown
  403: unknown
}

export type PostDatasetsTagsResponses = {
  200: KnowledgeTagResponse
}

export type PostDatasetsTagsResponse = PostDatasetsTagsResponses[keyof PostDatasetsTagsResponses]

export type PostDatasetsTagsBindingData = {
  body: TagBindingPayload
  path?: never
  query?: never
  url: '/datasets/tags/binding'
}

export type PostDatasetsTagsBindingErrors = {
  401: unknown
  403: unknown
}

export type PostDatasetsTagsBindingResponses = {
  204: void
}

export type PostDatasetsTagsBindingResponse =
  PostDatasetsTagsBindingResponses[keyof PostDatasetsTagsBindingResponses]

export type PostDatasetsTagsUnbindingData = {
  body: TagUnbindingPayload
  path?: never
  query?: never
  url: '/datasets/tags/unbinding'
}

export type PostDatasetsTagsUnbindingErrors = {
  401: unknown
  403: unknown
}

export type PostDatasetsTagsUnbindingResponses = {
  204: void
}

export type PostDatasetsTagsUnbindingResponse =
  PostDatasetsTagsUnbindingResponses[keyof PostDatasetsTagsUnbindingResponses]

export type DeleteDatasetsByDatasetIdData = {
  body?: never
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}'
}

export type DeleteDatasetsByDatasetIdErrors = {
  401: unknown
  403: unknown
  404: unknown
  409: unknown
}

export type DeleteDatasetsByDatasetIdResponses = {
  204: void
}

export type DeleteDatasetsByDatasetIdResponse =
  DeleteDatasetsByDatasetIdResponses[keyof DeleteDatasetsByDatasetIdResponses]

export type GetDatasetsByDatasetIdData = {
  body?: never
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}'
}

export type GetDatasetsByDatasetIdErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type GetDatasetsByDatasetIdResponses = {
  200: DatasetDetailWithPartialMembersResponse
}

export type GetDatasetsByDatasetIdResponse =
  GetDatasetsByDatasetIdResponses[keyof GetDatasetsByDatasetIdResponses]

export type PatchDatasetsByDatasetIdData = {
  body: DatasetUpdatePayload
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}'
}

export type PatchDatasetsByDatasetIdErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type PatchDatasetsByDatasetIdResponses = {
  200: DatasetDetailWithPartialMembersResponse
}

export type PatchDatasetsByDatasetIdResponse =
  PatchDatasetsByDatasetIdResponses[keyof PatchDatasetsByDatasetIdResponses]

export type PostDatasetsByDatasetIdDocumentCreateByFileData = {
  body: {
    data?: string
    file: Blob | File
  }
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/document/create-by-file'
}

export type PostDatasetsByDatasetIdDocumentCreateByFileErrors = {
  400: unknown
  401: unknown
  403: unknown
}

export type PostDatasetsByDatasetIdDocumentCreateByFileResponses = {
  200: DocumentAndBatchResponse
}

export type PostDatasetsByDatasetIdDocumentCreateByFileResponse =
  PostDatasetsByDatasetIdDocumentCreateByFileResponses[keyof PostDatasetsByDatasetIdDocumentCreateByFileResponses]

export type PostDatasetsByDatasetIdDocumentCreateByTextData = {
  body: DocumentTextCreatePayload
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/document/create-by-text'
}

export type PostDatasetsByDatasetIdDocumentCreateByTextErrors = {
  400: unknown
  401: unknown
  403: unknown
}

export type PostDatasetsByDatasetIdDocumentCreateByTextResponses = {
  200: DocumentAndBatchResponse
}

export type PostDatasetsByDatasetIdDocumentCreateByTextResponse =
  PostDatasetsByDatasetIdDocumentCreateByTextResponses[keyof PostDatasetsByDatasetIdDocumentCreateByTextResponses]

export type PostDatasetsByDatasetIdDocumentCreateByFile2Data = {
  body: {
    data?: string
    file: Blob | File
  }
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/document/create_by_file'
}

export type PostDatasetsByDatasetIdDocumentCreateByFile2Errors = {
  400: unknown
  401: unknown
  403: unknown
}

export type PostDatasetsByDatasetIdDocumentCreateByFile2Responses = {
  200: DocumentAndBatchResponse
}

export type PostDatasetsByDatasetIdDocumentCreateByFile2Response =
  PostDatasetsByDatasetIdDocumentCreateByFile2Responses[keyof PostDatasetsByDatasetIdDocumentCreateByFile2Responses]

export type PostDatasetsByDatasetIdDocumentCreateByText2Data = {
  body: DocumentTextCreatePayload
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/document/create_by_text'
}

export type PostDatasetsByDatasetIdDocumentCreateByText2Errors = {
  400: unknown
  401: unknown
  403: unknown
}

export type PostDatasetsByDatasetIdDocumentCreateByText2Responses = {
  200: DocumentAndBatchResponse
}

export type PostDatasetsByDatasetIdDocumentCreateByText2Response =
  PostDatasetsByDatasetIdDocumentCreateByText2Responses[keyof PostDatasetsByDatasetIdDocumentCreateByText2Responses]

export type GetDatasetsByDatasetIdDocumentsData = {
  body?: never
  path: {
    dataset_id: string
  }
  query?: {
    keyword?: string
    limit?: number
    page?: number
    status?: 'archived' | 'available' | 'disabled' | 'error' | 'indexing' | 'paused' | 'queuing'
  }
  url: '/datasets/{dataset_id}/documents'
}

export type GetDatasetsByDatasetIdDocumentsErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type GetDatasetsByDatasetIdDocumentsResponses = {
  200: DocumentListResponse
}

export type GetDatasetsByDatasetIdDocumentsResponse =
  GetDatasetsByDatasetIdDocumentsResponses[keyof GetDatasetsByDatasetIdDocumentsResponses]

export type PostDatasetsByDatasetIdDocumentsDownloadZipData = {
  body: DocumentBatchDownloadZipPayload
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/download-zip'
}

export type PostDatasetsByDatasetIdDocumentsDownloadZipErrors = {
  401: Blob | File
  403: Blob | File
  404: Blob | File
}

export type PostDatasetsByDatasetIdDocumentsDownloadZipError =
  PostDatasetsByDatasetIdDocumentsDownloadZipErrors[keyof PostDatasetsByDatasetIdDocumentsDownloadZipErrors]

export type PostDatasetsByDatasetIdDocumentsDownloadZipResponses = {
  200: Blob | File
}

export type PostDatasetsByDatasetIdDocumentsDownloadZipResponse =
  PostDatasetsByDatasetIdDocumentsDownloadZipResponses[keyof PostDatasetsByDatasetIdDocumentsDownloadZipResponses]

export type PostDatasetsByDatasetIdDocumentsMetadataData = {
  body: MetadataOperationData
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/metadata'
}

export type PostDatasetsByDatasetIdDocumentsMetadataErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type PostDatasetsByDatasetIdDocumentsMetadataResponses = {
  200: DatasetMetadataActionResponse
}

export type PostDatasetsByDatasetIdDocumentsMetadataResponse =
  PostDatasetsByDatasetIdDocumentsMetadataResponses[keyof PostDatasetsByDatasetIdDocumentsMetadataResponses]

export type PatchDatasetsByDatasetIdDocumentsStatusByActionData = {
  body: DocumentStatusPayload
  path: {
    action: 'archive' | 'disable' | 'enable' | 'un_archive'
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/status/{action}'
}

export type PatchDatasetsByDatasetIdDocumentsStatusByActionErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type PatchDatasetsByDatasetIdDocumentsStatusByActionResponses = {
  200: SimpleResultResponse
}

export type PatchDatasetsByDatasetIdDocumentsStatusByActionResponse =
  PatchDatasetsByDatasetIdDocumentsStatusByActionResponses[keyof PatchDatasetsByDatasetIdDocumentsStatusByActionResponses]

export type GetDatasetsByDatasetIdDocumentsByBatchIndexingStatusData = {
  body?: never
  path: {
    batch: string
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/{batch}/indexing-status'
}

export type GetDatasetsByDatasetIdDocumentsByBatchIndexingStatusErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type GetDatasetsByDatasetIdDocumentsByBatchIndexingStatusResponses = {
  200: DocumentStatusListResponse
}

export type GetDatasetsByDatasetIdDocumentsByBatchIndexingStatusResponse =
  GetDatasetsByDatasetIdDocumentsByBatchIndexingStatusResponses[keyof GetDatasetsByDatasetIdDocumentsByBatchIndexingStatusResponses]

export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdData = {
  body?: never
  path: {
    dataset_id: string
    document_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/{document_id}'
}

export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdResponses = {
  204: void
}

export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdResponse =
  DeleteDatasetsByDatasetIdDocumentsByDocumentIdResponses[keyof DeleteDatasetsByDatasetIdDocumentsByDocumentIdResponses]

export type GetDatasetsByDatasetIdDocumentsByDocumentIdData = {
  body?: never
  path: {
    dataset_id: string
    document_id: string
  }
  query?: {
    metadata?: 'all' | 'only' | 'without'
  }
  url: '/datasets/{dataset_id}/documents/{document_id}'
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdResponses = {
  200: DocumentDetailResponse
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdResponse =
  GetDatasetsByDatasetIdDocumentsByDocumentIdResponses[keyof GetDatasetsByDatasetIdDocumentsByDocumentIdResponses]

export type PatchDatasetsByDatasetIdDocumentsByDocumentIdData = {
  body?: {
    data?: string
    file?: Blob | File
  }
  path: {
    dataset_id: string
    document_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/{document_id}'
}

export type PatchDatasetsByDatasetIdDocumentsByDocumentIdErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type PatchDatasetsByDatasetIdDocumentsByDocumentIdResponses = {
  200: DocumentAndBatchResponse
}

export type PatchDatasetsByDatasetIdDocumentsByDocumentIdResponse =
  PatchDatasetsByDatasetIdDocumentsByDocumentIdResponses[keyof PatchDatasetsByDatasetIdDocumentsByDocumentIdResponses]

export type GetDatasetsByDatasetIdDocumentsByDocumentIdDownloadData = {
  body?: never
  path: {
    dataset_id: string
    document_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/{document_id}/download'
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdDownloadErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdDownloadResponses = {
  200: UrlResponse
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdDownloadResponse =
  GetDatasetsByDatasetIdDocumentsByDocumentIdDownloadResponses[keyof GetDatasetsByDatasetIdDocumentsByDocumentIdDownloadResponses]

export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsData = {
  body?: never
  path: {
    dataset_id: string
    document_id: string
  }
  query?: {
    keyword?: string
    limit?: number
    page?: number
    status?: Array<string>
  }
  url: '/datasets/{dataset_id}/documents/{document_id}/segments'
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponses = {
  200: SegmentListResponse
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponse =
  GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponses[keyof GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponses]

export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsData = {
  body: SegmentCreatePayload
  path: {
    dataset_id: string
    document_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/{document_id}/segments'
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponses = {
  200: SegmentCreateListResponse
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponse =
  PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponses[keyof PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponses]

export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdData = {
  body?: never
  path: {
    dataset_id: string
    document_id: string
    segment_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
}

export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponses = {
  204: void
}

export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponse =
  DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponses[keyof DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponses]

export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdData = {
  body?: never
  path: {
    dataset_id: string
    document_id: string
    segment_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponses = {
  200: SegmentDetailResponse
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponse =
  GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponses[keyof GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponses]

export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdData = {
  body: SegmentUpdatePayload
  path: {
    dataset_id: string
    document_id: string
    segment_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponses = {
  200: SegmentDetailResponse
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponse =
  PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponses[keyof PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponses]

export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksData = {
  body?: never
  path: {
    dataset_id: string
    document_id: string
    segment_id: string
  }
  query?: {
    keyword?: string
    limit?: number
    page?: number
  }
  url: '/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponses = {
  200: ChildChunkListResponse
}

export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponse =
  GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponses[keyof GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponses]

export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksData = {
  body: ChildChunkCreatePayload
  path: {
    dataset_id: string
    document_id: string
    segment_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponses = {
  200: ChildChunkDetailResponse
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponse =
  PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponses[keyof PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponses]

export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdData =
  {
    body?: never
    path: {
      child_chunk_id: string
      dataset_id: string
      document_id: string
      segment_id: string
    }
    query?: never
    url: '/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  }

export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdErrors =
  {
    400: unknown
    401: unknown
    403: unknown
    404: unknown
  }

export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdResponses =
  {
    204: void
  }

export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdResponse =
  DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdResponses[keyof DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdResponses]

export type PatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdData =
  {
    body: ChildChunkUpdatePayload
    path: {
      child_chunk_id: string
      dataset_id: string
      document_id: string
      segment_id: string
    }
    query?: never
    url: '/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  }

export type PatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdErrors =
  {
    400: unknown
    401: unknown
    403: unknown
    404: unknown
  }

export type PatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdResponses =
  {
    200: ChildChunkDetailResponse
  }

export type PatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdResponse =
  PatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdResponses[keyof PatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdResponses]

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFileData = {
  body?: {
    data?: string
    file?: Blob | File
  }
  path: {
    dataset_id: string
    document_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/{document_id}/update-by-file'
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFileErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFileResponses = {
  200: DocumentAndBatchResponse
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFileResponse =
  PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFileResponses[keyof PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFileResponses]

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByTextData = {
  body: DocumentTextUpdate
  path: {
    dataset_id: string
    document_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/{document_id}/update-by-text'
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByTextErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByTextResponses = {
  200: DocumentAndBatchResponse
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByTextResponse =
  PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByTextResponses[keyof PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByTextResponses]

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFile2Data = {
  body?: {
    data?: string
    file?: Blob | File
  }
  path: {
    dataset_id: string
    document_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/{document_id}/update_by_file'
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFile2Errors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFile2Responses = {
  200: DocumentAndBatchResponse
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFile2Response =
  PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFile2Responses[keyof PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFile2Responses]

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByText2Data = {
  body: DocumentTextUpdate
  path: {
    dataset_id: string
    document_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/documents/{document_id}/update_by_text'
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByText2Errors = {
  401: unknown
  403: unknown
  404: unknown
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByText2Responses = {
  200: DocumentAndBatchResponse
}

export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByText2Response =
  PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByText2Responses[keyof PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByText2Responses]

export type PostDatasetsByDatasetIdHitTestingData = {
  body: HitTestingPayload
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/hit-testing'
}

export type PostDatasetsByDatasetIdHitTestingErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
  500: unknown
}

export type PostDatasetsByDatasetIdHitTestingResponses = {
  200: HitTestingResponse
}

export type PostDatasetsByDatasetIdHitTestingResponse =
  PostDatasetsByDatasetIdHitTestingResponses[keyof PostDatasetsByDatasetIdHitTestingResponses]

export type GetDatasetsByDatasetIdMetadataData = {
  body?: never
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/metadata'
}

export type GetDatasetsByDatasetIdMetadataErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type GetDatasetsByDatasetIdMetadataResponses = {
  200: DatasetMetadataListResponse
}

export type GetDatasetsByDatasetIdMetadataResponse =
  GetDatasetsByDatasetIdMetadataResponses[keyof GetDatasetsByDatasetIdMetadataResponses]

export type PostDatasetsByDatasetIdMetadataData = {
  body: MetadataArgs
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/metadata'
}

export type PostDatasetsByDatasetIdMetadataErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type PostDatasetsByDatasetIdMetadataResponses = {
  201: DatasetMetadataResponse
}

export type PostDatasetsByDatasetIdMetadataResponse =
  PostDatasetsByDatasetIdMetadataResponses[keyof PostDatasetsByDatasetIdMetadataResponses]

export type GetDatasetsByDatasetIdMetadataBuiltInData = {
  body?: never
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/metadata/built-in'
}

export type GetDatasetsByDatasetIdMetadataBuiltInErrors = {
  401: unknown
  403: unknown
}

export type GetDatasetsByDatasetIdMetadataBuiltInResponses = {
  200: DatasetMetadataBuiltInFieldsResponse
}

export type GetDatasetsByDatasetIdMetadataBuiltInResponse =
  GetDatasetsByDatasetIdMetadataBuiltInResponses[keyof GetDatasetsByDatasetIdMetadataBuiltInResponses]

export type PostDatasetsByDatasetIdMetadataBuiltInByActionData = {
  body?: never
  path: {
    action: 'disable' | 'enable'
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/metadata/built-in/{action}'
}

export type PostDatasetsByDatasetIdMetadataBuiltInByActionErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type PostDatasetsByDatasetIdMetadataBuiltInByActionResponses = {
  200: DatasetMetadataActionResponse
}

export type PostDatasetsByDatasetIdMetadataBuiltInByActionResponse =
  PostDatasetsByDatasetIdMetadataBuiltInByActionResponses[keyof PostDatasetsByDatasetIdMetadataBuiltInByActionResponses]

export type DeleteDatasetsByDatasetIdMetadataByMetadataIdData = {
  body?: never
  path: {
    dataset_id: string
    metadata_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/metadata/{metadata_id}'
}

export type DeleteDatasetsByDatasetIdMetadataByMetadataIdErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type DeleteDatasetsByDatasetIdMetadataByMetadataIdResponses = {
  204: void
}

export type DeleteDatasetsByDatasetIdMetadataByMetadataIdResponse =
  DeleteDatasetsByDatasetIdMetadataByMetadataIdResponses[keyof DeleteDatasetsByDatasetIdMetadataByMetadataIdResponses]

export type PatchDatasetsByDatasetIdMetadataByMetadataIdData = {
  body: MetadataUpdatePayload
  path: {
    dataset_id: string
    metadata_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/metadata/{metadata_id}'
}

export type PatchDatasetsByDatasetIdMetadataByMetadataIdErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type PatchDatasetsByDatasetIdMetadataByMetadataIdResponses = {
  200: DatasetMetadataResponse
}

export type PatchDatasetsByDatasetIdMetadataByMetadataIdResponse =
  PatchDatasetsByDatasetIdMetadataByMetadataIdResponses[keyof PatchDatasetsByDatasetIdMetadataByMetadataIdResponses]

export type GetDatasetsByDatasetIdPipelineDatasourcePluginsData = {
  body?: never
  path: {
    dataset_id: string
  }
  query?: {
    is_published?: boolean
  }
  url: '/datasets/{dataset_id}/pipeline/datasource-plugins'
}

export type GetDatasetsByDatasetIdPipelineDatasourcePluginsErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type GetDatasetsByDatasetIdPipelineDatasourcePluginsResponses = {
  200: DatasourcePluginListResponse
}

export type GetDatasetsByDatasetIdPipelineDatasourcePluginsResponse =
  GetDatasetsByDatasetIdPipelineDatasourcePluginsResponses[keyof GetDatasetsByDatasetIdPipelineDatasourcePluginsResponses]

export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunData = {
  body: DatasourceNodeRunPayload
  path: {
    dataset_id: string
    node_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/pipeline/datasource/nodes/{node_id}/run'
}

export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponses = {
  200: {
    [key: string]: unknown
  }
}

export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponse =
  PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponses[keyof PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponses]

export type PostDatasetsByDatasetIdPipelineRunData = {
  body: PipelineRunApiEntity
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/pipeline/run'
}

export type PostDatasetsByDatasetIdPipelineRunErrors = {
  401: unknown
  403: unknown
  404: unknown
  500: unknown
}

export type PostDatasetsByDatasetIdPipelineRunResponses = {
  200: GeneratedAppResponse
}

export type PostDatasetsByDatasetIdPipelineRunResponse =
  PostDatasetsByDatasetIdPipelineRunResponses[keyof PostDatasetsByDatasetIdPipelineRunResponses]

export type PostDatasetsByDatasetIdRetrieveData = {
  body: HitTestingPayload
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/retrieve'
}

export type PostDatasetsByDatasetIdRetrieveErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
  500: unknown
}

export type PostDatasetsByDatasetIdRetrieveResponses = {
  200: HitTestingResponse
}

export type PostDatasetsByDatasetIdRetrieveResponse =
  PostDatasetsByDatasetIdRetrieveResponses[keyof PostDatasetsByDatasetIdRetrieveResponses]

export type GetDatasetsByDatasetIdTagsData = {
  body?: never
  path: {
    dataset_id: string
  }
  query?: never
  url: '/datasets/{dataset_id}/tags'
}

export type GetDatasetsByDatasetIdTagsErrors = {
  401: unknown
  403: unknown
}

export type GetDatasetsByDatasetIdTagsResponses = {
  200: DatasetBoundTagListResponse
}

export type GetDatasetsByDatasetIdTagsResponse =
  GetDatasetsByDatasetIdTagsResponses[keyof GetDatasetsByDatasetIdTagsResponses]

export type GetEndUsersByEndUserIdData = {
  body?: never
  path: {
    end_user_id: string
  }
  query?: never
  url: '/end-users/{end_user_id}'
}

export type GetEndUsersByEndUserIdErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type GetEndUsersByEndUserIdResponses = {
  200: EndUserDetail
}

export type GetEndUsersByEndUserIdResponse =
  GetEndUsersByEndUserIdResponses[keyof GetEndUsersByEndUserIdResponses]

export type PostFilesUploadData = {
  body: {
    file: Blob | File
    user?: string
  }
  path?: never
  query?: never
  url: '/files/upload'
}

export type PostFilesUploadErrors = {
  400: unknown
  401: unknown
  403: unknown
  413: unknown
  415: unknown
}

export type PostFilesUploadResponses = {
  201: FileResponse
}

export type PostFilesUploadResponse = PostFilesUploadResponses[keyof PostFilesUploadResponses]

export type GetFilesByFileIdPreviewData = {
  body?: never
  path: {
    file_id: string
  }
  query?: {
    as_attachment?: boolean
    user?: string
  }
  url: '/files/{file_id}/preview'
}

export type GetFilesByFileIdPreviewErrors = {
  401: Blob | File
  403: Blob | File
  404: Blob | File
}

export type GetFilesByFileIdPreviewError =
  GetFilesByFileIdPreviewErrors[keyof GetFilesByFileIdPreviewErrors]

export type GetFilesByFileIdPreviewResponses = {
  200: Blob | File
}

export type GetFilesByFileIdPreviewResponse =
  GetFilesByFileIdPreviewResponses[keyof GetFilesByFileIdPreviewResponses]

export type GetFormHumanInputByFormTokenData = {
  body?: never
  path: {
    form_token: string
  }
  query?: never
  url: '/form/human_input/{form_token}'
}

export type GetFormHumanInputByFormTokenErrors = {
  401: unknown
  403: unknown
  404: unknown
  412: unknown
}

export type GetFormHumanInputByFormTokenResponses = {
  200: HumanInputFormDefinitionResponse
}

export type GetFormHumanInputByFormTokenResponse =
  GetFormHumanInputByFormTokenResponses[keyof GetFormHumanInputByFormTokenResponses]

export type PostFormHumanInputByFormTokenData = {
  body: HumanInputFormSubmitPayloadWithUser
  path: {
    form_token: string
  }
  query?: never
  url: '/form/human_input/{form_token}'
}

export type PostFormHumanInputByFormTokenErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
  412: unknown
}

export type PostFormHumanInputByFormTokenResponses = {
  200: HumanInputFormSubmitResponse
}

export type PostFormHumanInputByFormTokenResponse =
  PostFormHumanInputByFormTokenResponses[keyof PostFormHumanInputByFormTokenResponses]

export type GetInfoData = {
  body?: never
  path?: never
  query?: never
  url: '/info'
}

export type GetInfoErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type GetInfoResponses = {
  200: AppInfoResponse
}

export type GetInfoResponse = GetInfoResponses[keyof GetInfoResponses]

export type GetMessagesData = {
  body?: never
  path?: never
  query: {
    conversation_id: string
    first_id?: string
    limit?: number
    user?: string
  }
  url: '/messages'
}

export type GetMessagesErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type GetMessagesResponses = {
  200: MessageInfiniteScrollPagination
}

export type GetMessagesResponse = GetMessagesResponses[keyof GetMessagesResponses]

export type PostMessagesByMessageIdFeedbacksData = {
  body: MessageFeedbackPayloadWithUser
  path: {
    message_id: string
  }
  query?: never
  url: '/messages/{message_id}/feedbacks'
}

export type PostMessagesByMessageIdFeedbacksErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type PostMessagesByMessageIdFeedbacksResponses = {
  200: ResultResponse
}

export type PostMessagesByMessageIdFeedbacksResponse =
  PostMessagesByMessageIdFeedbacksResponses[keyof PostMessagesByMessageIdFeedbacksResponses]

export type GetMessagesByMessageIdSuggestedData = {
  body?: never
  path: {
    message_id: string
  }
  query: {
    user: string
  }
  url: '/messages/{message_id}/suggested'
}

export type GetMessagesByMessageIdSuggestedErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
  500: unknown
}

export type GetMessagesByMessageIdSuggestedResponses = {
  200: SimpleResultStringListResponse
}

export type GetMessagesByMessageIdSuggestedResponse =
  GetMessagesByMessageIdSuggestedResponses[keyof GetMessagesByMessageIdSuggestedResponses]

export type GetMetaData = {
  body?: never
  path?: never
  query?: never
  url: '/meta'
}

export type GetMetaErrors = {
  401: unknown
  403: unknown
  404: unknown
}

export type GetMetaResponses = {
  200: AppMetaResponse
}

export type GetMetaResponse = GetMetaResponses[keyof GetMetaResponses]

export type GetParametersData = {
  body?: never
  path?: never
  query?: never
  url: '/parameters'
}

export type GetParametersErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type GetParametersResponses = {
  200: Parameters
}

export type GetParametersResponse = GetParametersResponses[keyof GetParametersResponses]

export type GetSiteData = {
  body?: never
  path?: never
  query?: never
  url: '/site'
}

export type GetSiteErrors = {
  401: unknown
  403: unknown
}

export type GetSiteResponses = {
  200: Site
}

export type GetSiteResponse = GetSiteResponses[keyof GetSiteResponses]

export type PostTextToAudioData = {
  body: TextToAudioPayloadWithUser
  path?: never
  query?: never
  url: '/text-to-audio'
}

export type PostTextToAudioErrors = {
  400: Blob | File
  401: Blob | File
  403: Blob | File
  500: Blob | File
}

export type PostTextToAudioError = PostTextToAudioErrors[keyof PostTextToAudioErrors]

export type PostTextToAudioResponses = {
  200: Blob | File
}

export type PostTextToAudioResponse = PostTextToAudioResponses[keyof PostTextToAudioResponses]

export type GetWorkflowByTaskIdEventsData = {
  body?: never
  path: {
    task_id: string
  }
  query: {
    continue_on_pause?: boolean
    include_state_snapshot?: boolean
    user: string
  }
  url: '/workflow/{task_id}/events'
}

export type GetWorkflowByTaskIdEventsErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type GetWorkflowByTaskIdEventsResponses = {
  200: EventStreamResponse
}

export type GetWorkflowByTaskIdEventsResponse =
  GetWorkflowByTaskIdEventsResponses[keyof GetWorkflowByTaskIdEventsResponses]

export type GetWorkflowsLogsData = {
  body?: never
  path?: never
  query?: {
    created_at__after?: string
    created_at__before?: string
    created_by_account?: string
    created_by_end_user_session_id?: string
    keyword?: string
    limit?: number
    page?: number
    status?: 'failed' | 'stopped' | 'succeeded'
  }
  url: '/workflows/logs'
}

export type GetWorkflowsLogsErrors = {
  401: unknown
  403: unknown
}

export type GetWorkflowsLogsResponses = {
  200: WorkflowAppLogPaginationResponse
}

export type GetWorkflowsLogsResponse = GetWorkflowsLogsResponses[keyof GetWorkflowsLogsResponses]

export type PostWorkflowsRunData = {
  body: WorkflowRunPayloadWithUser
  path?: never
  query?: never
  url: '/workflows/run'
}

export type PostWorkflowsRunErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
  429: unknown
  500: unknown
}

export type PostWorkflowsRunResponses = {
  200: GeneratedAppResponse
}

export type PostWorkflowsRunResponse = PostWorkflowsRunResponses[keyof PostWorkflowsRunResponses]

export type GetWorkflowsRunByWorkflowRunIdData = {
  body?: never
  path: {
    workflow_run_id: string
  }
  query?: never
  url: '/workflows/run/{workflow_run_id}'
}

export type GetWorkflowsRunByWorkflowRunIdErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type GetWorkflowsRunByWorkflowRunIdResponses = {
  200: WorkflowRunResponse
}

export type GetWorkflowsRunByWorkflowRunIdResponse =
  GetWorkflowsRunByWorkflowRunIdResponses[keyof GetWorkflowsRunByWorkflowRunIdResponses]

export type PostWorkflowsTasksByTaskIdStopData = {
  body: RequiredServiceApiUserPayload
  path: {
    task_id: string
  }
  query?: never
  url: '/workflows/tasks/{task_id}/stop'
}

export type PostWorkflowsTasksByTaskIdStopErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
}

export type PostWorkflowsTasksByTaskIdStopResponses = {
  200: SimpleResultResponse
}

export type PostWorkflowsTasksByTaskIdStopResponse =
  PostWorkflowsTasksByTaskIdStopResponses[keyof PostWorkflowsTasksByTaskIdStopResponses]

export type PostWorkflowsByWorkflowIdRunData = {
  body: WorkflowRunPayloadWithUser
  path: {
    workflow_id: string
  }
  query?: never
  url: '/workflows/{workflow_id}/run'
}

export type PostWorkflowsByWorkflowIdRunErrors = {
  400: unknown
  401: unknown
  403: unknown
  404: unknown
  429: unknown
  500: unknown
}

export type PostWorkflowsByWorkflowIdRunResponses = {
  200: GeneratedAppResponse
}

export type PostWorkflowsByWorkflowIdRunResponse =
  PostWorkflowsByWorkflowIdRunResponses[keyof PostWorkflowsByWorkflowIdRunResponses]

export type GetWorkspacesCurrentModelsModelTypesByModelTypeData = {
  body?: never
  path: {
    model_type: 'llm' | 'moderation' | 'rerank' | 'speech2text' | 'text-embedding' | 'tts'
  }
  query?: never
  url: '/workspaces/current/models/model-types/{model_type}'
}

export type GetWorkspacesCurrentModelsModelTypesByModelTypeErrors = {
  401: unknown
}

export type GetWorkspacesCurrentModelsModelTypesByModelTypeResponses = {
  200: ProviderWithModelsListResponse
}

export type GetWorkspacesCurrentModelsModelTypesByModelTypeResponse =
  GetWorkspacesCurrentModelsModelTypesByModelTypeResponses[keyof GetWorkspacesCurrentModelsModelTypesByModelTypeResponses]
