Things to think about
Although the above example works fine. When you start using it, you will notice that ChatGPT only reacts to the question you ask, but forgets about all your previous questions.
So in our case, What can you tell me about the MediaWiki API, provides a nice extensive answer. If I would then ask something like: Can you explain each keyword in more detail? I would get an answer like :
Certainly! Here are some explanations for various keywords:
1. Keyword: A word or phrase used in a search query to find relevant information or content. Keywords help search engines understand the intent of the user and provide the most appropriate results.
So our extension should, with every question we ask, provide the chat history as context for ChatGPT to be more helpful. Luckily for us, the Open AI api provides ways of adding the context easily.
We might also store chats in cookies so on a later time or day a user can continue where he left off.
As mentioned in the intro of the article, we could also first do a WikiSearch, on the question from the user, and feed relevant pages found in your wiki to the assistant and tell it to use them to formulate a more correct answer if possible.
Let's add some more functionality
I've talked about use cases like asking for a page summary or relevant keywords for a page. Let's add that to our chat extension.
Using the HTML5 Dialog element, I setup a simple form in a pop-up to ask what the user wants to do with the content off the current page as a whole. They get two checkboxes. One for requesting relevant keywords for the current page and one checkbox requesting a summary.
It is important to add the question and the AI's repsonse inside our chatbox. This way we can continue to ask questions about e.g. the keywords as it will be send to the AI as context again.
Using the MediaWiki Extension Widgets I add the HTML5 dialog just above our AI Chat area. With JavaScript we then check what choice the user made and use our previous JavaScript to send the request. Our API extension gets another argument where a PageTitle can be added so we can get the source of the page. When sending it to open AI, we also tell the assistant that the format of the page is Wikitext, but it should answer in normal text.
Feeding an AI service like Microsoft Copilot
One of the use cases I mentioned was the use of (Microsoft) Copilot. If you are familier with the MS SharePoint back-end and Copilot, you know that Copilot can be very powerful. It is able to link information together from various sources like Outlook and OneDrive. By linking together I mean something like: asking Copilot what your colleagues are working on. Copilot knows who your direct colleagues are through e.g. recent emails; department and job descriptions; etc.. and formulate an answer that can be related to the people you most interact with. Also don't forget that Microsoft Search is also able to search all these sources of information.
Now imagine giving Copilot (and MS Search) all relevant information from your wiki. Even include things like: who created/edited what page; what pages have the most page views; etc.. That can be a very powerfull tool. Not only can you search from MS Search into the content of your wiki, but you could ask Copilot to give you the 10 most recent created pages from the wiki. Or ask if the wiki has more information about a document that is in your OneDrive? You can see the possibilities here!
That is another interesting way of getting started with AI!
|