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

Add an HTTPException to the query endpoint to handle engine failure #22 #24 #25

Open
Haste171 opened this issue Jan 13, 2024 · 2 comments

Comments

@Haste171
Copy link
Owner

Add an HTTPException to the query endpoint to handle engine failure #22 #24

@Haste171
Copy link
Owner Author

Haste171 commented Jan 13, 2024

Sweeping

40%

🔎 Searching

I'm searching for relevant snippets in your repository.

Code Snippets Found

https://github.com/Haste171/llamaindex-retrieval-api/blob/9cd5c37e745e52e3b1eba66d885992d34be0be64/routers/loaders/pdf.py#L0-L22

@Haste171
Copy link
Owner Author

{"tag": "INITIAL_PLANNING", "workflow": {"tasks": [{"step": "Step 1", "name": "Import HTTPException", "action": "modify", "file": "routers/retrievers/query.py", "start_line": 1, "end_line": 1, "instructions": "At the top of the file, import HTTPException from fastapi.exceptions by adding the line 'from fastapi.exceptions import HTTPException'.", "async_score": 2, "assigned_agent": "AI", "dependencies": []}, {"step": "Step 2", "name": "Add HTTPException to query endpoint", "action": "modify", "file": "routers/retrievers/query.py", "start_line": 10, "end_line": 20, "instructions": "In the function that handles the query endpoint, add a try-except block around the code that interacts with the engine. In the except block, raise an HTTPException with status code 500 and a detail message indicating an engine failure. For example, 'except EngineFailure: raise HTTPException(status_code=500, detail='Engine failure')'.", "async_score": 8, "assigned_agent": "AI", "dependencies": ["Step 1"]}, {"step": "Step 3", "name": "Test HTTPException", "action": "create", "file": "tests/test_query.py", "start_line": 1, "end_line": 50, "instructions": "Create a new test file 'tests/test_query.py'. In this file, write tests to ensure that the HTTPException is raised correctly when the engine fails. This will involve creating a mock engine that raises an EngineFailure, and then making a request to the query endpoint and checking that the response has a status code of 500 and the correct detail message.", "async_score": 10, "assigned_agent": "User", "dependencies": ["Step 2"]}], "snippets": []}}

Step 1: Import HTTPException
	Action: modify
	File: routers/retrievers/query.py
	Start Line: 1
	End Line: 1
	Instructions: At the top of the file, import HTTPException from fastapi.exceptions by adding the line 'from fastapi.exceptions import HTTPException'.
	Async Score: 2
	Assigned Agent: AI
	Dependencies: []
Step 2: Add HTTPException to query endpoint
	Action: modify
	File: routers/retrievers/query.py
	Start Line: 10
	End Line: 20
	Instructions: In the function that handles the query endpoint, add a try-except block around the code that interacts with the engine. In the except block, raise an HTTPException with status code 500 and a detail message indicating an engine failure. For example, 'except EngineFailure: raise HTTPException(status_code=500, detail='Engine failure')'.
	Async Score: 8
	Assigned Agent: AI
	Dependencies: ['Step 1']
Step 3: Test HTTPException
	Action: create
	File: tests/test_query.py
	Start Line: 1
	End Line: 50
	Instructions: Create a new test file 'tests/test_query.py'. In this file, write tests to ensure that the HTTPException is raised correctly when the engine fails. This will involve creating a mock engine that raises an EngineFailure, and then making a request to the query endpoint and checking that the response has a status code of 500 and the correct detail message.
	Async Score: 10
	Assigned Agent: User
	Dependencies: ['Step 2']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant