Skip to content

Commit b0af3cf

Browse files
committed
fix import ordering
1 parent 34430b0 commit b0af3cf

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/langchain_google_spanner/chat_message_history.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@
1515
"""Cloud Spanner-based chat message history"""
1616
from __future__ import annotations
1717

18-
import json
1918
from typing import List, Optional
2019

2120
from google.cloud import spanner
2221
from google.cloud.spanner_admin_database_v1.types import DatabaseDialect # type: ignore
2322
from google.cloud.spanner_v1 import param_types
2423
from google.cloud.spanner_v1.data_types import JsonObject
2524
from langchain_core.chat_history import BaseChatMessageHistory
26-
from langchain_core.messages import BaseMessage, message_to_dict, messages_from_dict
25+
from langchain_core.messages import BaseMessage, messages_from_dict
2726

2827
OPERATION_TIMEOUT_SECONDS = 240
2928

@@ -70,7 +69,7 @@ def _verify_schema(self) -> None:
7069
table with valid schema.
7170
"""
7271
# check table exists
73-
column_names = []
72+
column_names = [] # type: List[str]
7473
with self.database.snapshot() as snapshot:
7574
results = snapshot.execute_sql(
7675
f"SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.columns WHERE table_name = '{self.table_name}'"
@@ -148,7 +147,7 @@ def messages(self) -> List[BaseMessage]: # type: ignore
148147
params=param,
149148
param_types=param_type,
150149
)
151-
items = []
150+
items = [] # type: List[dict]
152151
for row in results:
153152
items.append({"data": row[0], "type": row[0]["type"]})
154153
messages = messages_from_dict(items)

tests/integration/test_spanner_chat_message_history.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
import os
17+
1618
import pytest # noqa
1719
from google.cloud.spanner import Client # type: ignore
1820
from langchain_core.messages.ai import AIMessage

0 commit comments

Comments
 (0)