1111from .models import (
1212 ChatRequest , ChatResponse ,
1313 SemanticSearchRequest , SemanticSearchResponse ,
14- SimilaritySearchRequest , RecommendationsRequest ,
1514 DocumentsResponse , DocumentMetadata , DocumentFullTextResponse ,
1615 EmbeddingRequest , EmbeddingResponse ,
1716 WorkspaceCreateRequest , WorkspaceResponse , WorkspaceListResponse , WorkspaceInfo ,
@@ -197,72 +196,8 @@ async def semantic_search(
197196 response .raise_for_status ()
198197 return SemanticSearchResponse (** response .json ())
199198
200- async def find_similar_chunks (
201- self ,
202- chunk_id : str ,
203- limit : int = 5 ,
204- similarity_threshold : float = 0.5
205- ) -> SemanticSearchResponse :
206- """
207- Find chunks similar to a given chunk ID.
208-
209- Useful for finding related content or duplicates.
210-
211- Args:
212- chunk_id: ID of the reference chunk
213- limit: Maximum number of results
214- similarity_threshold: Minimum similarity score
215-
216- Returns:
217- SemanticSearchResponse with similar chunks
218- """
219- request = SimilaritySearchRequest (
220- chunk_id = chunk_id ,
221- limit = limit ,
222- similarity_threshold = similarity_threshold
223- )
224-
225- self ._log (f"Finding similar to chunk: { chunk_id } " )
226- response = await self .client .post (
227- f"{ self .base_url } /api/vector/search/similarity" ,
228- json = request .model_dump ()
229- )
230- response .raise_for_status ()
231- return SemanticSearchResponse (** response .json ())
232-
233- async def get_recommendations (
234- self ,
235- positive_chunk_ids : List [str ],
236- negative_chunk_ids : Optional [List [str ]] = None ,
237- limit : int = 10
238- ) -> SemanticSearchResponse :
239- """
240- Get content recommendations based on positive/negative examples.
241-
242- Uses vector math to find content similar to positive examples
243- and dissimilar to negative examples.
244-
245- Args:
246- positive_chunk_ids: Chunk IDs to find similar content to
247- negative_chunk_ids: Chunk IDs to avoid similarity to
248- limit: Maximum number of recommendations
249-
250- Returns:
251- SemanticSearchResponse with recommended chunks
252- """
253- request = RecommendationsRequest (
254- positive_chunk_ids = positive_chunk_ids ,
255- negative_chunk_ids = negative_chunk_ids or [],
256- limit = limit
257- )
258-
259- self ._log (f"Getting recommendations based on { len (positive_chunk_ids )} positive examples" )
260- response = await self .client .post (
261- f"{ self .base_url } /api/vector/recommendations" ,
262- json = request .model_dump ()
263- )
264- response .raise_for_status ()
265- return SemanticSearchResponse (** response .json ())
199+ # Note: find_similar_chunks and get_recommendations methods have been deprecated
200+ # Use semantic_search or hierarchical_retrieve for similar functionality
266201
267202 # ==================== Document Management ====================
268203
@@ -511,12 +446,14 @@ async def persona_chat(
511446 system_prompt_template : Optional [str ] = None ,
512447 conversation_history : Optional [List [Dict [str , str ]]] = None ,
513448 max_tokens : int = 1024 ,
514- temperature : float = 0.7
449+ temperature : float = 0.7 ,
450+ workspace_filter : Optional [str ] = None
515451 ) -> PersonaChatResponse :
516452 """
517453 Chat with a specific AI persona.
518454
519455 Each persona has its own personality, expertise, and interaction style.
456+ Now supports RAG context when workspace_filter is provided.
520457
521458 Args:
522459 persona_id: ID of the persona to chat with
@@ -526,6 +463,7 @@ async def persona_chat(
526463 conversation_history: Optional conversation history for context
527464 max_tokens: Maximum tokens to generate
528465 temperature: Temperature for generation
466+ workspace_filter: Optional workspace ID for RAG context
529467
530468 Returns:
531469 PersonaChatResponse with persona's response
@@ -537,7 +475,8 @@ async def persona_chat(
537475 system_prompt_template = system_prompt_template ,
538476 conversation_history = conversation_history ,
539477 max_tokens = max_tokens ,
540- temperature = temperature
478+ temperature = temperature ,
479+ workspace_filter = workspace_filter
541480 )
542481
543482 self ._log (f"Chatting with persona: { persona_id } " )
0 commit comments