Giter Club home page Giter Club logo

chatlangchainwiki's Introduction

๐Ÿฆœ๏ธ๐Ÿ”—๐Ÿ”— ChatLangChainWiki

This repo is an fork of https://github.com/hwchase17/chat-langchain/. It is an implementation of a locally hosted chatbot specifically focused on question answering over Atlassian Confluence wiki content. The significant change is the inclusion of a new document loader capable of parsing Confluence wiki pages as HTML.

Built with LangChain and FastAPI.

The app leverages LangChain's streaming support and async API to update the page in real time for multiple users.

โœ… Running locally

  1. Install dependencies: pip install -r requirements.txt
  2. Create an OpenAI API key and save the key to a new .env file in the project root folder in the format OPENAI_API_KEY=XXXX.
  3. Manaully export the Confluence wiki pages as HTML to a folder called 'confluence_docs' in the root directory of this project. Note you can bulk export a space.
    1. You can use other Document Loaders to load your own data into the vectorstore.
  4. Run the app: make start
    1. To enable tracing, make sure langchain-server is running locally and pass tracing=True to get_chain in main.py. You can find more documentation here.
  5. Open localhost:9000 in your browser.

๐Ÿš€ Important Links

Refer to https://github.com/hwchase17/langchain/blob/master/README.md for information on deployed versions of the original code base and more documentation.

๐Ÿ“š Technical description

There are two components: ingestion and question-answering.

Ingestion has the following steps:

  1. Manaully pull html from Confluence Wiki site
  2. Load html with LangChain's ReadTheDocs Loader
  3. Split documents with LangChain's TextSplitter
  4. Create a vectorstore of embeddings, using LangChain's vectorstore wrapper (with OpenAI's embeddings and FAISS vectorstore).

Question-Answering has the following steps, all handled by ChatVectorDBChain:

  1. Given the chat history and new user input, determine what a standalone question would be (using GPT-3).
  2. Given that standalone question, look up relevant documents from the vectorstore.
  3. Pass the standalone question and relevant documents to GPT-3 to generate a final answer.

chatlangchainwiki's People

Contributors

hwchase17 avatar agola11 avatar eltociear avatar richardwadsworth avatar sid77x avatar

Stargazers

howie cao avatar Mr Khachaturov avatar  avatar

Watchers

 avatar

chatlangchainwiki's Issues

UTF-8

I have exported confluence space as HTML.

Trying to run ingest.py

D:\DevOps\Repos\ChatLangChainWiki\read_confluence_wiki_docs.py:21: GuessedAtParserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 21 of the file D:\DevOps\Repos\ChatLangChainWiki\read_confluence_wiki_docs.py. To get rid of this warning, pass the additional argument 'features="lxml"' to the BeautifulSoup constructor.

soup = BeautifulSoup(data)
Traceback (most recent call last):
File "D:\DevOps\Repos\ChatLangChainWiki\ingest.py", line 30, in
ingest_docs()
File "D:\DevOps\Repos\ChatLangChainWiki\ingest.py", line 15, in ingest_docs
raw_documents = loader.load()
^^^^^^^^^^^^^
File "D:\DevOps\Repos\ChatLangChainWiki\read_confluence_wiki_docs.py", line 34, in load
text = _clean_data(f.read())
^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1008.0_x64__qbz5n2kfra8p0\Lib\encodings\cp1251.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 1960: character maps to

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.