Skip to content

Commit 7e744d2

Browse files
committed
Revert some changes
1 parent 292517b commit 7e744d2

File tree

7 files changed

+16
-22
lines changed

7 files changed

+16
-22
lines changed

.vscode/settings.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,5 @@
3636
"htmlcov": true,
3737
".mypy_cache": true,
3838
".coverage": true
39-
},
40-
"python.REPL.enableREPLSmartSend": false
39+
}
4140
}

src/backend/fastapi_app/__init__.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,11 @@ def create_app(testing: bool = False):
5858
else:
5959
if not testing:
6060
load_dotenv(override=True)
61-
logging.basicConfig(level=logging.DEBUG)
62-
63-
# Enable detailed HTTP traffic logging
64-
logging.getLogger("httpx").setLevel(logging.DEBUG)
65-
logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.DEBUG)
66-
logging.getLogger("azure.identity").setLevel(logging.DEBUG)
67-
logging.getLogger("urllib3").setLevel(logging.DEBUG)
61+
logging.basicConfig(level=logging.INFO)
6862

69-
# Configure httpx logging to show full bodies
70-
os.environ["HTTPX_LOG_LEVEL"] = "DEBUG"
71-
os.environ["HTTPCORE_LOG_LEVEL"] = "DEBUG"
63+
# Turn off particularly noisy INFO level logs from Azure Core SDK:
64+
logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.WARNING)
65+
logging.getLogger("azure.identity").setLevel(logging.WARNING)
7266

7367
if os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING"):
7468
logger.info("Configuring Azure Monitor")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
Your job is to find search results based off the user's question and past messages.
2+
You have access to only these tools:
3+
1. **search_database**: This tool allows you to search a table for items based on a query.
4+
You can pass in a search query and optional filters.
25
Once you get the search results, you're done.

src/backend/fastapi_app/rag_advanced.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async def search_database(
8282
Search PostgreSQL database for relevant products based on user query
8383
8484
Args:
85-
search_query: Query string to use for full text search, e.g. 'red shoes'
85+
search_query: English query string to use for full text search, e.g. 'red shoes'.
8686
price_filter: Filter search results based on price of the product
8787
brand_filter: Filter search results based on brand of the product
8888
@@ -109,7 +109,7 @@ async def search_database(
109109
async def prepare_context(self) -> tuple[list[ItemPublic], list[ThoughtStep]]:
110110
few_shots = ModelMessagesTypeAdapter.validate_json(self.query_fewshots)
111111
user_query = f"Find search results for user query: {self.chat_params.original_user_query}"
112-
results = await self.search_agent.run( # type: ignore[call-overload]
112+
results = await self.search_agent.run(
113113
user_query,
114114
message_history=few_shots + self.chat_params.past_messages,
115115
deps=self.chat_params,

src/backend/fastapi_app/routes/api_routes.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import http.client
21
import json
32
import logging
43
from collections.abc import AsyncGenerator
@@ -27,8 +26,6 @@
2726
router = fastapi.APIRouter()
2827

2928

30-
http.client.HTTPConnection.debuglevel = 1
31-
3229
ERROR_FILTER = {"error": "Your message contains content that was flagged by the content filter."}
3330

3431

src/frontend/src/components/Answer/Answer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const Answer = ({
3434
const parsedAnswer = useMemo(() => parseAnswerToHtml(messageContent, isStreaming, onCitationClicked), [answer]);
3535

3636
const sanitizedAnswerHtml = DOMPurify.sanitize(parsedAnswer.answerHtml);
37+
3738
return (
3839
<Stack className={`${styles.answerContainer} ${isSelected && styles.selected}`} verticalAlign="space-between">
3940
<Stack.Item>

tests/test_postgres_searcher.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from fastapi_app.api_models import BrandFilter, ItemPublic, PriceFilter
3+
from fastapi_app.api_models import Filter, ItemPublic
44
from tests.data import test_data
55

66

@@ -12,7 +12,7 @@ def test_postgres_build_filter_clause_without_filters(postgres_searcher):
1212
def test_postgres_build_filter_clause_with_filters(postgres_searcher):
1313
assert postgres_searcher.build_filter_clause(
1414
[
15-
BrandFilter(comparison_operator="=", value="AirStrider"),
15+
Filter(column="brand", comparison_operator="=", value="AirStrider"),
1616
]
1717
) == (
1818
"WHERE brand = 'AirStrider'",
@@ -23,11 +23,11 @@ def test_postgres_build_filter_clause_with_filters(postgres_searcher):
2323
def test_postgres_build_filter_clause_with_filters_numeric(postgres_searcher):
2424
assert postgres_searcher.build_filter_clause(
2525
[
26-
PriceFilter(comparison_operator="<", value=30),
26+
Filter(column="price", comparison_operator="<", value=30),
2727
]
2828
) == (
29-
"WHERE price < 30.0",
30-
"AND price < 30.0",
29+
"WHERE price < 30",
30+
"AND price < 30",
3131
)
3232

3333

0 commit comments

Comments
 (0)