This project is a chatbot that uses one of the best open-source online LLMs developed by Perplexity AI, Inc. (perplexity.ai) called 'mistral-7b-instruct'
The app uses the HTTP POST restful method of sending and receiving data to and from the API (https://api.perplexity.ai/chat/completions). How that works can be seen in the 'Chatbot' procedure in this app. Header information is sent to the API URL in the 'RequestHeaders' block followed by a messages section in the 'PostText' block that sends a prompt to the API on the web.
The 'ChatbotAPI.GotText' event block receives the reply embedded in a Jason string which is then extracted and displayed on the device screen and optionally spoken using the text-to-speech component.
For fun I added speech input as well, so the app user and chatbot can have a voice conversation (the user must press the record button each time they speak, however, sort of like a walkie-talkie.)
I have included two other LLMs to try, but I find that they are less capable. There are others available for study via the Chat Completions page at: docs.perplexity.ai/reference/post_chat_completions and you can try their online chatbot with Copilot here: perplexity.ai
labs.perplexity.ai provides a chatbot playground to test their LLM models: pplx-7b-online, pplx-70b-online, pplx-7b-chat, pplx-70b-chat, mistral-7b-instruct, codellama-34b-instruct, llama-2-70b-chat, llava-7b-chat, mistral-8x7b-instruct
mistral-7b-instruct used in this app costs $5 per 1000 requests. The web page says the API key for the open-source language models is free with a preplexity PRO account. I have not had to pay anything yet and have a PRO account.
Not displayed in the Designer above is the 'Record Voice' button which swaps positions with the textbox input section when the Speech Input switch is on.
As stated above this app simply sends a text string via an API call to an online server which uses AI to generate an 'intelligent' response. This is not to be confused with a web 'search' as an AI can create original content as demonstrated in this session I had with the mistral-7b-instruct which was designed to be proficient at chat:
Of course, it does information retrieval as well...
Here's the project file. You would need an API key for the app to work:
PerplexityAPI.aia (6.4 KB)
Happy Inventing!