types.ts 1017 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * Shared types for the RAG system.
  3. * Centralizes interfaces to avoid duplication across modules.
  4. */
  5. // Interface for structuring document data
  6. export interface Documento {
  7. nome: string;
  8. caminho: string;
  9. conteudo: string;
  10. tamanho: number;
  11. }
  12. // Interface for a document with its embedding
  13. export interface DocumentoComEmbedding extends Documento {
  14. embedding: number[];
  15. }
  16. // Interface for a document in the database
  17. export interface DocumentoBD {
  18. id: number;
  19. nome: string;
  20. caminho: string;
  21. conteudo: string;
  22. embedding: string; // JSON stringified
  23. data_indexacao: string;
  24. }
  25. // Interface for Ollama embedding request
  26. export interface OllamaEmbeddingRequest {
  27. model: string;
  28. prompt: string;
  29. }
  30. // Interface for Ollama embedding response
  31. export interface OllamaEmbeddingResponse {
  32. embedding: number[];
  33. }
  34. // Interface for search results
  35. export interface ResultadoBusca {
  36. documento: DocumentoComEmbedding;
  37. similaridade: number; // Value between -1 and 1 (higher is more similar)
  38. }