Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws[patch]: Remove numpy dependency (previously patch to support numpy2) #282

Merged
merged 6 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion libs/aws/langchain_aws/utilities/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def cosine_similarity_top_k(
score_threshold = score_threshold or -1.0
score_array[score_array < score_threshold] = 0
top_k = min(top_k or len(score_array), np.count_nonzero(score_array))
top_k_idxs = np.argpartition(score_array, -top_k, axis=None)[-top_k:]
top_k_idxs = np.argpartition(score_array, -top_k, axis=None)[-top_k:] # type: ignore
top_k_idxs = top_k_idxs[np.argsort(score_array.ravel()[top_k_idxs])][::-1]
ret_idxs = np.unravel_index(top_k_idxs, score_array.shape)
scores = score_array.ravel()[top_k_idxs].tolist()
Expand Down
2 changes: 1 addition & 1 deletion libs/aws/langchain_aws/vectorstores/inmemorydb/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class InMemoryDBVectorField(InMemoryDBField):
dims: int = Field(...)
algorithm: object = Field(...)
datatype: str = Field(default="FLOAT32")
distance_metric: InMemoryDBDistanceMetric = Field(default="COSINE")
distance_metric: InMemoryDBDistanceMetric = Field(default="COSINE") # type: ignore
initial_cap: Optional[int] = None

@field_validator("algorithm", "datatype", "distance_metric", mode="before")
Expand Down
Loading
Loading