Chatbots Over Your Own Documents

The good, the bad, and the options

Hey there, teammate! Welcome to the next edition of the most practical newsletter on AI in the world!

Each week, I'm cutting through the noise surrounding AI to serve you practical insights that not only help transform your business but also empower you, the business leader, to evolve into a data-driven, AI-enabled visionary.

The AI noise is constant and loud, and you are here for a quiet meal of AI goodness, so let’s get right to it! Bon Appetit!

Today’s Menu:

Chatbots Over Your Own Documents

Action Item - Find The Right Way to Chat With Your Documents

Learning Cube - Fine-tuning vs LLM vs Grounding

Tool Spotlight - Chatbase.co

Cool Factor - DreamStudio by stability.ai

July 31, 2023

I’ve been creating AI co-pilots for different roles in businesses, and the idea of chatting with your documents continues to be the most important piece I build.

We do have sets of documents, don’t we? SOPs, onboarding documents, favorite (dare I say “sacred”?) spreadsheets, and FAQs strewn all over various file systems.

As you grow, you are asked more and more about the content in those docs. Customers might ask what your pricing is (daily). Vendors might ask for your payment terms or what your inventory is looking like. And you yourself might be wanting to look at your receivables without having to look at ALL of your receivables for that one piece of info you need.

Add up the time you spend answering questions or looking things up, and you begin to see just how much time you and your staff can save each week, and remain seriously productive as a consequence!

Remember that 15 min/day = 65 hours a year back in your pocket!

Now, with some of the AI tools out there, you can add your documents to their systems and use a chatbot on them!

Tools like chatbase.co (see the Tool Spotlight below for more info) also give you code to take the chatbot and install it on your website!

These tools are easy to set up, easy to use, and can provide real power to you.

You can upload documents into sets, or just go deep on that big pdf you’ve been meaning to read. “Give me an executive summary and 5 top points from that document”. Done.

As always, just dive in and figure out how to work these things.

Do not go all in on it if you only get a handful of people on your site each month. Or if they don’t ask you questions that often. That sort of effort will be WASTED and take away your precious time from getting more customers, fulfilling their work faster, or improving your bottom line.

Today’s Action Item and Tools sections should help you add this sort of power to YOUR day!

Want to feature your service or product in the world’s most practical AI newsletter? Email me at [email protected] for more information.

Action Item

Find the Right Way to Chat With Your Documents

Like anything we are doing in AI these days, there are 1000 different ways to get a job done. Getting information out of your documents is one of those jobs.

Chatting with your documents is a GREAT idea, as it goes beyond searching for particular text and can search by what you mean.

A chatbot can then search different types and styles of documents, all at the same time, and come back with results in a matter of seconds. Try searching all your Google Docs, Sheets, SOPs and emails today for all of your onboarding steps. Haha!

Tools like claude.ai allow you to upload a document at a time, and ask questions about it:

This is great if you want to see what is in a document without having to open it and read it and then write up a summary. It goes beyond that, but you get the idea: basically a one-off document search.

Think of those old training docs, or maybe the pdf your old boss sent you to review to see about working together. Drop it in, ask for a summary, voila.

So you can upload a bunch of docs and use various tools and chatbots over them…that covers most of the use cases! But what else can you do here?

Put on your “I Like Geeking Out” hat on and read on.

Embed Your Docs

The downside of uploading docs is that you only get short-term use of the searching (you upload things one-off and look through it only during that session…so it is AI on an as needed basis). Or you get particular sets of documents that you’ve uploaded, and they are only for you. Sharing those sets depends on the tool you are using. It can get expensive when you start AI-enabling a whole team on documents.

The alternative is to embed the documents into a vector database. (See previous newsletters for more info on these.) When embedding documents, you are basically getting a universal index on them, and storing it into a database for everyone to use.

They give you a way to search by meaning and not just keywords.

While more powerful, it is also more complicated and you need to work with some programming to get it to work in most tools. It is easy enough if you have any sort of python or other programming skills, but otherwise would not be something to tackle without outside help.

Databases like Weaviate, ChromaDB and Pinecone are used for things like this. SingleStore is a really powerful version of this. If you are just getting started and want to go the “stored vectors” route, then look at ChromaDB. It is a local database that you can open up to others on your team, it is free and open-source, and can work with embeddings made with the OpenAI API.

Embedding a document into a vector database is easy and powerful. It will give you apples-to-apples comparison between data strewn all over.

Build an LLM

Doing this goes beyond the scope of “practical AI” and this newsletter. However, it is a viable alternative if you want to use a chatbot over your documents!

Some companies are building their own language models, or LLMs, that force you to work within only their specified scope of language and documents.

The LLM is the language model trained up on language. GPT-3.5-turbo and GPT-4 are both models, Large Language Models (LLM). They have been trained by hundreds of thousands of English-language documents, code samples, books and other texts.

LLMs are “trained” by reading in all that language and finding patterns, how things complete, etc. If I say to you, “Greg just hit a home…” then you immediately think “…run.” (If you are from North America, at least 😄)

Another option could be “…with his car.” Or “…inspector with an orange.” So the words “run”, “with” and “inspector” would work, but “run” is by far the more obvious next word. We know this because of how much it has been used over our lifetimes. WE have been trained like the LLM is, and we know that a home run is much more common than hitting a home inspector with an orange.

So to really know your documents, you could train up an LLM so it uses your language, your idioms, your acronyms, your slogans, your voice.

Building an LLM is expensive and big and not usually the way to go.

That being said, Hugging Face has over 250,000 models you can look at fine-tuning with your stuff.

Fine-tune an LLM

Fine-tuning means you take an existing LLM and add in your customized parts, thus fine-tuning its language to speak like yours. This is an emerging technology and has had very mixed results.

Consider having someone who knows car parts fine-tuning your language model about soccer. They don’t blend well so your results won’t either.

To be really effective, the base LLM has to have a solid grasp on the topics and language near your topic, or be a really solid general LLM. Then you add in your pieces and hope for solid overlap so answers are a nice blend of what it knew before you, plus your stuff.

Next Steps

For now, get a few documents and take them to claude.io, ChatGPT+ and its Code Interpreter (where you can upload a doc and chat with it), or use chatbase.co. Give them all a shot! Find something that resonates with you and start coming up with ideas on how you can work with your documents using AI. Go for it!

I am building custom AI Copilots to help business leaders organize and search their documents, create solid emails and documents in their voice, and help integrate all of their software. 

If you would like to be part of this beta community I am starting up, click below to let me know and find out more information!

Learning Cube

Fine-tuning vs LLM vs Grounding

LLMs, or large language models, are computer programs like GPT-3 that can understand and generate human language. It is the engine under products like ChatGPT.

Fine-tuning an LLM like GPT-3 means taking an already created LLM and training it more on new data to make it better at specific tasks. For example, you could fine-tune GPT-3 to be really good at writing emails by having it read and learn from lots of example emails. Results of fine-tuning are mixed, so many people have turned to creating their own LLMs instead. This leads to many more LLMs in the public domain that we can use and fine-tune better!

Creating a new LLM from scratch means building and training an entirely new language model, not starting with an existing one. Big tech companies like Google and Microsoft create new proprietary LLMs that only they own. Creating a useful new LLM requires massive amounts of data, computing power, time, and expertise. Companies also need to create enough of their own language interaction model to properly utilize the LLM.

Hugging Face has a library of hundreds of thousands of publicly available LLMs that anyone can use for free. These models tend to have targeted use cases so the results in those use cases are better than GPT-4 but results outside of those use cases are far worse. Targeted LLMs are an emerging idea.

Grounding an LLM means connecting it with real world knowledge to make it understand concepts better. For example, you could link words like "apple" and "banana" to pictures of real apples and bananas. This grounding helps the LLM understand that apples and bananas are different fruits. Another example is a company creating a vector database of all their standard operating procedures (SOPs) to give the LLM more context during searches.

Grounding a solid, general use LLM like GPT-4 is a solid idea that is gaining traction. You get the searching of your targeted data, which is then used as part of your prompt in GPT-3.5-turbo or 4. These prompts tend to be much larger, so GPT-4 or a large-prompt GPT-3.5-turbo-16k tend to work best for this. Again, this is an emerging idea.

I am building custom AI Copilots to help business leaders organize and search their documents, create solid emails and documents in their voice, and help integrate all of their software. 

If you would like to be part of this beta community I am starting up, click below to let me know and find out more information!

Tool Spotlight

Chatbase.co

This tool is one of the most practical, yet powerful, AI tools I have tried out.

Chatbase’s idea is to give you a chatbot over your documents, your website, your data sources, whatever! And then provide you with the code to embed the chatbot as a widget on any page of your site!

It uses GPT-3.5-turbo or GPT-4 under the covers, so you need to have an OpenAI API key to use it.

(The following screenshots were taken from their site’s demo, at https://www.chatbase.co/#demo)

Data Sources

First, you choose which data source you want for your chatbot. As you can see below, you can upload files, paste in your own text, point chatbase to a website, or fill it with Q&A (great for support bots on your website!).

In their demo, they showed how it goes through a site, grabs every page, and pulls out the content for the chatbot to use. Pretty amazing stuff!

Settings

Then you give your chatbot some of the common settings needed by GPT to be able to come back with proper results. Remember that a good chatbot is conversational, taking the results and wrapping conversation around them.

You can change chatbot style, colors, and all the usual things you can think of as well.

Put It On Your Site

When you are done filling it and styling it, it is time to try it out! Their interface is easy to test and make sure it acts the way you want.

Once you are ready, you can then tell chatbase that you are ready to deploy it to your own website, and chatbase will give you the code to do that!

You literally cut and paste the code into your site. The highlighted code above will actually display your chatbot as a chat bubble on the bottom-right of your web page. So instead of taking up the whole page it pops up like this:

Cool!

Try it out and let me know what you think? Can you picture using a chatbot over your documents?

Cool Factor

DreamStudio by stability.ai

This week’s cool factor is a newer tool called “DreamStudio”, created by stability.ai, the folks that created Stable Diffusion which is one of the leading libraries for AI image generation.

Simple Image Generation Interface

I am a stick-figure guy, so anything fun and easy in the visuals is amazing to me. But this is super impressive even to those that work Photoshop.

DreamStudio is used much like other image generation AI tools, but it is way more intuitive to me and the results are best in class. Midjourney is awesome, too, but I’d much prefer this interface than being forced into Discord.

You choose your style, give it a prompt (or a negatiave prompt), or even upload an image to use as a basis for generating some images!

Upload An Image…Check This Out!

Gave DreamStudio this one…

… and it created these from it!

I gave it a prompt to be “waiters in a fancy Parisian restaurant serving royalty”, and told it to use my photo at 65% strength for the 4 waiters, and 33% strength for the 2 waiters.

The 4 waiters are pretty similar to me, though I am far more handsome than those models. And it kept the basic head shape and amount of my daughter shown, but replaced it pretty well with other characters.

The 2 waiters were given more leeway to be created, with only a 33% strength of my original pic. Notice the different shirts, the different wall hangings over his right shoulder, etc. A lamp was even added to one shot, and an ornate wall was added to the other.

Powerful Editing

The pics could each be edited, adding or removing elements to the pic. You can generate with text on the image. Lots more.

And the photorealism is really something, generated so easily!

This really is cool stuff to check out at https://dreamstudio.ai/

Feature your service/product in the world’s most practical AI newsletter

Practical AI is the world’s most practical AI newsletter with subscribers from many different industries and countries, all looking to make use of tools and services to bring AI into their businesses. You can book your ad spot by emailing me at [email protected]

In Closing…

What did you think of this week’s newsletter?

Your feedback helps me create better content for you!

Just reply back to this, or email me directly at [email protected], and let me know what you think:

  • 5 Stars - Loved It!

  • 3 Stars - Meh…not bad

  • 1 Star - This sucks

If you want to sign up for this newsletter or share it with a friend, you can find us right here

Thanks for reading. Let me know if you applied anything from this newsletter!

See you next week!

Greg