repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | --- |
| #2 | title: '🗨️ Discourse' |
| #3 | --- |
| #4 | |
| #5 | You can now easily load data from your community built with [Discourse](https://discourse.org/). |
| #6 | |
| #7 | ## Example |
| #8 | |
| #9 | 1. Setup the Discourse Loader with your community url. |
| #10 | ```Python |
| #11 | from embedchain.loaders.discourse import DiscourseLoader |
| #12 | |
| #13 | dicourse_loader = DiscourseLoader(config={"domain": "https://community.openai.com"}) |
| #14 | ``` |
| #15 | |
| #16 | 2. Once you setup the loader, you can create an app and load data using the above discourse loader |
| #17 | ```Python |
| #18 | import os |
| #19 | from embedchain.pipeline import Pipeline as App |
| #20 | |
| #21 | os.environ["OPENAI_API_KEY"] = "sk-xxx" |
| #22 | |
| #23 | app = App() |
| #24 | |
| #25 | app.add("openai after:2023-10-1", data_type="discourse", loader=dicourse_loader) |
| #26 | |
| #27 | question = "Where can I find the OpenAI API status page?" |
| #28 | app.query(question) |
| #29 | # Answer: You can find the OpenAI API status page at https:/status.openai.com/. |
| #30 | ``` |
| #31 | |
| #32 | NOTE: The `add` function of the app will accept any executable search query to load data. Refer [Discourse API Docs](https://docs.discourse.org/#tag/Search) to learn more about search queries. |
| #33 | |
| #34 | 3. We automatically create a chunker to chunk your discourse data, however if you wish to provide your own chunker class. Here is how you can do that: |
| #35 | ```Python |
| #36 | |
| #37 | from embedchain.chunkers.discourse import DiscourseChunker |
| #38 | from embedchain.config.add_config import ChunkerConfig |
| #39 | |
| #40 | discourse_chunker_config = ChunkerConfig(chunk_size=1000, chunk_overlap=0, length_function=len) |
| #41 | discourse_chunker = DiscourseChunker(config=discourse_chunker_config) |
| #42 | |
| #43 | app.add("openai", data_type='discourse', loader=dicourse_loader, chunker=discourse_chunker) |
| #44 | ``` |