Coder Social home page Coder Social logo

Comments (2)

ashpreetbedi avatar ashpreetbedi commented on June 28, 2024

I completely agree @mathieuchateau

A current fix would be to load the Documents manually instead of using the KnowledgeBase, something like:

reader = PDFReader()
pdf_documents: List[Document] = reader.read(uploaded_file)
for doc in pdf_documents:
    doc.content = clean_content(doc.content)

assistant.knowledge_base.load_documents(pdf_documents, upsert=True)

You could also do it with a Website reader:

scraper = WebsiteReader(max_links=2, max_depth=1)
web_documents: List[Document] = scraper.read(input_url)
for doc in web_documents:
    doc.content = clean_content(doc.content)

assistant.knowledge_base.load_documents(web_documents, upsert=True)

Example code

A long term approach would be to expose this as a parameter in the KnowledgeBase object, that accepts a "pre_process()" function, which runs on the content to clean it.

What do you think?

from phidata.

mathieuchateau avatar mathieuchateau commented on June 28, 2024

from phidata.

Related Issues (20)

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.