document.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. export interface DocumentInput<Metadata extends Record<string, any> = Record<string, any>> {
  2. pageContent: string;
  3. metadata?: Metadata;
  4. /**
  5. * An optional identifier for the document.
  6. *
  7. * Ideally this should be unique across the document collection and formatted
  8. * as a UUID, but this will not be enforced.
  9. */
  10. id?: string;
  11. }
  12. export interface DocumentInterface<Metadata extends Record<string, any> = Record<string, any>> {
  13. pageContent: string;
  14. metadata: Metadata;
  15. /**
  16. * An optional identifier for the document.
  17. *
  18. * Ideally this should be unique across the document collection and formatted
  19. * as a UUID, but this will not be enforced.
  20. */
  21. id?: string;
  22. }
  23. /**
  24. * Interface for interacting with a document.
  25. */
  26. export declare class Document<Metadata extends Record<string, any> = Record<string, any>> implements DocumentInput, DocumentInterface {
  27. pageContent: string;
  28. metadata: Metadata;
  29. /**
  30. * An optional identifier for the document.
  31. *
  32. * Ideally this should be unique across the document collection and formatted
  33. * as a UUID, but this will not be enforced.
  34. */
  35. id?: string;
  36. constructor(fields: DocumentInput<Metadata>);
  37. }