Interactive demo | lm/13-knowledge-base

Intro

Tool to quickly deposit articles and ask questions about all stored articles, powered by large language models.
There are several modes:

"question" mode



You can ask the system any question you'd like. It'll search the knowledge base for relevant
information and use that to answer your question in natural language. Active parameters:



"status" mode



Gets general statistics on the knowledge base. No parameters are active.

"deposit" mode



Here, you can deposit articles into the system. It will take it in, splits up into multiple
sections, indexes and saves them to disk.



So, this isn't really free for the general public to deposit articles into. First and foremost,
it's a tool for myself. If you want a similar system, all the code is available for you to set
it up yourself, check out the source code here.

"lookupWiki" mode



In this mode, you can enter a website url in `content` parameter, like "RS-25 engine", and it will
automatically fire up chrome, look up on google for the term, grab all urls from wikipedia,
and finally index them.



"lookupWebsite" mode



In this mode, you can enter a search term in `content` parameter, like "https://www.nature.com/articles/s41586-020-2528-x",
and it will automatically fire up chrome, go to the website, grab the article then index it.

Run
Server offline
Idle

Parameters

Result

(none yet)

Sample api request

Source code

def endpoint(mode:["question", "status", "deposit", "lookupWiki", "lookupWebsite"]="question", content:serve.text()="What is the panic monster?", category:str="", name:str="",
             model:["gpt-3.5-turbo", "text-davinci-003", "text-curie-001", "text-babbage-001", "text-ada-001"]="gpt-3.5-turbo", password:serve.text(password=True)="") -> serve.html():
    """Tool to quickly deposit articles and ask questions about all stored articles, powered by large language models.
There are several modes:

<h3>"question" mode</h3>

You can ask the system any question you'd like. It'll search the knowledge base for relevant
information and use that to answer your question in natural language. Active parameters:

<ul>
    <li>content: put your question here</li>
    <li>category: if specified, then searches in the specified category only, else searches in all categories</li>
    <li>model: the model that you want answer the question with</li>
</ul>

<h3>"status" mode</h3>

Gets general statistics on the knowledge base. No parameters are active.

<h3>"deposit" mode</h3>

Here, you can deposit articles into the system. It will take it in, splits up into multiple
sections, indexes and saves them to disk.

<ul>
    <li>content: put your article's contents here. Just copy-paste it in</li>
    <li>category: if specified, then dumps the article in a specific category, else dumps it in the default category</li>
    <li>name: if specified, then use this short name to identify the article, else it uses the current unix time</li>
    <li>password: the password necessary to deposit the information into</li>
</ul>

So, this isn't really free for the general public to deposit articles into. First and foremost,
it's a tool for myself. If you want a similar system, all the code is available for you to set
it up yourself, check out the source code <a href="/lm/13-knowledge-base">here</a>.

<h3>"lookupWiki" mode</h3>

In this mode, you can enter a website url in `content` parameter, like "RS-25 engine", and it will
automatically fire up chrome, look up on google for the term, grab all urls from wikipedia,
and finally index them.

<ul>
    <li>content: put your search term here</li>
    <li>password: the password necessary to look the term up</li>
</ul>

<h3>"lookupWebsite" mode</h3>

In this mode, you can enter a search term in `content` parameter, like "https://www.nature.com/articles/s41586-020-2528-x",
and it will automatically fire up chrome, go to the website, grab the article then index it.

<ul>
    <li>content: put your website url here</li>
    <li>password: the password necessary to look the term up</li>
</ul>"""
    try:
        if mode == "question": return question(content, category, model)
        if mode == "status": return status()
        if mode == "deposit": return deposit(content, category, name, password)
        if mode == "lookupWiki": return lookupWiki(content, password)
        if mode == "lookupWebsite": return lookupWebsite(content, password)
    except Exception as e:
        with k1.captureStdout(False) as out: traceback.print_exc()
        out = out() | join('\n')
        return f"<pre style='color: red'>{out}</pre>"