-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/e2e datasets metadata #49
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
Open
paul-tharun
wants to merge
15
commits into
main
Choose a base branch
from
feat/e2e-datasets-metadata
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8810929
feat(chat-server): sync changes
yuvrajsinh5252 03b6540
feat(auth): temp changes
yuvrajsinh5252 d446c0b
refactor(graph-utils): enhance SQL query handling and update data types
yuvrajsinh5252 0e8b653
refactor: added harcoded metadata for testing
yuvrajsinh5252 e8c860d
chore: update dependencies
yuvrajsinh5252 6d9bba7
```
e407ffe
feat(embedding): add vLLM embedding provider support
d1f0923
feat: integrate hybrid search with Qdrant
yuvrajsinh5252 e010cdc
feat(docs): add script for hybrid search migration
yuvrajsinh5252 d775e63
Merge branch 'feat/hybrid-search' into feat/e2e-datasets-metadata
yuvrajsinh5252 a875bb0
refactor: reimplement Qdrant collection reindexing script for asynchr…
af0a2b3
feat: Add sparse model health check to the /health endpoint.
700b36b
feat: Update Qdrant reindexing script to use gRPC for client communic…
40d0dbb
fix: Ensure --port argument is parsed as an integer.
bda820b
web: provide access project and datasets to all org members
shreeharsha-factly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| from fastapi import APIRouter, HTTPException, status | ||
|
|
||
| from app.core.log import custom_logger as logger | ||
| from app.models.router import FetchSqlRequest, FetchSqlResponse | ||
| from app.workflow.graph.nl_to_sql_graph.graph import nl_to_sql_graph | ||
|
|
||
| fetch_sql_router = APIRouter() | ||
|
|
||
|
|
||
| @fetch_sql_router.post("/fetch-sql", response_model=FetchSqlResponse) | ||
| async def fetch_sql(payload: FetchSqlRequest): | ||
| """ | ||
| Generate SQL queries from a natural language description. | ||
|
|
||
| - Single dataset: provide `dataset_ids` with one ID | ||
| - Multi-dataset: provide `dataset_ids` with multiple IDs and/or `project_ids` | ||
|
|
||
| Returns a list of generated SQL queries with their explanations. | ||
| """ | ||
| try: | ||
| dataset_ids = [did for did in (payload.dataset_ids or []) if did] | ||
| project_ids = [pid for pid in (payload.project_ids or []) if pid] | ||
|
|
||
| result = await nl_to_sql_graph.ainvoke( | ||
| { | ||
| "user_query": payload.description, | ||
| "dataset_ids": dataset_ids or None, | ||
| "project_ids": project_ids or None, | ||
| } | ||
| ) | ||
|
|
||
| return FetchSqlResponse( | ||
| sql_queries=result.get("sql_queries", []), | ||
| message=result.get("message"), | ||
| ) | ||
| except Exception as e: | ||
| logger.error(f"Error in fetch_sql: {e}") | ||
|
|
||
| raise HTTPException( | ||
| status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, | ||
| detail="Failed to generate SQL queries, please try again.", | ||
| ) from e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| """ | ||
| Unified client for all Gopie API requests. | ||
| Handles authentication, headers, and request management. | ||
| """ | ||
| from typing import Any, Optional | ||
|
|
||
| import aiohttp | ||
|
|
||
| from app.core.config import settings | ||
| from app.core.log import custom_logger as logger | ||
| from app.core.session import SingletonAiohttp | ||
|
|
||
|
|
||
| class GopieClient: | ||
| """ | ||
| Unified client for making requests to the Gopie API. | ||
| Automatically handles org-id header and base URL configuration. | ||
| """ | ||
|
|
||
| def __init__(self, org_id: Optional[str] = None): | ||
| """ | ||
| Initialize the Gopie client. | ||
|
|
||
| Args: | ||
| org_id: Organization ID to include in request headers | ||
| """ | ||
| self.base_url = settings.GOPIE_API_ENDPOINT.rstrip("/") | ||
| self.org_id = org_id | ||
| self._session = SingletonAiohttp.get_aiohttp_client() | ||
|
|
||
| def _get_headers(self, additional_headers: Optional[dict[str, str]] = None) -> dict[str, str]: | ||
| """ | ||
| Build headers for the request, including org-id if available. | ||
|
|
||
| Args: | ||
| additional_headers: Optional additional headers to include | ||
|
|
||
| Returns: | ||
| Dictionary of headers | ||
| """ | ||
| headers = {"accept": "application/json"} | ||
|
|
||
| if self.org_id: | ||
| headers["X-Organization-id"] = self.org_id | ||
|
|
||
| if additional_headers: | ||
| headers.update(additional_headers) | ||
|
|
||
| return headers | ||
|
|
||
| async def get( | ||
| self, | ||
| path: str, | ||
| headers: Optional[dict[str, str]] = None, | ||
| **kwargs: Any, | ||
| ) -> aiohttp.ClientResponse: | ||
| """ | ||
| Make a GET request to the Gopie API. | ||
|
|
||
| Args: | ||
| path: API path (will be appended to base_url) | ||
| headers: Optional additional headers | ||
| **kwargs: Additional arguments to pass to aiohttp | ||
|
|
||
| Returns: | ||
| aiohttp ClientResponse | ||
| """ | ||
| url = f"{self.base_url}{path}" | ||
| request_headers = self._get_headers(headers) | ||
|
|
||
| logger.debug(f"GET request to {url}") | ||
| return await self._session.get(url, headers=request_headers, **kwargs) | ||
|
|
||
| async def post( | ||
| self, | ||
| path: str, | ||
| json: Optional[dict[str, Any]] = None, | ||
| headers: Optional[dict[str, str]] = None, | ||
| **kwargs: Any, | ||
| ) -> aiohttp.ClientResponse: | ||
| """ | ||
| Make a POST request to the Gopie API. | ||
|
|
||
| Args: | ||
| path: API path (will be appended to base_url) | ||
| json: JSON payload for the request | ||
| headers: Optional additional headers | ||
| **kwargs: Additional arguments to pass to aiohttp | ||
|
|
||
| Returns: | ||
| aiohttp ClientResponse | ||
| """ | ||
| url = f"{self.base_url}{path}" | ||
| request_headers = self._get_headers(headers) | ||
|
|
||
| logger.debug(f"POST request to {url}") | ||
| return await self._session.post(url, json=json, headers=request_headers, **kwargs) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.