File
Blob: types/defines/autorag.d.ts
| 1 | /** |
| 2 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 3 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 4 | */ |
| 5 | export interface AutoRAGInternalError extends Error {} |
| 6 | |
| 7 | /** |
| 8 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 9 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 10 | */ |
| 11 | export interface AutoRAGNotFoundError extends Error {} |
| 12 | |
| 13 | /** |
| 14 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 15 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 16 | */ |
| 17 | export interface AutoRAGUnauthorizedError extends Error {} |
| 18 | |
| 19 | /** |
| 20 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 21 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 22 | */ |
| 23 | export interface AutoRAGNameNotSetError extends Error {} |
| 24 | |
| 25 | export type ComparisonFilter = { |
| 26 | key: string; |
| 27 | type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte'; |
| 28 | value: string | number | boolean; |
| 29 | }; |
| 30 | |
| 31 | export type CompoundFilter = { |
| 32 | type: 'and' | 'or'; |
| 33 | filters: ComparisonFilter[]; |
| 34 | }; |
| 35 | |
| 36 | /** |
| 37 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 38 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 39 | */ |
| 40 | export type AutoRagSearchRequest = { |
| 41 | query: string; |
| 42 | filters?: CompoundFilter | ComparisonFilter; |
| 43 | max_num_results?: number; |
| 44 | ranking_options?: { |
| 45 | ranker?: string; |
| 46 | score_threshold?: number; |
| 47 | }; |
| 48 | reranking?: { |
| 49 | enabled?: boolean; |
| 50 | model?: string; |
| 51 | }; |
| 52 | rewrite_query?: boolean; |
| 53 | }; |
| 54 | |
| 55 | /** |
| 56 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 57 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 58 | */ |
| 59 | export type AutoRagAiSearchRequest = AutoRagSearchRequest & { |
| 60 | stream?: boolean; |
| 61 | system_prompt?: string; |
| 62 | }; |
| 63 | |
| 64 | /** |
| 65 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 66 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 67 | */ |
| 68 | export type AutoRagAiSearchRequestStreaming = Omit< |
| 69 | AutoRagAiSearchRequest, |
| 70 | 'stream' |
| 71 | > & { |
| 72 | stream: true; |
| 73 | }; |
| 74 | |
| 75 | /** |
| 76 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 77 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 78 | */ |
| 79 | export type AutoRagSearchResponse = { |
| 80 | object: 'vector_store.search_results.page'; |
| 81 | search_query: string; |
| 82 | data: { |
| 83 | file_id: string; |
| 84 | filename: string; |
| 85 | score: number; |
| 86 | attributes: Record<string, string | number | boolean | null>; |
| 87 | content: { |
| 88 | type: 'text'; |
| 89 | text: string; |
| 90 | }[]; |
| 91 | }[]; |
| 92 | has_more: boolean; |
| 93 | next_page: string | null; |
| 94 | }; |
| 95 | |
| 96 | /** |
| 97 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 98 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 99 | */ |
| 100 | export type AutoRagListResponse = { |
| 101 | id: string; |
| 102 | enable: boolean; |
| 103 | type: string; |
| 104 | source: string; |
| 105 | vectorize_name: string; |
| 106 | paused: boolean; |
| 107 | status: string; |
| 108 | }[]; |
| 109 | |
| 110 | /** |
| 111 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 112 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 113 | */ |
| 114 | export type AutoRagAiSearchResponse = AutoRagSearchResponse & { |
| 115 | response: string; |
| 116 | }; |
| 117 | |
| 118 | /** |
| 119 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 120 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 121 | */ |
| 122 | export declare abstract class AutoRAG { |
| 123 | /** |
| 124 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 125 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 126 | */ |
| 127 | list(): Promise<AutoRagListResponse>; |
| 128 | |
| 129 | /** |
| 130 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 131 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 132 | */ |
| 133 | search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>; |
| 134 | |
| 135 | /** |
| 136 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 137 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 138 | */ |
| 139 | aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>; |
| 140 | |
| 141 | /** |
| 142 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 143 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 144 | */ |
| 145 | aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>; |
| 146 | |
| 147 | /** |
| 148 | * @deprecated Use the standalone AI Search Workers binding instead. |
| 149 | * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ |
| 150 | */ |
| 151 | aiSearch( |
| 152 | params: AutoRagAiSearchRequest |
| 153 | ): Promise<AutoRagAiSearchResponse | Response>; |
| 154 | } |