This commit is contained in:
Eugene Yurtsev
2025-05-02 11:11:28 -04:00
parent d5ee604cfe
commit d497907164
5 changed files with 10 additions and 10 deletions
+1
View File
@@ -0,0 +1 @@
"""Supporting code for LangGraph tutorials."""
+1 -3
View File
@@ -117,9 +117,7 @@ class DatabaseManager:
f"The dirty database file '{self.dirty_file}' does not exist.\n"
f"Please run 'manager.initialize()' first to set up the database."
)
raise FileNotFoundError(
msg
)
raise FileNotFoundError(msg)
conn: sqlite3.Connection = sqlite3.connect(self.dirty_file)
cursor: sqlite3.Cursor = conn.cursor()
try:
@@ -85,7 +85,9 @@ def update_ticket_to_new_flight(
with DB.get_cursor() as cursor:
cursor.execute(
"SELECT departure_airport, arrival_airport, scheduled_departure FROM flights WHERE flight_id = ?",
"SELECT departure_airport, arrival_airport, scheduled_departure "
"FROM flights "
"WHERE flight_id = ?",
(new_flight_id,),
)
new_flight = cursor.fetchone()
@@ -33,9 +33,7 @@ class PolicyRetriever:
self._model = embedding_model
else:
msg = "embedding must be an Embeddings instance or a model name string"
raise ValueError(
msg
)
raise TypeError(msg)
self._docs: list[dict] | None = None
self._arr: np.ndarray | None = None
@@ -81,9 +79,7 @@ class PolicyRetriever:
"Retriever is not initialized. "
"Please call retriever.initialize() first."
)
raise RuntimeError(
msg
)
raise RuntimeError(msg)
query_vector = np.array(self._model.embed_query(query))
scores = query_vector @ self._arr.T
+3
View File
@@ -50,6 +50,8 @@ select = [
]
ignore = [
"COM812",
"E501", # Ignore long lines
"T201", # Allow print this is for a tutorial
]
@@ -74,6 +76,7 @@ build-backend = "hatchling.build"
# The below are debateable
"PLR2004", # Magic value used in comparison, ...
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
]
[tool.ruff.lint.pydocstyle]