Skip to content

Commit

Permalink
added: list items by namespace, added: list all namespaces, fixed som…
Browse files Browse the repository at this point in the history
…e async function
  • Loading branch information
glorenzo972 committed Apr 22, 2024
1 parent ce634d0 commit c3b0868
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@ pip install -e .

# Launch


```commandline
export REDIS_URL = "redis://localhost:6379/0"
export PINECONE_API_KEY="pinecone api key"
export PINECONE_TEXT_KEY="pinecone field for text - default text in pod content"
export PINECONE_INDEX = "pinecone index name"
tilellm
--host | default 0.0.0.0
--port | default=8000
--redis_url | default="redis://localhost:6379/0"
--env | default="dev" | dev|prod
--log_path | default="log_conf.yaml"
```
create a .environ file with this variable:
```commandline
PINECONE_API_KEY="pinecone api key"
PINECONE_TEXT_KEY="pinecone field for text - default text in pod content"
PINECONE_INDEX = "pinecone index name"
```

# Docker
Expand Down
5 changes: 3 additions & 2 deletions tilellm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,10 @@ async def delete_item_id_namespace_post(item_to_delete: PineconeItemToDelete):
logger.info(f"cancellazione id {metadata_id} dal namespace {namespace}")
result = await delete_id_from_namespace(metadata_id, namespace)

return JSONResponse(content={"message": f"ids {metadata_id} in Namespace {namespace} deleted"})
return JSONResponse(content={"success": True, "message": f"ids {metadata_id} in Namespace {namespace} deleted"})
except Exception as ex:
raise HTTPException(status_code=400, detail=repr(ex))
return JSONResponse(content={"success": True, "message": f"ids {metadata_id} in Namespace {namespace} non deleted due to {repr(ex)}"})
# raise HTTPException(status_code=400, detail=repr(ex))


@app.get("/api/id/{metadata_id}/namespace/{namespace}")
Expand Down
2 changes: 2 additions & 0 deletions tilellm/store/pinecone_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,11 @@ async def delete_pc_ids_namespace(metadata_id: str, namespace: str):
include_metadata=False
)
matches = pc_res.get('matches')

ids = [obj.get('id') for obj in matches]
if not ids:
raise IndexError(f"Empty list for {metadata_id} and namespace {namespace}")

index.delete(
ids=ids,
namespace=namespace)
Expand Down

0 comments on commit c3b0868

Please sign in to comment.