Skip to content

community[patch]: Make sql record manager fully compatible with async #20735

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

Merged
merged 39 commits into from
May 8, 2024
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a5afb78
Add MistralAI provider
pprados Mar 19, 2024
1909eb3
Fix _amake_session()
pprados Apr 22, 2024
f68eb79
Merge branch 'master' into pprados/fix_sql_record_manager
pprados Apr 25, 2024
b329fe7
core[patch]: Release 0.1.46 (#20891)
baskaryan Apr 25, 2024
842d84f
partner: Upstage quick documentation update (#20869)
chosh0615 Apr 25, 2024
a564385
core[minor], langchain[patch], community[patch]: mv StructuredQuery (…
baskaryan Apr 25, 2024
435bc56
openai[patch]: Allow disablling safe_len_embeddings(OpenAIEmbeddings)…
mokeyish Apr 25, 2024
123f19e
community[patch]: add BeautifulSoupTransformer remove_unwanted_classn…
JasonSTong Apr 25, 2024
033d310
multiple: remove external repo mds (#20896)
Apr 25, 2024
47f8627
community[mionr]: add Jina Reranker in retrievers module (#19406)
Apr 25, 2024
8bbd881
docs: Fix misplaced zep cloud example links (#20867)
paul-paliychuk Apr 25, 2024
9fdaee0
upstage: release 0.1.2 (#20898)
Apr 25, 2024
fd18641
docs: Use voyage-law-2 in the examples (#20784)
fzowl Apr 25, 2024
7355151
docs: Fix broken link in agents.ipynb (#20872)
samanhappy Apr 25, 2024
b58bb76
community[patch]: add HTTP response headers Content-Type to metadata …
coolbeevip Apr 25, 2024
648a595
community[patch]: Support passing graph object to Neo4j integrations …
tomasonjo Apr 25, 2024
25b3910
docs: hide model import in multiple_tools.ipynb (#20883)
merdan-9 Apr 25, 2024
18d53da
core, community: deprecate tool.__call__ (#20900)
ccurme Apr 25, 2024
97ba189
docs: update chat model feature table (#20899)
ccurme Apr 25, 2024
4417aa1
mistral, openai: support custom tokenizers in chat models (#20901)
ccurme Apr 25, 2024
b0d7bab
community[patch]: deprecate persist method in Chroma (#20855)
AndresAlgaba Apr 25, 2024
5ec5e90
community: fix tqdm import (#20263)
davidefantiniIntel Apr 25, 2024
feca792
community[minor]: Add relyt vector database (#20316)
klaus-xiong Apr 25, 2024
b5d5c97
cli[minor]: Add __version__ (#20903)
eyurtsev Apr 25, 2024
3c702a7
community[patch]: Add semantic info to metadata, classified by pebblo…
rahul-trip Apr 25, 2024
471718c
community[patch]: add more data types support to ipex-llm llm integra…
shane-huang Apr 25, 2024
88df1a7
experimental[patch]: remove \n from AutoGPT feedback_tool exit check …
mjschock Apr 25, 2024
6d721ce
core[patch]: improve comma separated list output parser to handle non…
anish749 Apr 25, 2024
7b2d5ed
experimental[patch]: return from HuggingGPT task executor task.run() …
mjschock Apr 25, 2024
2febebd
community[minor]: Implemented Kinetica Document Loader and added note…
am-kinetica Apr 25, 2024
3ce27b3
community[patch]: Add support for pebblo server and client version (#…
dristysrivastava Apr 25, 2024
502a76d
community[patch]: Add initial tests for AzureSearch vector store (#17…
mattgotteiner Apr 25, 2024
147a43c
langchain: support PineconeVectorStore in self query retriever (#20905)
ccurme Apr 25, 2024
474508e
Use lstv2 (#20747)
hinthornw Apr 25, 2024
170888b
FIX
pprados Apr 26, 2024
0d5de1b
Merge branch 'master' into pprados/fix_sql_record_manager
pprados Apr 26, 2024
cad3681
Merge branch 'master' into pprados/fix_sql_record_manager
pprados May 6, 2024
8f2d866
Fix lint
pprados May 6, 2024
cca03bd
Fix lint
pprados May 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions libs/community/langchain_community/indexes/_sql_record_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@
import contextlib
import decimal
import uuid
from typing import Any, AsyncGenerator, Dict, Generator, List, Optional, Sequence, Union
from typing import (
Any,
AsyncGenerator,
Dict,
Generator,
List,
Optional,
Sequence,
Union,
cast,
)

from sqlalchemy import (
URL,
Expand Down Expand Up @@ -175,10 +185,10 @@ def _make_session(self) -> Generator[Session, None, None]:
async def _amake_session(self) -> AsyncGenerator[AsyncSession, None]:
"""Create a session and close it after use."""

if not isinstance(self.session_factory, async_sessionmaker):
if not isinstance(self.engine, AsyncEngine):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't the original code work?

raise AssertionError("This method is not supported for sync engines.")

async with self.session_factory() as session:
async with cast(AsyncSession, self.session_factory()) as session:
yield session

def get_time(self) -> float:
Expand Down
Loading