Context generation for chat based Q&A bot

An embeddings vector database allows you to inject text into the AI’s input as a message before the user’s, so that, based on what is similar to the user input (and similar to recent conversation context if you use several user chat questions), the AI already has new knowledge in order to answer.

A function however, requires the AI to have some idea when to call that function in order to better answer a question. Since it doesn’t have preliminary knowledge of your data structure or resources, an appropriate query upon your knowledge may be harder.


Imagine a function like search_company_problem_solutions_database (or a smaller name that is similarly described).

The AI may call that function the same way it might call a search engine, writing its own rephrasing of the user’s question, if you have a query parameter. Or you could have an additional enum that allows selecting 10 categories of knowledge, or more.

The function’s API can also be implemented by your embeddings vector database. Since the AI is writing the query of a function, it can turn “compare to call functions” into a question “When is an API function call better for informing an AI of proprietary information, in comparison to embeddings-based augmentation.”

then consider the effects of another function list_company_problem_solutions_categories or get_company_document_list - other things AI might call iteratively to narrow down on the right final function query it should write.