Skip to content

Commit

Permalink
Merge pull request #1026 from julep-ai/x/migration-fix
Browse files Browse the repository at this point in the history
X/migration fix: Fixed migrations and docs search route
  • Loading branch information
Vedantsahai18 authored Jan 7, 2025
2 parents a3edb51 + e588162 commit fefec22
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
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;

0 comments on commit fefec22

Please sign in to comment.