Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 169 additions & 31 deletions docs/user_guide/02_hybrid_queries.ipynb
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small issue here:

11:03:03 [RedisVL] INFO   Indices:
11:03:03 [RedisVL] INFO   1. float64_session
11:03:03 [RedisVL] INFO   2. float64_cache
11:03:03 [RedisVL] INFO   3. float16_cache
11:03:03 [RedisVL] INFO   4. float32_session
11:03:03 [RedisVL] INFO   5. float16_session
11:03:03 [RedisVL] INFO   6. bfloat_session
11:03:03 [RedisVL] INFO   7. float32_cache
11:03:03 [RedisVL] INFO   8. bfloat_cache
11:03:03 [RedisVL] INFO   9. user_queries

This is collecting indices from your local instance that weren't generated by the notebook (flush the db before running the notebook and recommit)

Large diffs are not rendered by default.

Binary file modified docs/user_guide/hybrid_example_data.pkl
Binary file not shown.
6 changes: 4 additions & 2 deletions redisvl/extensions/llmcache/semantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,17 @@ def _vectorize_prompt(self, prompt: Optional[str]) -> List[float]:
if not isinstance(prompt, str):
raise TypeError("Prompt must be a string.")

return self._vectorizer.embed(prompt)
result = self._vectorizer.embed(prompt)
return result # type: ignore

async def _avectorize_prompt(self, prompt: Optional[str]) -> List[float]:
"""Converts a text prompt to its vector representation using the
configured vectorizer."""
if not isinstance(prompt, str):
raise TypeError("Prompt must be a string.")

return await self._vectorizer.aembed(prompt)
result = await self._vectorizer.aembed(prompt)
return result # type: ignore

def _check_vector_dims(self, vector: List[float]):
"""Checks the size of the provided vector and raises an error if it
Expand Down
8 changes: 4 additions & 4 deletions redisvl/extensions/router/semantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,14 @@ def __call__(
if not vector:
if not statement:
raise ValueError("Must provide a vector or statement to the router")
vector = self.vectorizer.embed(statement)
vector = self.vectorizer.embed(statement) # type: ignore

aggregation_method = (
aggregation_method or self.routing_config.aggregation_method
)

# perform route classification
top_route_match = self._classify_route(vector, aggregation_method)
top_route_match = self._classify_route(vector, aggregation_method) # type: ignore
return top_route_match

@deprecated_argument("distance_threshold")
Expand All @@ -400,7 +400,7 @@ def route_many(
if not vector:
if not statement:
raise ValueError("Must provide a vector or statement to the router")
vector = self.vectorizer.embed(statement)
vector = self.vectorizer.embed(statement) # type: ignore

max_k = max_k or self.routing_config.max_k
aggregation_method = (
Expand All @@ -409,7 +409,7 @@ def route_many(

# classify routes
top_route_matches = self._classify_multi_route(
vector, max_k, aggregation_method
vector, max_k, aggregation_method # type: ignore
)

return top_route_matches
Expand Down
2 changes: 1 addition & 1 deletion redisvl/extensions/session_manager/semantic_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def add_messages(
role=message[ROLE_FIELD_NAME],
content=message[CONTENT_FIELD_NAME],
session_tag=session_tag,
vector_field=content_vector,
vector_field=content_vector, # type: ignore
)

if TOOL_FIELD_NAME in message:
Expand Down
Loading
Loading