File tree Expand file tree Collapse file tree 8 files changed +8
-9
lines changed
langchain/langchain/memory/chat_message_histories Expand file tree Collapse file tree 8 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 2
2
import typing as t
3
3
4
4
import sqlalchemy as sa
5
- from sqlalchemy_cratedb .support import refresh_after_dml , refresh_table
6
5
from langchain .schema import BaseMessage , _message_to_dict , messages_from_dict
6
+ from sqlalchemy_cratedb .support import refresh_after_dml , refresh_table
7
7
8
8
from langchain_community .chat_message_histories .sql import (
9
9
BaseMessageConverter ,
Original file line number Diff line number Diff line change 19
19
from langchain .utils import get_from_dict_or_env
20
20
from langchain .vectorstores .pgvector import PGVector
21
21
from sqlalchemy .orm import sessionmaker
22
+ from sqlalchemy_cratedb .support import refresh_after_dml , refresh_table
22
23
23
24
from langchain_community .vectorstores .cratedb .model import ModelFactory
24
- from sqlalchemy_cratedb .support import refresh_after_dml , refresh_table
25
25
26
26
27
27
class DistanceStrategy (str , enum .Enum ):
Original file line number Diff line number Diff line change 8
8
)
9
9
10
10
import sqlalchemy
11
-
12
11
from langchain .schema .embeddings import Embeddings
13
12
14
13
from langchain_community .vectorstores .cratedb .base import (
Original file line number Diff line number Diff line change 2
2
from typing import Any , List , Optional , Tuple
3
3
4
4
import sqlalchemy
5
- from sqlalchemy_cratedb import ObjectType , FloatVector
6
5
from sqlalchemy .orm import Session , declarative_base , relationship
6
+ from sqlalchemy_cratedb import FloatVector , ObjectType
7
7
8
8
9
9
def generate_uuid () -> str :
Original file line number Diff line number Diff line change @@ -122,9 +122,7 @@ def pytest_generate_tests(metafunc: "Metafunc") -> None:
122
122
# use `docker compose up postgres` to start the instance
123
123
# it will have the appropriate credentials set up including
124
124
# being exposed on the appropriate port.
125
- urls .append (
126
- "crate://crate@localhost/?schema=testdrive"
127
- )
125
+ urls .append ("crate://crate@localhost/?schema=testdrive" )
128
126
ids .append ("cratedb" )
129
127
130
128
metafunc .parametrize ("db_uri" , urls , ids = ids )
Original file line number Diff line number Diff line change 4
4
cd tests/integration_tests/vectorstores/docker-compose
5
5
docker-compose -f cratedb.yml up
6
6
"""
7
+
7
8
import os
8
9
import re
9
10
from typing import Dict , Generator , List
Original file line number Diff line number Diff line change 4
4
import pytest
5
5
import sqlalchemy as sa
6
6
import sqlalchemy .orm
7
- from langchain_community .utilities .sql_database import SQLDatabase , truncate_word
8
7
from packaging import version
9
8
from sqlalchemy import (
10
9
Column ,
18
17
)
19
18
from sqlalchemy .engine import Engine , Result
20
19
20
+ from langchain_community .utilities .sql_database import SQLDatabase , truncate_word
21
+
21
22
is_sqlalchemy_v1 = version .parse (sa .__version__ ).major == 1
22
23
23
24
metadata_obj = MetaData ()
Original file line number Diff line number Diff line change 13
13
# handling optional imports.
14
14
DEPRECATED_LOOKUP = {
15
15
"CrateDBChatMessageHistory" : "langchain_community.chat_message_histories" ,
16
- "CrateDBMessageConverter" : "langchain_community.chat_message_histories"
16
+ "CrateDBMessageConverter" : "langchain_community.chat_message_histories" ,
17
17
}
18
18
19
19
_import_attribute = create_importer (__package__ , deprecated_lookups = DEPRECATED_LOOKUP )
You can’t perform that action at this time.
0 commit comments