Skip to content

[LangChain] Add example programs and notebooks #85

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 7 commits into from
Oct 30, 2023
Merged

Conversation

amotl
Copy link
Member

@amotl amotl commented Sep 17, 2023

About

We have been looking into making LangChain work together with CrateDB. This patch adds corresponding example programs and Jupyter Notebooks.

Preview

Readme, rendered by GitHub: LangChain and CrateDB

Backlog

  • Demonstrate how to use the exercises with CrateDB Cloud,
    both the basic example programs, and the Jupyter Notebooks.

/cc @marijaselakovic, @hammerhead, @seut, @ckurze

"from pprint import pprint\n",
"\n",
"CONNECTION_STRING = \"crate://crate@localhost/?schema=notebook\"\n",
"\n",
Copy link
Contributor

@ckurze ckurze Oct 16, 2023

Choose a reason for hiding this comment

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

Do we need the schema in the connection string? For me, it causes a failure on the SELECT statement below, because mlb_teams_2012? is apparently created in the doc` schema.

Copy link
Member Author

@amotl amotl Oct 27, 2023

Choose a reason for hiding this comment

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

6779392 should fix that flaw. I would like to use it, in order to educate people about it.


### CrateDB Cloud

Todo.
Copy link
Contributor

@ckurze ckurze Oct 17, 2023

Choose a reason for hiding this comment

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

Suggested change
Todo.
Sign up or log in to [CrateDB Cloud](https://console.cratedb.cloud) and create a free tier cluster. Within just a few minutes, you will have a cloud-based development environment. As soon as your project scales, you can easily move to a different cluster tier or scale horizontally.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks.

@ckurze ckurze force-pushed the amo/framework-langchain branch 2 times, most recently from cc2943c to 1965489 Compare October 18, 2023 12:22
@amotl amotl force-pushed the amo/framework-langchain branch 7 times, most recently from 8fd2d10 to dbf3dab Compare October 27, 2023 19:22
@amotl amotl requested a review from ckurze October 27, 2023 19:35
@amotl
Copy link
Member Author

amotl commented Oct 27, 2023

Within the README, there are now badges to open the Jupyter Notebooks on GitHub, on Binder, and on Google Colab. See LangChain and CrateDB » What's inside.

Comment on lines +395 to +437
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Overwriting a vector store\n",
"\n",
"If you have an existing collection, you can overwrite it by using `from_documents`,\n",
"aad setting `pre_delete_collection = True`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"db = CrateDBVectorSearch.from_documents(\n",
" documents=docs,\n",
" embedding=embeddings,\n",
" collection_name=COLLECTION_NAME,\n",
" connection_string=CONNECTION_STRING,\n",
" pre_delete_collection=True,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"docs_with_score = db.similarity_search_with_score(\"foo\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"docs_with_score[0]"
]
},
Copy link
Member Author

Choose a reason for hiding this comment

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

I am observing problems here. It is probably related to the other report by @ckurze.

Copy link
Member Author

Choose a reason for hiding this comment

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

Adding software tests will help to keep our sanity.

@amotl amotl force-pushed the amo/framework-langchain branch from 7cf13da to cd92557 Compare October 29, 2023 11:41
@amotl amotl changed the base branch from main to amo/python-sqlalchemy October 29, 2023 11:44
@amotl amotl changed the base branch from amo/python-sqlalchemy to amo/ngr-everywhere October 29, 2023 11:44
@amotl amotl changed the title LangChain: Add example programs and notebooks [LangChain] Add example programs and notebooks Oct 29, 2023
@amotl amotl force-pushed the amo/ngr-everywhere branch from f43c9f5 to f5546bf Compare October 30, 2023 15:48
Base automatically changed from amo/ngr-everywhere to main October 30, 2023 15:54
@amotl amotl force-pushed the amo/framework-langchain branch from cd92557 to cd9b202 Compare October 30, 2023 15:55
@amotl amotl merged commit 87f3b78 into main Oct 30, 2023
@amotl amotl deleted the amo/framework-langchain branch October 30, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants