mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-13 08:15:21 +02:00
feat: knowledge base functionality for the voice agent (#120)
* feat: upload file and store embedding * feat: add documents in nodes * feat: add openai embedding service
This commit is contained in:
parent
e2fa4bbb98
commit
ef5b9e40a9
52 changed files with 4551 additions and 114 deletions
|
|
@ -1,9 +1,8 @@
|
|||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { type ClientOptions as DefaultClientOptions, type Config, createClient, createConfig } from '@hey-api/client-fetch';
|
||||
|
||||
import { createClientConfig } from '../lib/apiClient';
|
||||
import type { ClientOptions } from './types.gen';
|
||||
import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from '@hey-api/client-fetch';
|
||||
import { createClientConfig } from '../lib/apiClient';
|
||||
|
||||
/**
|
||||
* The `createClientConfig()` function will be called on client initialization
|
||||
|
|
@ -17,4 +16,4 @@ export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> =
|
|||
|
||||
export const client = createClient(createClientConfig(createConfig<ClientOptions>({
|
||||
baseUrl: 'http://127.0.0.1:8000'
|
||||
})));
|
||||
})));
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
export * from './sdk.gen';
|
||||
export * from './types.gen';
|
||||
export * from './sdk.gen';
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -83,6 +83,54 @@ export type CampaignsResponse = {
|
|||
campaigns: Array<CampaignResponse>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Response schema for a document chunk.
|
||||
*/
|
||||
export type ChunkResponseSchema = {
|
||||
id: number;
|
||||
document_id: number;
|
||||
chunk_text: string;
|
||||
contextualized_text: string | null;
|
||||
chunk_index: number;
|
||||
chunk_metadata: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
filename: string;
|
||||
document_uuid: string;
|
||||
similarity: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Request schema for searching similar chunks.
|
||||
*/
|
||||
export type ChunkSearchRequestSchema = {
|
||||
/**
|
||||
* Search query text
|
||||
*/
|
||||
query: string;
|
||||
/**
|
||||
* Maximum number of results
|
||||
*/
|
||||
limit?: number;
|
||||
/**
|
||||
* Filter by specific document UUIDs
|
||||
*/
|
||||
document_uuids?: Array<string> | null;
|
||||
/**
|
||||
* Minimum similarity threshold
|
||||
*/
|
||||
min_similarity?: number | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Response schema for chunk search results.
|
||||
*/
|
||||
export type ChunkSearchResponseSchema = {
|
||||
chunks: Array<ChunkResponseSchema>;
|
||||
query: string;
|
||||
total_results: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Request schema for Cloudonix configuration.
|
||||
*/
|
||||
|
|
@ -303,11 +351,91 @@ export type DefaultConfigurationsResponse = {
|
|||
[key: string]: unknown;
|
||||
};
|
||||
};
|
||||
embeddings: {
|
||||
[key: string]: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
};
|
||||
default_providers: {
|
||||
[key: string]: string;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Response schema for list of documents.
|
||||
*/
|
||||
export type DocumentListResponseSchema = {
|
||||
documents: Array<DocumentResponseSchema>;
|
||||
total: number;
|
||||
limit: number;
|
||||
offset: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Response schema for document metadata.
|
||||
*/
|
||||
export type DocumentResponseSchema = {
|
||||
id: number;
|
||||
document_uuid: string;
|
||||
filename: string;
|
||||
file_size_bytes: number;
|
||||
file_hash: string;
|
||||
mime_type: string;
|
||||
processing_status: string;
|
||||
processing_error?: string | null;
|
||||
total_chunks: number;
|
||||
custom_metadata: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
docling_metadata: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
source_url?: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
organization_id: number;
|
||||
created_by: number;
|
||||
is_active: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Request schema for initiating document upload.
|
||||
*/
|
||||
export type DocumentUploadRequestSchema = {
|
||||
/**
|
||||
* Name of the file to upload
|
||||
*/
|
||||
filename: string;
|
||||
/**
|
||||
* MIME type of the file
|
||||
*/
|
||||
mime_type: string;
|
||||
/**
|
||||
* Optional custom metadata
|
||||
*/
|
||||
custom_metadata?: {
|
||||
[key: string]: unknown;
|
||||
} | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Response schema containing upload URL and document metadata.
|
||||
*/
|
||||
export type DocumentUploadResponseSchema = {
|
||||
/**
|
||||
* Signed URL for uploading the file
|
||||
*/
|
||||
upload_url: string;
|
||||
/**
|
||||
* Unique identifier for the document
|
||||
*/
|
||||
document_uuid: string;
|
||||
/**
|
||||
* S3 key where file should be uploaded
|
||||
*/
|
||||
s3_key: string;
|
||||
};
|
||||
|
||||
export type DuplicateTemplateRequest = {
|
||||
template_id: number;
|
||||
workflow_name: string;
|
||||
|
|
@ -537,6 +665,24 @@ export type PresignedUploadUrlResponse = {
|
|||
expires_in: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Request schema for triggering document processing.
|
||||
*/
|
||||
export type ProcessDocumentRequestSchema = {
|
||||
/**
|
||||
* Document UUID to process
|
||||
*/
|
||||
document_uuid: string;
|
||||
/**
|
||||
* S3 key of the uploaded file
|
||||
*/
|
||||
s3_key: string;
|
||||
/**
|
||||
* Embedding service to use for processing. Options: 'openai' (default, 1536-dim, requires API key) or 'sentence_transformer' (free, 384-dim)
|
||||
*/
|
||||
embedding_service?: 'sentence_transformer' | 'openai';
|
||||
};
|
||||
|
||||
export type S3SignedUrlResponse = {
|
||||
url: string;
|
||||
expires_in: number;
|
||||
|
|
@ -787,6 +933,9 @@ export type UserConfigurationRequestResponseSchema = {
|
|||
stt?: {
|
||||
[key: string]: string | number;
|
||||
} | null;
|
||||
embeddings?: {
|
||||
[key: string]: string | number;
|
||||
} | null;
|
||||
test_phone_number?: string | null;
|
||||
timezone?: string | null;
|
||||
organization_pricing?: {
|
||||
|
|
@ -4126,6 +4275,213 @@ export type CreateOrUpdateEmbedTokenApiV1WorkflowWorkflowIdEmbedTokenPostRespons
|
|||
|
||||
export type CreateOrUpdateEmbedTokenApiV1WorkflowWorkflowIdEmbedTokenPostResponse = CreateOrUpdateEmbedTokenApiV1WorkflowWorkflowIdEmbedTokenPostResponses[keyof CreateOrUpdateEmbedTokenApiV1WorkflowWorkflowIdEmbedTokenPostResponses];
|
||||
|
||||
export type GetUploadUrlApiV1KnowledgeBaseUploadUrlPostData = {
|
||||
body: DocumentUploadRequestSchema;
|
||||
headers?: {
|
||||
authorization?: string | null;
|
||||
'X-API-Key'?: string | null;
|
||||
};
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/api/v1/knowledge-base/upload-url';
|
||||
};
|
||||
|
||||
export type GetUploadUrlApiV1KnowledgeBaseUploadUrlPostErrors = {
|
||||
/**
|
||||
* Not found
|
||||
*/
|
||||
404: unknown;
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type GetUploadUrlApiV1KnowledgeBaseUploadUrlPostError = GetUploadUrlApiV1KnowledgeBaseUploadUrlPostErrors[keyof GetUploadUrlApiV1KnowledgeBaseUploadUrlPostErrors];
|
||||
|
||||
export type GetUploadUrlApiV1KnowledgeBaseUploadUrlPostResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: DocumentUploadResponseSchema;
|
||||
};
|
||||
|
||||
export type GetUploadUrlApiV1KnowledgeBaseUploadUrlPostResponse = GetUploadUrlApiV1KnowledgeBaseUploadUrlPostResponses[keyof GetUploadUrlApiV1KnowledgeBaseUploadUrlPostResponses];
|
||||
|
||||
export type ProcessDocumentApiV1KnowledgeBaseProcessDocumentPostData = {
|
||||
body: ProcessDocumentRequestSchema;
|
||||
headers?: {
|
||||
authorization?: string | null;
|
||||
'X-API-Key'?: string | null;
|
||||
};
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/api/v1/knowledge-base/process-document';
|
||||
};
|
||||
|
||||
export type ProcessDocumentApiV1KnowledgeBaseProcessDocumentPostErrors = {
|
||||
/**
|
||||
* Not found
|
||||
*/
|
||||
404: unknown;
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type ProcessDocumentApiV1KnowledgeBaseProcessDocumentPostError = ProcessDocumentApiV1KnowledgeBaseProcessDocumentPostErrors[keyof ProcessDocumentApiV1KnowledgeBaseProcessDocumentPostErrors];
|
||||
|
||||
export type ProcessDocumentApiV1KnowledgeBaseProcessDocumentPostResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: DocumentResponseSchema;
|
||||
};
|
||||
|
||||
export type ProcessDocumentApiV1KnowledgeBaseProcessDocumentPostResponse = ProcessDocumentApiV1KnowledgeBaseProcessDocumentPostResponses[keyof ProcessDocumentApiV1KnowledgeBaseProcessDocumentPostResponses];
|
||||
|
||||
export type ListDocumentsApiV1KnowledgeBaseDocumentsGetData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
authorization?: string | null;
|
||||
'X-API-Key'?: string | null;
|
||||
};
|
||||
path?: never;
|
||||
query?: {
|
||||
/**
|
||||
* Filter by processing status
|
||||
*/
|
||||
status?: string | null;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
};
|
||||
url: '/api/v1/knowledge-base/documents';
|
||||
};
|
||||
|
||||
export type ListDocumentsApiV1KnowledgeBaseDocumentsGetErrors = {
|
||||
/**
|
||||
* Not found
|
||||
*/
|
||||
404: unknown;
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type ListDocumentsApiV1KnowledgeBaseDocumentsGetError = ListDocumentsApiV1KnowledgeBaseDocumentsGetErrors[keyof ListDocumentsApiV1KnowledgeBaseDocumentsGetErrors];
|
||||
|
||||
export type ListDocumentsApiV1KnowledgeBaseDocumentsGetResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: DocumentListResponseSchema;
|
||||
};
|
||||
|
||||
export type ListDocumentsApiV1KnowledgeBaseDocumentsGetResponse = ListDocumentsApiV1KnowledgeBaseDocumentsGetResponses[keyof ListDocumentsApiV1KnowledgeBaseDocumentsGetResponses];
|
||||
|
||||
export type DeleteDocumentApiV1KnowledgeBaseDocumentsDocumentUuidDeleteData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
authorization?: string | null;
|
||||
'X-API-Key'?: string | null;
|
||||
};
|
||||
path: {
|
||||
document_uuid: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/api/v1/knowledge-base/documents/{document_uuid}';
|
||||
};
|
||||
|
||||
export type DeleteDocumentApiV1KnowledgeBaseDocumentsDocumentUuidDeleteErrors = {
|
||||
/**
|
||||
* Not found
|
||||
*/
|
||||
404: unknown;
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type DeleteDocumentApiV1KnowledgeBaseDocumentsDocumentUuidDeleteError = DeleteDocumentApiV1KnowledgeBaseDocumentsDocumentUuidDeleteErrors[keyof DeleteDocumentApiV1KnowledgeBaseDocumentsDocumentUuidDeleteErrors];
|
||||
|
||||
export type DeleteDocumentApiV1KnowledgeBaseDocumentsDocumentUuidDeleteResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: unknown;
|
||||
};
|
||||
|
||||
export type GetDocumentApiV1KnowledgeBaseDocumentsDocumentUuidGetData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
authorization?: string | null;
|
||||
'X-API-Key'?: string | null;
|
||||
};
|
||||
path: {
|
||||
document_uuid: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/api/v1/knowledge-base/documents/{document_uuid}';
|
||||
};
|
||||
|
||||
export type GetDocumentApiV1KnowledgeBaseDocumentsDocumentUuidGetErrors = {
|
||||
/**
|
||||
* Not found
|
||||
*/
|
||||
404: unknown;
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type GetDocumentApiV1KnowledgeBaseDocumentsDocumentUuidGetError = GetDocumentApiV1KnowledgeBaseDocumentsDocumentUuidGetErrors[keyof GetDocumentApiV1KnowledgeBaseDocumentsDocumentUuidGetErrors];
|
||||
|
||||
export type GetDocumentApiV1KnowledgeBaseDocumentsDocumentUuidGetResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: DocumentResponseSchema;
|
||||
};
|
||||
|
||||
export type GetDocumentApiV1KnowledgeBaseDocumentsDocumentUuidGetResponse = GetDocumentApiV1KnowledgeBaseDocumentsDocumentUuidGetResponses[keyof GetDocumentApiV1KnowledgeBaseDocumentsDocumentUuidGetResponses];
|
||||
|
||||
export type SearchChunksApiV1KnowledgeBaseSearchPostData = {
|
||||
body: ChunkSearchRequestSchema;
|
||||
headers?: {
|
||||
authorization?: string | null;
|
||||
'X-API-Key'?: string | null;
|
||||
};
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/api/v1/knowledge-base/search';
|
||||
};
|
||||
|
||||
export type SearchChunksApiV1KnowledgeBaseSearchPostErrors = {
|
||||
/**
|
||||
* Not found
|
||||
*/
|
||||
404: unknown;
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type SearchChunksApiV1KnowledgeBaseSearchPostError = SearchChunksApiV1KnowledgeBaseSearchPostErrors[keyof SearchChunksApiV1KnowledgeBaseSearchPostErrors];
|
||||
|
||||
export type SearchChunksApiV1KnowledgeBaseSearchPostResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ChunkSearchResponseSchema;
|
||||
};
|
||||
|
||||
export type SearchChunksApiV1KnowledgeBaseSearchPostResponse = SearchChunksApiV1KnowledgeBaseSearchPostResponses[keyof SearchChunksApiV1KnowledgeBaseSearchPostResponses];
|
||||
|
||||
export type HealthApiV1HealthGetData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
|
|
@ -4149,4 +4505,4 @@ export type HealthApiV1HealthGetResponses = {
|
|||
|
||||
export type ClientOptions = {
|
||||
baseUrl: 'http://127.0.0.1:8000' | (string & {});
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue