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

X/migration fix: Fixed migrations and docs search route #1026

Merged
merged 2 commits into from
Jan 7, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def search_docs_by_embedding(
embedding: list[float],
k: int = 10,
owners: list[tuple[Literal["user", "agent"], UUID]],
confidence: float = 0.5,
confidence: int | float = 0.5,
metadata_filter: dict[str, Any] = {},
) -> tuple[str, list]:
"""
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/queries/docs/search_docs_hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def search_docs_hybrid(
alpha: float = 0.5,
metadata_filter: dict[str, Any] = {},
search_language: str = "english",
confidence: float = 0.5,
confidence: int | float = 0.5,
) -> tuple[str, list]:
"""
Hybrid text-and-embedding doc search. We get top-K from each approach,
Expand Down
2 changes: 1 addition & 1 deletion agents-api/tests/test_docs_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async def _(make_request=make_request, agent=test_agent):
assert response.status_code == 200
assert response.json()["id"] == doc_id
assert response.json()["title"] == "Test Agent Doc"
assert response.json()["content"] == "This is a test agent document."
assert response.json()["content"] == ["This is a test agent document."]

response = make_request(
method="DELETE",
Expand Down
10 changes: 10 additions & 0 deletions memory-store/migrations/000021_fix_toolname_contraint.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
BEGIN;

-- Drop the updated unique constraint
ALTER TABLE tools DROP CONSTRAINT IF EXISTS ct_unique_name_per_agent;

-- Restore the original unique constraint (without developer_id)
ALTER TABLE tools ADD CONSTRAINT ct_unique_name_per_agent
UNIQUE (agent_id, name, task_id);

COMMIT;
10 changes: 10 additions & 0 deletions memory-store/migrations/000021_fix_toolname_contraint.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
BEGIN;

-- Drop the existing unique constraint
ALTER TABLE tools DROP CONSTRAINT IF EXISTS ct_unique_name_per_agent;

-- Add the new unique constraint including developer_id
ALTER TABLE tools ADD CONSTRAINT ct_unique_name_per_agent
UNIQUE (developer_id, agent_id, name, task_id);

COMMIT;
Loading