From c9da341f06c693b87a6fc0b7032044dd5fd0fd67 Mon Sep 17 00:00:00 2001 From: Vineeth Voruganti <13438633+VVoruganti@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:31:02 -0500 Subject: [PATCH] fix(storage) Remove Prepared Statements to make compatible with Supavisor --- docs/getting-started/quickstart.mdx | 14 +++++++------- src/db.py | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/getting-started/quickstart.mdx b/docs/getting-started/quickstart.mdx index 0c72def..5ebe4fb 100644 --- a/docs/getting-started/quickstart.mdx +++ b/docs/getting-started/quickstart.mdx @@ -49,7 +49,7 @@ Next, we want to register an application with the Honcho client: ```python Python -app = client.apps.get_or_create( +app = honcho.apps.get_or_create( name="string", ) ``` @@ -81,11 +81,11 @@ Now let's create a session for that application. Honcho is a user context manage ```python Python -session = client.apps.users.sessions.create(user.id, app.id, location_id=default) +session = honcho.apps.users.sessions.create(user.id, app.id) ``` ```javascript NodeJS -const session = client.apps.users.sessions.create(app.id, user.id, { location_id: "default"}) -> Session +const session = honcho.apps.users.sessions.create(app.id, user.id) -> Session ``` @@ -95,11 +95,11 @@ Let's add a user message and an AI message to that session: ```python Python -client.apps.users.sessions.messages.create(session.id, app.id, user.id, content="Test", is_user=True) +honcho.apps.users.sessions.messages.create(session.id, app.id, user.id, content="Test", is_user=True) ``` ```javascript NodeJS -client.apps.users.sessions.messages.create(app.id, user.id, session.id, { content: "Test", is_user: true }) +honcho.apps.users.sessions.messages.create(app.id, user.id, session.id, { content: "Test", is_user: true }) ``` @@ -109,7 +109,7 @@ You can also easily query Honcho to get the session objects for that user with t ```python Python -async for session in client.apps.users.list(app.id, user.id): +async for session in honcho.apps.users.list(app.id, user.id): doSomethingWith(session) ``` @@ -124,4 +124,4 @@ for await (const session of honcho.apps.users.sessions.list(app.id, user.id)) { This is a super simple overview of how to get up and running with the Honcho SDK. We covered the basic methods for reading and writing from the hosted storage service. Next, we'll cover alternative forms of hosting Honcho. -For a more detailed look at the SDK check out the SDK reference [here](https://api.python.honcho.dev/). \ No newline at end of file +For a more detailed look at the SDK check out the SDK reference [here](/api-reference). diff --git a/src/db.py b/src/db.py index 155b1a1..8c6b005 100644 --- a/src/db.py +++ b/src/db.py @@ -5,11 +5,11 @@ from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine from sqlalchemy.orm import declarative_base -# from sqlalchemy.ext.declarative import declarative_base - load_dotenv() -connect_args = {} +connect_args = { + "prepare_threshold": None, +} # if ( # os.environ["DATABASE_TYPE"] == "sqlite" @@ -19,7 +19,7 @@ engine = create_async_engine( os.environ["CONNECTION_URI"], connect_args=connect_args, - echo=True, + echo=False, pool_pre_ping=True, )