Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.

Commit 666c7c2

Browse files
Update streamlit.md
1 parent fc9d3bf commit 666c7c2

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

docs/integrations/streamlit.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,58 +7,58 @@ Streamlit is an open-source Python library that makes it easy to create and shar
77

88
<img src="https://img.shields.io/github/stars/streamlit/streamlit.svg?style=social&label=Star&maxAge=2400"/>
99

10-
[Apache 2.0 License](https://github.com/langchain-ai/langchain/blob/master/LICENSE) &nbsp;&bull;&nbsp;[Site](https://streamlit.io/)
10+
[Apache 2.0 License](https://github.com/streamlit/streamlit/blob/develop/LICENSE) &nbsp;&bull;&nbsp;[Site](https://streamlit.io/)
1111

1212
| Languages | Docs | Github | <br>
1313
|Python | [Docs](https://docs.streamlit.io/) | [Code](https://github.com/streamlit/streamlit)
1414

1515
### Install
1616

17+
Install Streamlit:
1718
`pip install streamlit`
1819

20+
Install the streamlit-chromadb-connection, which makes it easy to connect your Streamlit app to Chroma DB with [`st.connection`](https://docs.streamlit.io/1.11.0/library/api-reference/connections/st.connection)"
21+
`pip install streamlit-chromadb-connection`
22+
1923
### Main Benefits
2024

21-
- Common Patterns for chain-of-thought and prompt templating
22-
- Many integrations and data loaders
23-
- Deep integration to LangSmith monitoring (developed by the same team)
25+
- Easy to get started with Streamlit's straightforward syntax
26+
- Built-in [chatbot functionality](https://docs.streamlit.io/library/api-reference/chat)
27+
- Pre-built integration with Chroma via `streamlit-chromadb-connection`
28+
- Deploy apps for free on [Streamlit Community Cloud](https://share.streamlit.io/)
2429

2530
### Simple Example
2631

2732
#### Python
2833

2934
```python
30-
import chromadb
31-
from langchain.vectorstores import Chroma
32-
from langchain.embeddings.sentence_transformer import SentenceTransformerEmbeddings
33-
34-
# Chroma code
35-
persistent_client = chromadb.PersistentClient()
36-
collection = persistent_client.get_or_create_collection("collection_name")
37-
collection.add(ids=["1", "2", "3"], documents=["a", "b", "c"])
38-
39-
# LangChain Code
40-
embedding_function = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
35+
import streamlit as st
36+
from streamlit_chromadb_connection.chromadb_connection import ChromadbConnection
4137

42-
langchain_chroma = Chroma(
43-
client=persistent_client,
44-
collection_name="collection_name",
45-
embedding_function=embedding_function,
46-
)
47-
# Important! - the embedding functiion passed to langchain is their wrapper, not Chroma's
38+
configuration = {
39+
"client": "PersistentClient",
40+
"path": "/tmp/.chroma"
41+
}
4842

43+
collection_name = "documents_collection"
4944

50-
print("There are", langchain_chroma._collection.count(), "in the collection")
45+
conn = st.connection("chromadb",
46+
type=ChromaDBConnection,
47+
**configuration)
48+
documents_collection_df = conn.get_collection_data(collection_name)
49+
st.dataframe(documents_collection_df)
5150
```
5251

5352
### Resources
5453

55-
- [LangChain + Chroma Announcement Post](https://blog.langchain.dev/langchain-chroma/) on the LangChain blog
56-
- [LangChain's Chroma Documentation](https://python.langchain.com/en/latest/modules/indexes/vectorstores.html?highlight=chroma#langchain.vectorstores.Chroma)
54+
- [Guide to using vector databases with Streamlit](https://pub.towardsai.net/vector-databases-for-your-streamlit-ai-apps-56cd0af7bbba)
55+
- [Streamlit's `st.connection` documentation](https://docs.streamlit.io/library/api-reference/connections/st.connection)
56+
- [Demo app for `streamlit-chromadb-connection`](https://app-chromadbconnection-mfzxl3nzozmaxh3mrkd6zm.streamlit.app/)
5757

5858
#### Tutorials
5959

60-
- [Chroma and LangChain tutorial](https://github.com/grumpyp/chroma-langchain-tutorial) - The demo showcases how to pull data from the English Wikipedia using their API. The project also demonstrates how to vectorize data in chunks and get embeddings using OpenAI embeddings model.
61-
- [Create a Voice-based ChatGPT Clone That Can Search on the Internet and local files](https://betterprogramming.pub/how-to-create-a-voice-based-chatgpt-clone-that-can-search-on-the-internet-24d7f570ea8)
62-
- [Harrison's `chroma-langchain` demo repo](https://github.com/hwchase17/chroma-langchain)
63-
- [question answering over documents](https://github.com/hwchase17/chroma-langchain/blob/master/qa.ipynb) - ([Replit version](https://replit.com/@swyx/LangChainChromaStarter#main.py))
64-
- [to use Chroma as a persistent database](https://github.com/hwchase17/chroma-langchain/blob/master/persistent-qa.ipynb)
60+
- [Build an "Ask the Doc" app using Chroma, Streamlit, and LangChain](https://blog.streamlit.io/langchain-tutorial-4-build-an-ask-the-doc-app/)
61+
- [Summarize documents with Chroma, Streamlit, and LangChain](https://alphasec.io/summarize-documents-with-langchain-and-chroma/)(https://alphasec.io/summarize-documents-with-langchain-and-chroma/)
62+
- [Build a custom chatbot with Chroma, Streamlit, and LangChain](https://blog.streamlit.io/how-in-app-feedback-can-increase-your-chatbots-performance/)
63+
- [Build a RAG bot using Chroma, Streamlit, and LangChain](https://levelup.gitconnected.com/building-a-generative-ai-app-with-streamlit-and-openai-95ec31fe8efd)
64+
- [Build a PDF QA chatbot with Chroma, Streamlit, and OpenAI](https://www.confident-ai.com/blog/how-to-build-a-pdf-qa-chatbot-using-openai-and-chromadb)https://www.confident-ai.com/blog/how-to-build-a-pdf-qa-chatbot-using-openai-and-chromadb

0 commit comments

Comments
 (0)