11import warnings
2- from typing import TYPE_CHECKING , Any , Protocol
2+ from typing import TYPE_CHECKING , Protocol
3+
4+ from .types import (
5+ AnswerResponse ,
6+ ChatHistoryItem ,
7+ Document ,
8+ DocumentDeleteResponse ,
9+ DocumentGetResponse ,
10+ DocumentUploadResponse ,
11+ NamespaceCreateResponse ,
12+ NamespaceListResponse ,
13+ SearchResponse ,
14+ Vector ,
15+ VectorDeleteResponse ,
16+ VectorUploadResponse ,
17+ )
318
419if TYPE_CHECKING :
520 from .resources import Answer , Documents , Namespaces , Search , Vectors
@@ -24,7 +39,7 @@ def create_namespace(
2439 namespace_name : str ,
2540 type : str ,
2641 vector_dimension : int | None = None ,
27- ) -> dict [ str , Any ] :
42+ ) -> NamespaceCreateResponse :
2843 """
2944 [DEPRECATED] Creates a new namespace.
3045
@@ -73,7 +88,7 @@ def delete_namespace(self: "ClientProtocol", namespace_name: str) -> None:
7388 )
7489 self .namespaces .delete (namespace_name = namespace_name )
7590
76- def list_namespaces (self : "ClientProtocol" ) -> dict [ str , Any ] :
91+ def list_namespaces (self : "ClientProtocol" ) -> NamespaceListResponse :
7792 """
7893 [DEPRECATED] Lists all available namespaces.
7994
@@ -104,8 +119,8 @@ def list_namespaces(self: "ClientProtocol") -> dict[str, Any]:
104119 return self .namespaces .list ()
105120
106121 def upload_documents (
107- self : "ClientProtocol" , namespace_name : str , documents : list [dict [ str , Any ] ]
108- ) -> dict [ str , Any ] :
122+ self : "ClientProtocol" , namespace_name : str , documents : list [Document ]
123+ ) -> DocumentUploadResponse :
109124 """
110125 [DEPRECATED] Uploads text documents to a text-based namespace.
111126
@@ -138,7 +153,7 @@ def upload_documents(
138153
139154 def get_documents (
140155 self : "ClientProtocol" , namespace_name : str , ids : list [str | int ]
141- ) -> dict [ str , Any ] :
156+ ) -> DocumentGetResponse :
142157 """
143158 [DEPRECATED] Retrieves documents by their IDs from a text-based namespace.
144159
@@ -171,8 +186,8 @@ def get_documents(
171186 return self .documents .get (namespace_name = namespace_name , ids = ids )
172187
173188 def upload_vectors (
174- self : "ClientProtocol" , namespace_name : str , vectors : list [dict [ str , Any ] ]
175- ) -> dict [ str , Any ] :
189+ self : "ClientProtocol" , namespace_name : str , vectors : list [Vector ]
190+ ) -> VectorUploadResponse :
176191 """
177192 [DEPRECATED] Uploads pre-computed vectors to a vector-based namespace.
178193
@@ -209,9 +224,9 @@ def search(
209224 namespaces : list [str ],
210225 query : str | list [float ],
211226 top_k : int = 10 ,
212- threshold : float | None = 0.7 ,
227+ threshold : float | None = 0.25 ,
213228 kiosk_mode : bool = False ,
214- ) -> dict [ str , Any ] :
229+ ) -> SearchResponse :
215230 """
216231 [DEPRECATED] Performs a semantic search across namespaces.
217232
@@ -221,7 +236,7 @@ def search(
221236 namespaces: A list of namespace names to search within.
222237 query: The search query (text string or vector list).
223238 top_k: The maximum number of results to return. Defaults to 10.
224- threshold: Minimum similarity score (0-1). Defaults to 0.7 .
239+ threshold: Minimum similarity score (0-1). Defaults to 0.25 .
225240 kiosk_mode: Enable strict filtering. Defaults to False.
226241
227242 Returns:
@@ -260,9 +275,11 @@ def get_generative_answer(
260275 query : str ,
261276 top_k : int = 5 ,
262277 ai_model : str = "anthropic.claude-sonnet-4-20250514-v1:0" ,
263- chat_history : list [dict [ str , Any ] ] | None = None ,
278+ chat_history : list [ChatHistoryItem ] | None = None ,
264279 temperature : float = 0.7 ,
265- ) -> dict [str , Any ]:
280+ header_prompt : str | None = None ,
281+ footer_prompt : str | None = None ,
282+ ) -> AnswerResponse :
266283 """
267284 [DEPRECATED] Generates an AI answer based on a search query within a namespace.
268285
@@ -278,6 +295,10 @@ def get_generative_answer(
278295 Each item should be a dictionary. Defaults to None.
279296 temperature: The sampling temperature for the LLM (0.0 to 1.0).
280297 Higher values introduce more randomness. Defaults to 0.7.
298+ header_prompt: Optional header prompt to be used in the LLM.
299+ Defaults to None.
300+ footer_prompt: Optional footer prompt to be used in the LLM.
301+ Defaults to None.
281302
282303 Returns:
283304 A dictionary containing the generated answer and metadata.
@@ -303,11 +324,13 @@ def get_generative_answer(
303324 ai_model = ai_model ,
304325 chat_history = chat_history ,
305326 temperature = temperature ,
327+ header_prompt = header_prompt ,
328+ footer_prompt = footer_prompt ,
306329 )
307330
308331 def delete_documents (
309332 self : "ClientProtocol" , namespace_name : str , ids : list [str | int ]
310- ) -> dict [ str , Any ] :
333+ ) -> DocumentDeleteResponse :
311334 """
312335 [DEPRECATED] Deletes documents by their IDs from a text-based namespace.
313336
@@ -337,7 +360,7 @@ def delete_documents(
337360
338361 def delete_vectors (
339362 self : "ClientProtocol" , namespace_name : str , ids : list [str | int ]
340- ) -> dict [ str , Any ] :
363+ ) -> VectorDeleteResponse :
341364 """
342365 [DEPRECATED] Deletes vectors by their IDs from a vector-based namespace.
343366
0 commit comments