If you click an affiliate link and subsequently make a purchase, I will earn a small commission at no additional cost (you pay nothing extra). This is important for promoting tools I like and supporting my blogging.
I thoroughly check the affiliated products' functionality and use them myself to ensure high-quality content for my readers. Thank you very much for motivating me to write.
Introduction
AI chatbots like ChatGPT have revolutionized how we interact with technology, opening new possibilities in customer support, research, learning, content creation, marketing, creativity, and entertainment. They can produce human-like text, generate various formats, and converse on diverse topics.
While ChatGPT is a leading option, other alternatives have unique benefits and strengths. This post will explore ChatGPT and its options, including their capabilities, applications, and ethical considerations. We will challenge chatGPT and a few similar bots with easy tasks to see how they perform.
Large language models
AI chatbots are generally created using Large Language Models (LLMs), trained using vast amounts of textual data, such as books, articles, code, and other text types. LLMs learn the patterns and nuances of human language to generate realistic and coherent text formats. LLMs can be used for text generation, language translation, creative content writing, and providing informative answers to your queries.
Usage examples
Here are some examples of how language models (LLMs) are being used today:
- Google Search understands and responds to your search queries.
- Google Assistant answers your questions, sets reminders, and controls your smart home devices.
- chatGPT writes various types of creative content, such as poems, code, scripts, and emails.
- Midjourney generates images from text descriptions using a diffusion model.
Key characteristics
Following are the key five characteristics of large language models (LLMs) like ChatGPT:
-
LLMs use complex deep learning architectures with multiple interconnected neural networks to learn complex relationships between words and phrases, enabling them to generate more informative responses.
-
LLMs can understand the context of text and generate relevant and meaningful responses.
-
LLMs continuously learn and improve through exposure to more data and feedback, becoming more accurate, reliable, and creative.
-
LLMs may generate biased or inaccurate text due to trained data containing biases or misinformation. This is called “AI hallucination”. Be cautious when using LLMs and be aware of this potential. These tools are under development and sometimes need to be corrected.
Building LLMs
Large Language Models (LLMs) are created using Natural Language Processing (NLP) techniques. NLP is a subfield of artificial intelligence (AI) that focuses on the interaction between computers and human language. LLMs, such as GPT (Generative Pre-trained Transformer) models like GPT-3, are sophisticated neural network architectures that have been trained on vast amounts of text data using NLP methods.
The training process typically involves feeding the model with large datasets containing diverse language patterns and structures. During training, the model learns to understand the intricacies of language, including grammar, semantics, context, and even some aspects of reasoning. The goal is to enable the model to generate coherent and contextually relevant responses when given a prompt or input.
In my previous post TensorFlow: Romancing with TensorFlow and NLP, I explained how to generate poetry using Python and TensorFlow with useful NLP techniques. This is similar to the creation of LLMs, but on a smaller scale.
Recently, the transformer architecture, which is a key component of LLMs like GPT, has proven to be particularly effective in capturing long-range dependencies in language, making it well-suited for various NLP tasks. These models can be fine-tuned for specific applications, such as text completion, translation, summarization, question answering, and more, making them versatile tools in natural language understanding and generation.
The most famous chatbot
Is chatGPT free to use?
ChatGPT is created by OpenAI providing a free advanced chatbot that uses GPT-3.5 language model. There are also paid versions (Plus plan for USD 20/month) with GPT-4 and more models, additional tools like DALL·E, Browsing, Advanced Data Analysis and even creating your own GPT models.
Benefits and limitations
Here are some of the benefits of using ChatGPT :
- It is easy to use: ChatGPT is a simple and intuitive tool that anyone with a basic understanding of computers can use.
- It is reasonably accurate: ChatGPT is trained on a massive text and code dataset, allowing it to generate accurate and reliable results.
- It is creative and innovative: ChatGPT can generate creative text formats, like poems, code, scripts, musical pieces, emails, letters, etc.
Here are some of the limitations of using ChatGPT :
- It can be biased: ChatGPT is trained on a dataset of text and code created by humans, which means that it can reflect the biases of its creators.
- It can be misleading: ChatGPT can be used to generate misleading information, so it is essential to be critical of the information that it generates.
GPT store
OpenAI has recently introduced the GPT Store, a platform designed for purchasing and selling custom chatbots that the GPT-3 language model powers. The store has a range of chatbots for various purposes, such as customer service, sales, and marketing.
I have experimented with various publicly available GPTs and even developed my own. Setting it up was a breeze, but it required a paid subscription.
Essentially, you have to specify the bot’s abilities, choose or upload an avatar, and then it can be made either publicly available on the GPT Store or kept private.
chatGPT’s Friends
ChatGPT and its alternatives are advancing quickly. They’ll perform complex tasks and generate more human-like text as they become more sophisticated.
Here are few ChatGPT alternatives:
- Google’s Gemini (previously Bard) is a language model chatbot for conversations, questions, and creative text.
- ChatSonic by ChatSonic is a specialised chatbot for creative writing and content generation, including poems, code, scripts, and musical pieces.
- Microsoft Copilot is a chatbot integrated with Microsoft Bing search. It answers questions, provides information, and completes tasks.
- HuggingChat is a chatbot platform that uses Hugging Face’s language models. Developers can create chatbots for various purposes.
- Pi by Insperity is a personal AI chatbot that helps manage schedules, set reminders, and provide information.
Here are some of the benefits of using ChatGPT and similar bots:
- Chatbots are available to anyone with an internet connection.
- They are used for a variety of purposes.
- Chatbots constantly learn and improve.
- Most of them are free to use.
Here are some of the limitations of using these bots:
- GPT technology is yet under development, and it can sometimes make mistakes
- Chatbot output can be biased, depending on the data it is trained on.
- GPT bots should not be used to make important decisions.
Besides these chatbots, there are more AI tools that I have not tested in this post; however, they have to be mentioned:
- CodeWhisperer by Amazon is a chatbot that helps developers write code by providing suggestions and code snippets and answering programming language-related questions.
- GitHub Copilot is an AI-powered code completion tool by GitHub.
- Surfer AI is a content optimisation tool that uses language models to help writers create search engine-friendly content.
- SEMrush Writing Assistant is a content optimisation tool that uses language models to help writers create high-quality content for search engines.”
We will go more indepth testing CodeWhisperer and GitHub pilot in the future, and also the content optimisation tools, you can also try them yourself, and let me know your ideas.
Now, let’s explore the incredible GPT chatbots, that can do many tasks, from story-telling to coding assistance, and see how they work.
Bots challenge
I am going to give all chatbots four simple tasks (giving them the same prompts):
- LIST: List their features
- prompt: Create a bullet list of your most essential ten features in no more than 300 words.
- CODE: Code a HashMap class in Python
- prompt: Code a HashMap class in Python with get, put, remove, next and contain methods.
- JOKES: Write ten short programming jokes
- prompt: Write ten programming jokes that are intelligent and funny, at most 15 words each.
- STORY: Write a short children’s story
- prompt: Write a children’s story about why it is essential to know mathematics in no more than 200 words.
Notice that I have used the word limits for text-generating prompts. However, I will not count words for the LIST test since I show the screenshots to present the web interface of chatbots instead. I check the word limit only for JOKES and STORY tests.
Once I am satisfied with the chatbot’s performance, I will give a maximum of five stars. Let’s see if that happens!
chatGPT
We will start with chatGPT now.
chatGPT Pro version costs $20/month and enables GPT-4, which is the most advanced model that can be used to create and access to tools like DALL·E, Browsing, and data analysis. There is also a Team version that is similar to Pro version and enables collaboration. For more information see Upgrade your plan.
We will test the openly available on Web GPT3.5 model with unlimited messages and history storage. This model will suffice for out tests.
LIST (chatGPT)
Create a bullet list of your most essential ten features in no more than 300 words.
Please notice that the first point is "Natural Language Understanding", uttering that chatGPT focuses on understanding human language.
The list was well formatted; however, I would love to see more information, such as links to a source or related web address.
CODE (chatGPT)
The next task will be to create a HashMap class in Python with get, put, remove, next and contain methods.
Code a HashMap class in Python with get, put, remove, next and contain methods
Certainly! Below is a simple implementation of a basic HashMap class in Python with get, put, remove, next, and contains methods:
class HashMap:
def __init__(self, capacity=16):
self.capacity = capacity
self.buckets = [None] * self.capacity
def _hash(self, key):
return hash(key) % self.capacity
def put(self, key, value):
index = self._hash(key)
if not self.buckets[index]:
self.buckets[index] = []
for i, (k, v) in enumerate(self.buckets[index]):
if k == key:
self.buckets[index][i] = (key, value)
return
self.buckets[index].append((key, value))
def get(self, key):
index = self._hash(key)
if self.buckets[index]:
for k, v in self.buckets[index]:
if k == key:
return v
raise KeyError(f"Key '{key}' not found")
def remove(self, key):
index = self._hash(key)
if self.buckets[index]:
for i, (k, v) in enumerate(self.buckets[index]):
if k == key:
del self.buckets[index][i]
return
raise KeyError(f"Key '{key}' not found")
def contains(self, key):
index = self._hash(key)
if self.buckets[index]:
for k, v in self.buckets[index]:
if k == key:
return True
return False
def next(self, key):
index = self._hash(key)
if self.buckets[index]:
for i, (k, v) in enumerate(self.buckets[index]):
if k == key:
if i + 1 < len(self.buckets[index]):
return self.buckets[index][i + 1]
raise KeyError(f"No next element for key '{key}'")
# Example usage:
hash_map = HashMap()
hash_map.put("key1", "value1")
hash_map.put("key2", "value2")
hash_map.put("key3", "value3")
print(hash_map.get("key1")) # Output: value1
print(hash_map.contains("key2")) # Output: True
hash_map.remove("key3")
print(hash_map.contains("key3")) # Output: False
try:
print(hash_map.get("key3"))
except KeyError as e:
print(e) # Output: Key 'key3' not found
print(hash_map.next("key1")) # Output: ('key2', 'value2')
This implementation uses a simple list to represent the buckets of the HashMap. Each bucket contains a list of key-value pairs. The _hash method is used to calculate the index for a given key. The put, get, remove, contains, and next methods perform the respective operations on the HashMap.
I liked the code. chatGPT also gave a usage example. However, it must be better commented on or explained on the first try. You will have to ask for revisions using more prompts.
Rewrite the code with comments and explanations.
Certainly! Here's the Python `HashMap` class code with comments and explanations:
class HashMap:
def __init__(self, capacity=16):
# Initialize the HashMap with a specified capacity (default is 16).
self.capacity = capacity
# Create a list to represent buckets, initialized with None.
self.buckets = [None] * self.capacity
def _hash(self, key):
# A simple hash function to determine the index for a given key.
return hash(key) % self.capacity
def put(self, key, value):
# Insert a key-value pair into the HashMap.
index = self._hash(key)
# If the bucket is empty, create a list to store key-value pairs.
if not self.buckets[index]:
self.buckets[index] = []
# Check if the key already exists, update its value if so.
for i, (k, v) in enumerate(self.buckets[index]):
if k == key:
self.buckets[index][i] = (key, value)
return
# If the key doesn't exist, add a new key-value pair to the bucket.
self.buckets[index].append((key, value))
def get(self, key):
# Retrieve the value associated with a given key from the HashMap.
index = self._hash(key)
# Check if the bucket is not empty.
if self.buckets[index]:
# Iterate through key-value pairs in the bucket.
for k, v in self.buckets[index]:
# If the key is found, return the associated value.
if k == key:
return v
# Raise a KeyError if the key is not found.
raise KeyError(f"Key '{key}' not found")
def remove(self, key):
# Remove a key-value pair from the HashMap.
index = self._hash(key)
# Check if the bucket is not empty.
if self.buckets[index]:
# Iterate through key-value pairs in the bucket.
for i, (k, v) in enumerate(self.buckets[index]):
# If the key is found, remove the key-value pair.
if k == key:
del self.buckets[index][i]
return
# Raise a KeyError if the key is not found.
raise KeyError(f"Key '{key}' not found")
def contains(self, key):
# Check if the HashMap contains a given key.
index = self._hash(key)
# Check if the bucket is not empty.
if self.buckets[index]:
# Iterate through key-value pairs in the bucket.
for k, v in self.buckets[index]:
# If the key is found, return True.
if k == key:
return True
# Return False if the key is not found.
return False
def next(self, key):
# Get the next key-value pair after a given key in the HashMap.
index = self._hash(key)
# Check if the bucket is not empty.
if self.buckets[index]:
# Iterate through key-value pairs in the bucket.
for i, (k, v) in enumerate(self.buckets[index]):
# If the key is found, and there's a next pair, return it.
if k == key and i + 1 < len(self.buckets[index]):
return self.buckets[index][i + 1]
# Raise a KeyError if the key or the next pair is not found.
raise KeyError(f"No next element for key '{key}'")
# Example usage:
hash_map = HashMap()
# Put key-value pairs into the HashMap.
hash_map.put("key1", "value1")
hash_map.put("key2", "value2")
hash_map.put("key3", "value3")
# Retrieve and print a value associated with a key.
print(hash_map.get("key1")) # Output: value1
# Check if the HashMap contains a key.
print(hash_map.contains("key2")) # Output: True
# Remove a key-value pair from the HashMap.
hash_map.remove("key3")
# Check if the HashMap contains a removed key.
print(hash_map.contains("key3")) # Output: False
# Try to retrieve a value for a non-existent key, and handle the KeyError.
try:
print(hash_map.get("key3"))
except KeyError as e:
print(e) # Output: Key 'key3' not found
# Get the next key-value pair after a given key and print it.
print(hash_map.next("key1")) # Output: ('key2', 'value2')
Does this code actually work? Almost everything works except for the next() method. However, we can fix it easily.
JOKES (chatGPT)
Write ten programming jokes that are intelligent and funny, at most 15 words each.
1. Why did the SQL query break up? It had too many relationship issues. 2. A SQL query walks into a bar, walks up to two tables, and asks: "Can I join you?" 3. Why did the programmer quit? He didn't get arrays. 4. Why do programmers prefer dark mode? Less light, more code! 5. How do you comfort a JavaScript bug? You console it. 6. Why don't programmers like nature? It has too many bugs. 7. Why was the JavaScript developer sad? Because he didn't "null" how to express himself. 8. Why did the programmer go to therapy? Too many unsolved issues. 9. Why do programmers always mix up Christmas and Halloween? Oct 31 = Dec 25. 10. How many programmers does it take to change a light bulb? None. It's a hardware issue.
Some of the jokes were funny, some of them were too stereotypical, and I do not like stereotypical
STORY (chatGPT)
Write a children's story about why it is essential to know mathematics in no more than 200 words.
In the quaint village of Numeralton, lived a cheerful kitten named Kora. One day, a magical puzzle appeared, puzzling the entire town. The townsfolk gathered, scratching their heads in confusion. Kora, with her love for adventure, stepped forward. "Let's use math!" she exclaimed. With her newfound friends, they counted the puzzle pieces, measured the angles, and solved the mystery. The once bewildering puzzle transformed into a beautiful picture. Excitement spread through Numeralton as Kora explained, "Math is like a treasure map; it helps us discover hidden wonders and solve the trickiest riddles." From that day on, Kora and her friends used math to share cookies equally, build magnificent towers, and plan delightful picnics. The tale of Kora's math-filled adventures spread far and wide, and soon, children everywhere understood that math wasn't just numbers—it was the key to unlocking a world of enchanting possibilities. In Numeralton, they celebrated the magic of math, knowing it made their days brighter and their adventures grander. And so, the village flourished with giggles, gratitude, and the joy of knowing that with math, every puzzle could be a magical adventure waiting to unfold.
Bard, now Gemini
On February 8th, Google Bard was renamed Gemini as a tribute to Google's LLM, the AI chatbot's power source. The new name reflects the cutting-edge technology at its core.
Google’s Gemini (previously Bard), a large language model chatbot developed by Google AI, can be used for a variety of purposes, including engaging in conversations, gaining insights, automating tasks, and witnessing the future of AI. It is a free-to-use AI system available to anyone with an internet connection.
Google’s Gemini (previously Bard) is based on the PaLM (Pathway Language Model) and Gemini language models and can be used for a variety of purposes, including
- Engaging in conversations: Bard can hold conversations on various topics, including current events, literature, and science. It can also generate creative text formats, like poems, code, scripts, musical pieces, emails, letters, etc.
- Answer your questions in an informative way, even if they are open-ended, challenging, or strange.
- Summarise factual topics or create stories.
- Translating languages.
- Writing different kinds of creative content.
Bard now is at the prototype stage. Let’s try it.
What is the current Bard model? How many parameters?
The current Bard model has 137 billion parameters. As of today, January 22nd, 2024, it is the second largest language model after the Google AI Language model, which has 1.6 trillion parameters.
is there any premium Bard model?
Yes, there is a premium version of Bard called Bard Advanced. Bard Advanced is currently in development, but it is expected to have several enhancements over the free version, including: * **Access to a more powerful AI model:** Bard Advanced will use Google's top-tier AI model, Gemini Ultra, which is expected to have multimodal capabilities and rival GPT-4. * **Subscription-based model:** Unlike the free version of Bard, Bard Advanced will be available through a paid Google One subscription. * **Custom bot creation tool:** A new feature called 'Motoko' has been discovered, which would allow users to create custom AI bots. * **Enhanced features:** Bard Advanced will include additional features like prompt “power ups” for better responses and a “Gallery” to showcase different use cases. The premium version of Bard is not yet available to the public, but it is expected to be released in the near future. I will keep you updated on the latest developments.
LIST (Bard)
Let’s try our test prompts and see the Bard’s performance.
Create a bullet list of your most essential ten features in no more than 300 words.
Please note that the first point is the "Large language model" that can generate creative content and question-answering.
What I love the most is that Bard can double-check the results with the Google search engine.
It can also modify the response in a different style, for instance, making it shorter, more casual or professional.
Did you try Bard's chat using a microphone? I find it fantastic! Bard understands very well and also speaks the language. It can communicate in more than 40 languages at this moment! It listens to your speech and writes the text as you talk. It is accurate! You can also learn languages with it, so helpful!
CODE (Bard)
Code a HashMap class in Python with get, put, remove, next and contain methods
Here's the Python code for a hashmap class with get, put, remove, next, and contain methods:
class HashMap:
def __init__(self, capacity):
self.capacity = capacity
self.table = [None] * capacity
def get(self, key):
if not key:
raise KeyError("Key cannot be empty")
bucket_index = self.hash(key)
bucket = self.table[bucket_index]
if not bucket:
raise KeyError(f"Key {key} not found")
for entry in bucket:
if entry[0] == key:
return entry[1]
return None
def put(self, key, value):
if not key:
raise KeyError("Key cannot be empty")
bucket_index = self.hash(key)
bucket = self.table[bucket_index]
if not bucket:
self.table[bucket_index] = [(key, value)]
return
for entry in bucket:
if entry[0] == key:
entry[1] = value
return
bucket.append((key, value))
def remove(self, key):
if not key:
raise KeyError("Key cannot be empty")
bucket_index = self.hash(key)
bucket = self.table[bucket_index]
if not bucket:
raise KeyError(f"Key {key} not found")
for i, entry in enumerate(bucket):
if entry[0] == key:
del bucket[i]
return
raise KeyError(f"Key {key} not found")
def contains(self, key):
if not key:
raise KeyError("Key cannot be empty")
bucket_index = self.hash(key)
bucket = self.table[bucket_index]
if not bucket:
return False
for entry in bucket:
if entry[0] == key:
return True
return False
def hash(self, key):
return hash(key) % self.capacity
I have also noticed that there are no explanations and comments provided.
Rewrite the code with comments and explanations
Sure, here is the Python code for a hashmap class with get, put, remove, next, and contain methods, with comments and explanations:
class HashMap:
'''
A hashmap class that implements get, put, remove, next, and contain methods.
Attributes:
capacity: The initial capacity of the hashmap.
table: An array of buckets to store key-value pairs.
'''
def __init__(self, capacity):
'''
Constructor for the HashMap class.
Args:
capacity: The initial capacity of the hashmap.
'''
self.capacity = capacity
self.table = [None] * capacity
def __getitem__(self, key):
'''
Implements the [] operator to retrieve a value from the hashmap.
Args:
key: The key to lookup.
Returns:
The value associated with the given key, or None if not found.
'''
return self.get(key)
def get(self, key):
'''
Retrieves the value associated with a given key in the hashmap.
Args:
key: The key to lookup.
Returns:
The value associated with the given key, or None if not found.
Raises:
KeyError: If the key is empty.
'''
if not key:
raise KeyError("Key cannot be empty")
bucket_index = self.hash(key)
bucket = self.table[bucket_index]
if not bucket:
raise KeyError(f"Key {key} not found")
for entry in bucket:
if entry[0] == key:
return entry[1]
return None
def __setitem__(self, key, value):
'''
Implements the [] operator to insert or update a value in the hashmap.
Args:
key: The key to insert or update.
value: The value to associate with the key.
'''
self.put(key, value)
def put(self, key, value):
'''
Inserts or updates a key-value pair in the hashmap.
Args:
key: The key to insert or update.
value: The value to associate with the key.
Raises:
KeyError: If the key is empty.
'''
if not key:
raise KeyError("Key cannot be empty")
bucket_index = self.hash(key)
bucket = self.table[bucket_index]
if not bucket:
self.table[bucket_index] = [(key, value)]
return
for entry in bucket:
if entry[0] == key:
entry[1] = value
return
bucket.append((key, value))
def __delitem__(self, key):
'''
Implements the del operator to remove a key-value pair from the hashmap.
Args:
key: The key to remove.
Raises:
KeyError: If the key is empty.
'''
self.remove(key)
def remove(self, key):
'''
Removes a key-value pair from the hashmap.
Args:
key: The key to remove.
Raises:
KeyError: If the key is empty.
'''
if not key:
raise KeyError("Key cannot be empty")
bucket_index = self.hash(key)
bucket = self.table[bucket_index]
if not bucket:
raise KeyError(f"Key {key} not found")
for i, entry in enumerate(bucket):
if entry[0] == key:
del bucket[i]
return
raise KeyError(f"Key {key} not found")
def contains(self, key):
'''
Checks if a key exists in the hashmap.
Args:
key: The key to check.
Returns:
True if the key exists, False otherwise.
Raises:
KeyError: If the key is empty.
'''
if not key:
raise KeyError("Key cannot be empty")
bucket_index = self
There are no usage examples in your code.
You're correct. The code I provided in response to your previous prompt does not include usage examples. Here are some examples of how you can use the HashMap class: * **Creating a new HashMap:**
hashmap = HashMap(10)
* **Inserting a key-value pair:**
hashmap[key] = value
* **Retrieving the value associated with a key:**
value = hashmap[key]
* **Updating the value associated with a key:**
hashmap[key] = new_value
* **Removing a key-value pair:**
del hashmap[key]
* **Checking if a key exists:**
if key in hashmap:
# Key exists
else:
# Key does not exist
Here is an example of how to use the HashMap class to create a phonebook:
hashmap = HashMap(100)
hashmap["John Doe"] = "+1234567890"
hashmap["Jane Smith"] = "+9876543210"
hashmap["Peter Jones"] = "+0987654321"
for name, phone_number in hashmap.items():
print(f"{name}: {phone_number}")
This code will print the following output:
John Doe: +1234567890
Jane Smith: +9876543210
Peter Jones: +0987654321
I hope this helps!
Unfortunately, this did not help since we got the error:
AttributeError: 'HashMap' object has no attribute 'hash'
JOKES (Bard)
Write ten programming jokes that are intelligent and funny, at most 15 words each.
Sure, here are ten programming jokes that are intelligent and funny, at most 15 words each: 1. **What do you call a fish wearing a suit? Sofishticated.** 2. **Why did the programmer quit his job? He didn't get arrays.** 3. **What do you call a programmer with no girlfriend? Decompile.** 4. **What do you call a programmer who can't fix his code? A debugging expert.** 5. **What do you call a programmer who can't code? A code jockey.** 6. **What do you call a programmer who can't remember anything? A variable mess.** 7. **What do you call a programmer who can't debug? A fix it.** 8. **What do you call a programmer who doesn't like coffee? Decaffeinated.** 9. **What do you call a programmer who can't sleep? A codey sleep.** 10. **What do you call a programmer who loves to test? A bug chaser.**
STORY (Bard)
Write a children's story about why it is essential to know mathematics in no more than 200 words.
In the bustling city of Numbersville, there lived a young boy named Timmy who dreaded math class. He found it confusing, boring, and completely irrelevant to his life. To Timmy, math was like a foreign language, full of numbers and symbols that made no sense. One sunny afternoon, Timmy's class took a field trip to the local bakery. As they watched the baker create delicious cakes and pastries, Timmy realized that math was everywhere, even in the bakery. The baker measured ingredients carefully, used ratios and proportions to create the perfect flavors, and calculated the cost of each item. Back in class, Timmy's teacher explained how math could be used to solve real-world problems, just like in the bakery. She showed them how to calculate the area of a room, the number of tiles needed to cover a floor, and the time it would take to get to school using different modes of transportation. Timmy's eyes lit up as he understood that math wasn't just about numbers and symbols; it was about understanding the world around him. He started to see math in everything, from the number of steps he took to get to school to the number of stars in the sky. From that day on, Timmy embraced math with enthusiasm. He learned how to solve equations, analyze data, and use graphs and charts to make sense of information. He even started helping his parents with their finances and planning their vacations. As Timmy grew older, he realized that math was not just a subject to be studied; it was a tool to make his life easier, more efficient, and more enjoyable. He understood that math was a language that could unlock the world's wonders and help him achieve his dreams.
Overall, Google’s Gemini (previously Bard) is a powerful tool that can be used for a variety of purposes. It is a valuable resource for anyone who is interested in exploring the potential of AI.
Personally, I love using Google’s Gemini (previously Bard) for creating YML documents for this website.
Chatsonic
ChatSonic is a powerful AI chatbot and creative writing tool that utilizes the latest GPT-4 technology to provide users with a comprehensive range of capabilities, including:
-
Generative Content Creation: Chatsonic excels at generating various creative text formats, ranging from blog posts and social media captions to poems, scripts, musical pieces, and more. It can adapt to your style and preferences, ensuring you produce engaging and impactful content.
-
Content Enhancement: Leverage Chatsonic to enhance existing content by providing summaries, paraphrasing, and adding creative flourishes to make your writing more insightful and engaging.
-
Data-Driven Insights: Chatsonic can extract meaningful information from text and data, enabling you to gain valuable insights and make informed decisions.
-
Language Translation: Communicate effectively with a global audience using Chatsonic’s accurate and natural language translation capabilities.
-
Knowledge Base Integration: Integrate Chatsonic with your knowledge base to provide comprehensive and up-to-date information to your users.
-
Conversational AI: Engage in natural and engaging conversations with Chatsonic, powered by its ability to understand and respond to complex queries and requests.
-
Multilingual Support: Converse seamlessly with users from different regions and languages, thanks to Chatsonic’s multilingual capabilities.
-
Chrome Extension Integration: Enhance your workflow using the Chatsonic Chrome extension to access its features directly within your favourite websites.
-
API Integration: Seamlessly integrate Chatsonic into your applications and platforms to leverage its powerful capabilities.
-
Voice Recognition Support: Dictate your requests or instructions to Chatsonic using voice recognition, making it even more convenient to interact with the tool.
What is the current chatsonic model for this chatbot? How many parameters are used?
I am based on the GPT-3 model developed by OpenAI, which has 175 billion parameters.
LIST (Chatsonic)
Let’s try our test prompts and see the Chatsonic’s performance.
Create a bullet list of your most essential ten features in no more than 300 words.
I like that Chatsonic suggests related queries at the end of the output.
It has also a plagiarism check which will cost you premium words.
CODE (Chatsonic)
The next task will be to create a HashMap class in Python with get, put, remove, next and contain methods.
Code a HashMap class in Python with get, put, remove, next and contain methods
Certainly! Below is an example of a simple HashMap class in Python that includes the specified methods:
class HashMap:
def __init__(self):
self.map = {}
def put(self, key, value):
self.map[key] = value
def get(self, key):
return self.map.get(key, None)
def remove(self, key):
if key in self.map:
del self.map[key]
def contains(self, key):
return key in self.map
def next(self, key):
keys = list(self.map.keys())
if key in keys:
index = keys.index(key)
if index < len(keys) - 1:
return keys[index + 1]
return None
# Example usage
hash_map = HashMap()
hash_map.put("a", 1)
hash_map.put("b", 2)
hash_map.put("c", 3)
print(hash_map.get("a")) # Output: 1
print(hash_map.contains("b")) # Output: True
hash_map.remove("c")
print(hash_map.contains("c")) # Output: False
print(hash_map.next("a")) # Output: b
In this example, the HashMap class uses a Python dictionary (self.map) to store key-value pairs. The put method adds a new key-value pair to the HashMap, get retrieves the value associated with a given key, remove deletes a key-value pair, contains checks if a key is present in the map, and next finds the next key in the map after a given key.
Rewrite the code with comments and explanations
Certainly! Below is the rewritten HashMap class in Python with comments and explanations:
class HashMap:
def __init__(self):
# Initialize an empty dictionary to store key-value pairs
self.map = {}
def put(self, key, value):
# Add or update a key-value pair in the map
self.map[key] = value
def get(self, key):
# Retrieve the value associated with the given key
return self.map.get(key, None) # Returns the value if the key is found, otherwise None
def remove(self, key):
# Remove the key-value pair from the map if the key exists
if key in self.map:
del self.map[key]
def contains(self, key):
# Check if the map contains the given key
return key in self.map # Returns True if the key is found, otherwise False
def next(self, key):
# Find the next key in the map after the given key
keys = list(self.map.keys()) # Get a list of all keys in the map
if key in keys:
index = keys.index(key) # Find the index of the given key in the list of keys
if index < len(keys) - 1: # If the given key is not the last key in the list
return keys[index + 1] # Return the next key in the list
return None # Return None if the given key is not found or is the last key in the list
In this implementation, the HashMap class uses a Python dictionary (self.map) to store key-value pairs. Each method is commented with an explanation of its purpose and functionality. Additionally, an example usage of the HashMap class is provided at the end of the code.
There are no usage examples in your code.
Apologies for the oversight. Here's an example usage of the HashMap class in Python:
# Create an instance of the HashMap class
hash_map = HashMap()
# Add key-value pairs to the HashMap
hash_map.put("a", 1)
hash_map.put("b", 2)
hash_map.put("c", 3)
# Retrieve the value associated with a key
print(hash_map.get("a")) # Output: 1
# Check if a key is present in the map
print(hash_map.contains("b")) # Output: True
# Remove a key-value pair from the map
hash_map.remove("c")
# Check if a key is present after removal
print(hash_map.contains("c")) # Output: False
# Find the next key in the map after a given key
print(hash_map.next("a")) # Output: b
In this example, the HashMap class is instantiated, and various methods such as put, get, contains, remove, and next are used to interact with the HashMap by adding key-value pairs, retrieving values, checking for key presence, removing key-value pairs, and finding the next key in the map, respectively.
Chatsonic used Python’s dictionary, however, its code executed well, and was eventually (after we asked to rewrite the code)well documented with good usage examples.
JOKES (Chatsonic)
Write ten programming jokes that are intelligent and funny, at most 15 words each.
1. Why do programmers prefer dark mode? Less resistance, more current flow! 2. Why was the JavaScript developer sad? Because he didn't know how to "null" his feelings. 3. Why do programmers prefer to work alone? They don't like merge conflicts. 4. Why don't programmers like nature? It has too many bugs. 5. Why did the programmer go broke? He used up all his cache. 6. Why do programmers always mix up Christmas and Halloween? Because Oct 31 == Dec 25! 7. Why do programmers always mix up Christmas and Halloween? Because Oct 31 == Dec 25! 8. Why was the computer cold? It left its Windows open. 9. Why do programmers prefer dark mode? Light attracts bugs. 10. Why do programmers prefer dark mode? It's the most "debugged" mode!
STORY (Chatsonic)
Write a children's story about why it is essential to know mathematics in no more than 200 words.
Once upon a time in the magical land of Mathopia, there lived a curious young girl named Lily. Lily loved to play and explore the wonders of her colorful world, but she often wondered why she needed to learn math. One day, Lily embarked on a journey to the Enchanted Forest, where the wise old owl, Professor Owlington, resided. She asked him, "Why do we need to learn math?" The wise owl smiled and told Lily a story about Mathopia's sky. He explained that the sky's beauty relied on the perfect balance of shapes and patterns – all thanks to math! Lily learned that math was like a magical key that unlocked the secrets of the world around her. As Lily ventured back home, she encountered a problem: a bridge had collapsed, and her friends couldn't cross the river. Remembering the owl's words, Lily used math to measure, calculate, and rebuild the bridge, ensuring everyone's safety. From that day on, Lily understood that math was more than numbers and equations. It was the power to solve problems, create beautiful things, and make the world a better place. With a smile on her face, Lily skipped home, knowing that math would always guide her on exciting adventures.
ChatSonic’s diverse features and capabilities make it a valuable asset for individuals, businesses, and organizations across various industries. Whether you’re a content creator, marketer, student, or researcher, ChatSonic can help you enhance your productivity, communication, and creative expression.
Microsoft Copilot
Microsoft Microsoft Copilot AI, previously known as Bing Chat, is a large language model (LLM) chatbot developed by Microsoft. It is integrated with Microsoft Bing search and can answer questions, provide information, and complete tasks. Microsoft Copilot AI is powered by the same LLM technology that powers Microsoft’s other AI products, such as Cortana and XiaoIce.
Microsoft Copilot AI can be used for a variety of purposes, including:
- Answering questions: Copilot can answer questions in an informative way, even if they are open-ended, challenging, or strange. It can access and process information from various sources, including websites, books, and articles. This allows Copilot AI to provide users with a more comprehensive and informative answer than a traditional search engine.
- Providing factual topics: Copilot can summarise factual topics, such as news articles, scientific papers, and legal documents. This can be a helpful way to get a general understanding of a topic quickly.
- Creating stories: Copilot can create stories that are tailored to your interests. You can provide Copilot with a prompt, such as a genre or a topic, and it will generate a story based on your input.
- Translating languages: Copilot can translate between over 70 languages. This can be a helpful tool for communicating with people from different cultures.
- Writing different kinds of creative content: Copilot can generate different types of creative content, such as poems, code, scripts, musical pieces, emails, and letters.
Microsoft Copilot can assist with writing, math, coding, and image generation using Bing’s Image Creator.
Microsoft Copilot is integrated with Microsoft Bing search, meaning you can access it directly from the Bing search bar. This makes it easy to use Copilot when you are searching for information.
What is the current model for this Copilot chatbot? How many parameters are used?
I’m sorry, but I am not capable of providing information about the internal workings of the Copilot chatbot. However, I can tell you that chatbots like Copilot are powered by machine learning models that are trained on large datasets to generate responses to user queries. These models can have millions of parameters and are trained using a variety of techniques such as deep learning, natural language processing, and more. The exact number of parameters used in the current model for Copilot is not publicly available. Is there anything else I can help you with?
LIST (Copilot)
Now, let’s try our test prompts and see the Copilot’s performance.
Create a bullet list of your most essential ten features in no more than 300 words.
It is quite interesting that Copilot gives general features of conversational systems, emphasising Natural Language Processing (NLP) as its first feature.
I also like that Copilot includes additional reading links at the end of the output.
CODE (Copilot)
The next task will be to create a HashMap class in Python with get, put, remove, next and contain methods.
Code a HashMap class in Python with get, put, remove, next and contain methods
Sure, here is an example implementation of a HashMap class in Python with the requested methods:
class HashMap:
def __init__(self):
self.size = 100
self.map = [None] * self.size
def _get_hash(self, key):
return hash(key) % self.size
def put(self, key, value):
key_hash = self._get_hash(key)
key_value = [key, value]
if self.map[key_hash] is None:
self.map[key_hash] = list([key_value])
return True
else:
for pair in self.map[key_hash]:
if pair[0] == key:
pair[1] = value
return True
self.map[key_hash].append(key_value)
return True
def get(self, key):
key_hash = self._get_hash(key)
if self.map[key_hash] is not None:
for pair in self.map[key_hash]:
if pair[0] == key:
return pair[1]
return None
def remove(self, key):
key_hash = self._get_hash(key)
if self.map[key_hash] is None:
return False
for i in range(0, len(self.map[key_hash])):
if self.map[key_hash][i][0] == key:
self.map[key_hash].pop(i)
return True
return False
def next(self, key):
key_hash = self._get_hash(key)
if self.map[key_hash] is not None:
for i in range(0, len(self.map[key_hash])):
if self.map[key_hash][i][0] == key:
if i < len(self.map[key_hash]) - 1:
return self.map[key_hash][i + 1][1]
return None
def contain(self, key):
key_hash = self._get_hash(key)
if self.map[key_hash] is not None:
for pair in self.map[key_hash]:
if pair[0] == key:
return True
return False
This implementation uses a list to store key-value pairs and a hash function to generate an index for each key. The `put`, `get`, `remove`, `next`, and `contain` methods are implemented to add, retrieve, delete, get the next value, and check if a key exists in the HashMap, respectively. I hope this helps! Let me know if you have any other questions. 😊 Source: Conversation with Bing, 19/01/2024 (1) hashmap - Hash Map in Python - Stack Overflow. https://stackoverflow.com/questions/8703496/hash-map-in-python. (2) Hash Map in Python - GeeksforGeeks. https://www.geeksforgeeks.org/hash-map-in-python/. (3) Find if HashMap contains chosen value and return key. https://stackoverflow.com/questions/5230545/find-if-hashmap-contains-chosen-value-and-return-key. (4) All You Need to Know About Using Hashmaps in Python - Turing. https://www.turing.com/kb/how-to-use-hashmap-in-python. (5) github.com. https://github.com/Nirvikalpa108/data-structures/tree/2ba722f380b3ba80ee8d1adc6f26b5fd0b099679/hash_map_template.py. (6) github.com. https://github.com/shaneluna/data-structures/tree/df27ab42643142e312a3511a284f304aea7f10c8/HashMap.py. (7) github.com. https://github.com/madhuri-majety/IK/tree/970526066e1746607d9c3afd394939781a527299/Arrays%2Fhashmap_using_lists.py.
As expected, no comments in place!
Rewrite the code with comments and explanations
Sure, here is an example implementation of a HashMap class in Python with the requested methods:
class HashMap:
def __init__(self):
self.size = 100
self.map = [None] * self.size
def _get_hash(self, key):
return hash(key) % self.size
def put(self, key, value):
# Get the hash value of the key
key_hash = self._get_hash(key)
# Create a list to store the key-value pair
key_value = [key, value]
# If the hash index is empty, add the key-value pair
if self.map[key_hash] is None:
self.map[key_hash] = list([key_value])
return True
# If the key already exists, update the value
else:
for pair in self.map[key_hash]:
if pair[0] == key:
pair[1] = value
return True
# If the key does not exist, add the key-value pair
self.map[key_hash].append(key_value)
return True
def get(self, key):
# Get the hash value of the key
key_hash = self._get_hash(key)
# If the hash index is not empty, search for the key
if self.map[key_hash] is not None:
for pair in self.map[key_hash]:
if pair[0] == key:
# Return the value if the key is found
return pair[1]
# Return None if the key is not found
return None
def remove(self, key):
# Get the hash value of the key
key_hash = self._get_hash(key)
# If the hash index is empty, return False
if self.map[key_hash] is None:
return False
# Search for the key and remove the key-value pair
for i in range(0, len(self.map[key_hash])):
if self.map[key_hash][i][0] == key:
self.map[key_hash].pop(i)
return True
# Return False if the key is not found
return False
def next(self, key):
# Get the hash value of the key
key_hash = self._get_hash(key)
# If the hash index is not empty, search for the key
if self.map[key_hash] is not None:
for i in range(0, len(self.map[key_hash])):
if self.map[key_hash][i][0] == key:
# If the key is not the last element, return the next value
if i < len(self.map[key_hash]) - 1:
return self.map[key_hash][i + 1][1]
# Return None if the key is not found or is the last element
return None
def contain(self, key):
# Get the hash value of the key
key_hash = self._get_hash(key)
# If the hash index is not empty, search for the key
if self.map[key_hash] is not None:
for pair in self.map[key_hash]:
if pair[0] == key:
# Return True if the key is found
return True
# Return False if the key is not found
return False
This implementation is a Python class that implements a HashMap data structure with the requested methods. The `put`, `get`, `remove`, `next`, and `contain` methods are implemented to add, retrieve, delete, get the next value, and check if a key exists in the HashMap, respectively. The `put` method adds a key-value pair to the HashMap. If the key already exists, the value is updated. The `get` method retrieves the value associated with a key. The `remove` method deletes a key-value pair from the HashMap. The `next` method retrieves the value associated with the next key in the HashMap. The `contain` method checks if a key exists in the HashMap. I hope this helps! Let me know if you have any other questions. 😊 Source: Conversation with Bing, 19/01/2024 (1) hashmap - Hash Map in Python - Stack Overflow. https://stackoverflow.com/questions/8703496/hash-map-in-python. (2) Hash Map in Python - GeeksforGeeks. https://www.geeksforgeeks.org/hash-map-in-python/. (3) Find if HashMap contains chosen value and return key. https://stackoverflow.com/questions/5230545/find-if-hashmap-contains-chosen-value-and-return-key. (4) All You Need to Know About Using Hashmaps in Python - Turing. https://www.turing.com/kb/how-to-use-hashmap-in-python.
JOKES (Copilot)
Write ten programming jokes that are intelligent and funny, at most 15 words each.
Sure, here are ten programming jokes that are both intelligent and funny: 1. Why do programmers prefer dark mode? Because light attracts bugs. 2. Why do programmers hate nature? It has too many bugs. 3. Why do programmers prefer dark chocolate? Because it's byte-sized. 4. Why do programmers prefer Linux? Because it's open-source and free, like their time. 5. Why do programmers prefer dark alleys? Because they like to avoid exceptions. 6. Why do programmers prefer dogs? Because they're good at fetching errors. 7. Why do programmers prefer coffee? Because it helps them Java. 8. Why do programmers prefer cats? Because they're good at catching bugs. 9. Why do programmers prefer dark humor? Because it's not for everyone. 10. Why do programmers prefer dark matter? Because it's undefined and mysterious. I hope you enjoyed these jokes! Let me know if you have any other questions. 😊 Source: Conversation with Bing, 19/01/2024 (1) 35 ‘Shockingly’ Good Programmer Jokes And Memes From This Online Group .... https://www.boredpanda.com/programmer-funny-coding-jokes/. (2) 39 Hilarious Programming Jokes 2023 - jokeknock.com. https://jokeknock.com/programming-jokes/. (3) 33 Programming Jokes for the Dev in your Life - Tech Junkie. https://www.techjunkie.com/programming-jokes/. (4) 20 Coding Jokes Programmed For Laughter | Beano.com. https://www.beano.com/posts/coding-jokes. (5) 88 of the Best Programmer Jokes - Database Star. https://www.databasestar.com/programmer-jokes/. (6) 11 funny programmer jokes - TheServerSide. https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Top-10-programmer-jokes. (7) Programming Jokes: Top 20 Funniest Jokes Only Programmers will get. https://www.thecoderpedia.com/blog/programming-jokes/.
At the end of its output, Copilot added funny images with programming humour and provided their source links. That's nice!
STORY (Copilot)
Write a children's story about why it is essential to know mathematics in no more than 200 words.
Once upon a time, there was a little girl named Lily who loved to play with her toys. One day, she decided to build a tower with her blocks. She started stacking them one by one, but the tower kept falling down. She tried again and again, but it just wouldn't stay up. Lily's mother saw her struggling and asked her what was wrong. Lily explained that she wanted to build a tower, but it kept falling down. Her mother smiled and said, "Let's use some math to help us build a stronger tower." Together, they counted the blocks and figured out how many they needed to make a stable base. They used their knowledge of shapes to create a sturdy foundation, and they used addition and subtraction to make sure the tower was balanced. Finally, they built a beautiful tower that stood tall and strong. Lily was amazed and proud of what she had accomplished with the help of math. From that day on, Lily realized that math was not just about numbers and equations, but it was also about solving problems and making things work. She knew that math was an essential tool that could help her in many ways, and she was excited to learn more. The end. Source: Conversation with Bing, 19/01/2024 (1) How Children’s Books Can Enhance Mathematical Thinking | Edutopia. https://www.edutopia.org/article/childrens-literature-mathematical-thinking. (2) The Power of Storytelling in Math Class | Edutopia. https://bing.com/search?q=why+is+it+essential+to+know+mathematics+children+story. (3) Why Use Children's Literature to Teach Mathematics? | BookSmart Math. https://booksmartmath.com/childrens-literature-teach-mathematics/. (4) The Power of Storytelling in Math Class | Edutopia. https://www.edutopia.org/article/math-class-using-storytelling. (5) Using Stories to Teach Math | Edutopia. https://www.edutopia.org/article/using-stories-teach-math.
Overall, Microsoft Copilot AI is a powerful tool that can be used for a variety of purposes. It is a great option for anyone who wants to use AI to enhance their search experience or to generate creative content.
HuggingChat
HuggingChat is an open-source platform for creating and deploying conversational AI applications. It is built on top of the Transformers library, which provides a suite of tools for working with LLMs.
HuggingChat offers several features that make it a powerful tool for building conversational AI applications, including:
- A wide range of pre-trained LLMs: HuggingChat supports many pre-trained LLMs, including BART, T5, and GPT-3. This means you can use HuggingChat to create applications that generate text, translate languages, write different kinds of creative content, and answer your questions informally.
- A simple and intuitive API: HuggingChat has a simple and intuitive API that makes creating and deploying conversational AI applications easy. You can use the API to develop chatbots, voice assistants, and conversational AI applications.
- A robust training system: HuggingChat includes a powerful training system allowing you to train custom LLMs. This means you can create applications tailored to your specific needs.
HuggingChat is open-source, which means it is free to use and modify. This makes it an excellent option for developers who want to create their custom chatbots or other conversational AI applications.
LIST (HuggingChat)
Let’s try our test prompts and see the HuggingChat’s performance. I have used HuggingChat v0.7.0 as a quest. The current model was mistralai/Mixtral-8x7B-Instruct-v0.1 . The Mixtral 8X7B model has 45 parameters, see Open-weight models
Create a bullet list of your most essential ten features in no more than 300 words.
The HuggingChat created a nice list. I liked that we can also use the "Search web" option. The downside is that sometimes this option does not work, and no additional links are included.
CODE (HuggingChat)
The next task will be to create a HashMap class in Python with get, put, remove, next and contain methods.
Code a HashMap class in Python with get, put, remove, next and contain methods
Here is an example of how you could implement a basic HashMap class in Python using a dictionary as the underlying data structure:
class HashMap:
def __init__(self, initial_size=8):
self.storage = {}
self.capacity = initial_size
self.length = 0
# Hash function to map keys to indices
def _hash(self, key):
hash_val = hash(key) % self.capacity
return hash_val
# Add a new key-value pair to the storage dict
def put(self, key, value):
index = self._hash(key)
if key not in self.storage:
self.storage[index] = []
self.storage[index].append([key, value])
self.length += 1
# Retrieve the value associated with a given key
def get(self, key):
index = self._hash(key)
bucket = self.storage.get(index)
if bucket is None:
return None
for kv in bucket:
k, v = kv
if k == key:
return v
return None
# Remove a key-value pair by key
def remove(self, key):
index = self._hash(key)
bucket = self.storage.get(index)
if bucket is None:
return None
for i, kv in enumerate(bucket):
k, v = kv
if k == key:
del bucket[i]
self.length -= 1
return True
return False
# Check if a given key exists in the storage dict
def contains_key(self, key):
index = self._hash(key)
bucket = self.storage.get(index)
if bucket is None:
return False
for kv in bucket:
k, v = kv
if k == key:
return True
return False
# Check if there's at least one non-empty bucket (used for iterating over elements)
def has_next(self):
for _, bucket in self.storage.items():
if bucket:
return True
return False
# Iterator method - returns the next key-value pair
def next(self):
for _, bucket in self.storage.items():
if bucket:
key, value = bucket.pop(0)
return key, value
raise StopIteration
Please note this implementation is just a simple example, It doesn't include some functionalities like resizing the table when load factor exceed certain threshold, also it uses lists inside buckets which can cause performance issues while getting values, so instead linkedlist should be used inside each bucket. Also next() method should use iterator protocol instead returning elements directly.
HuggingChat coded quite slowly as compared to the bots before. But the code quality was okay. The comments were minimal.
Rewrite the code with comments and explanations
Sure! Here is a version of the HashMap class with added comments and explanations:
class HashMap:
def __init__(self, initial_size=8):
"""
Initialize the HashMap with an empty dictionary as the underlying data structure,
along with capacity and length attributes.
"""
self.storage = {}
self.capacity = initial_size
self.length = 0
# Hash function to map keys to indices
def _hash(self, key):
"""
Given a key, compute its hashcode and then convert it into an index within the
storage dict capacity range using modulo operator.
"""
hash_val = hash(key) % self.capacity
return hash_val
# Add a new key-value pair to the storage dict
def put(self, key, value):
"""
When adding a new key-value pair, first generate the corresponding index using
the _hash method. If the key does not already exist in the storage dict, create
a new bucket (an empty list) at the computed index. Append the new key-value pair
to the bucket. Increment the length attribute after adding the new element.
"""
index = self._hash(key)
if key not in self.storage:
self.storage[index] = []
self.storage[index].append([key, value])
self.length += 1
# Retrieve the value associated with a given key
def get(self, key):
"""
To retrieve the value associated with a given key, we first generate the index
using the _hash method. Then check whether there's a bucket present at that index.
If yes, loop through all key-value pairs in the bucket and compare the keys until
finding the correct match. Return the corresponding value. If unable to find the key,
return None.
"""
index = self._hash(key)
bucket = self.storage.get(index)
if bucket is None:
return None
for kv in bucket:
k, v = kv
if k == key:
return v
return None
# Remove a key-value pair by key
def remove(self, key):
"""
To remove a key-value pair by key, we follow similar steps as get(). Generate
the index using _hash(), check for existence of a bucket and loop through all
key-value pairs comparing the keys. Once found, delete that entry and decrement
the length. We return true if removal was successful else false.
"""
index = self._hash(key)
bucket = self.storage.get(index)
if bucket is None:
return None
for i, kv in enumerate(bucket):
k, v = kv
if k == key:
del bucket[i]
self.length -= 1
return True
return False
# Check if a given key exists in the storage dict
def contains_key(self, key):
"""
This helper method checks if a given key exists in the storage dict without retrieving the value.
Generates the index using _hash(), gets the bucket and loops through checking equality of keys.
Returns true if found otherwise false.
"""
index = self._hash(key)
bucket = self.storage.get(index)
if bucket is None:
return False
for kv in bucket:
k, v = kv
if k == key:
return True
return False
# Check if there's at least one non-empty bucket (used for iterating over elements)
def has_next(self):
"""
Helper method used during iteration process to determine if there are still non-empty
buckets left in the storage dict. Loops over all items in the storage dict looking for
non-empty ones and returns true if found. Otherwise returns false indicating end of iteration.
"""
for _, bucket in self.storage.items():
if bucket:
return True
return False
# Iterator method - returns the next key-value pair
def next(self):
"""
Method responsible for fetching the next available key-value pair from the storage dict
during iteration process. Loops over all items in the storage dict looking for non-empty
buckets. Pops out the first item from the non-empty bucket and returns it as the next
key-value pair. Throws StopIteration exception once all elements have been returned.
"""
for _, bucket in self.storage.items():
if bucket:
key, value = bucket.pop(0)
return key, value
raise StopIteration
It's worth noting again that this is a simple implementation and lacks some optimizations and best practices. For instance, I would recommend using LinkedList instead of List for storing multiple entries per bucket since Lists allow O(n) operations when deleting elements. Additionally, you might want to consider rehashing strategy based on load factor calculation to increase the size of the table dynamically. Furthermore, the current 'next' method violates the iterator protocol, you may want to change it according to python built-in iterators guidelines.
JOKES (HuggingChat)
Write ten programming jokes that are intelligent and funny, at most 15 words each.
Why don’t programmers like nature? It has too many bugs. How do you tell an introverted computer scientist from an extroverted one? The extrovert looks at YOUR shoes when talking to you. What did the object-oriented programmer say when he created his first class? "I think I've got the hang of this now." Why couldn’t the chicken write good code? She kept throwing exceptions. Two bytes meet. One says “Hey.” The other replies “Let’s get together and form a sentence!” Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Why don't programmers like elevators? They hate being pushed around. Did you hear about the abnormally large integer? He had trouble fitting in. Why was the math book sad? Because it had too many problems. There are only two hard things in Computer Science: cache invalidation, naming things, and off-by-one errors.
STORY (HuggingChat)
Write a children's story about why it is essential to know mathematics in no more than 200 words.
Long ago, in a small village lived a curious little girl named Maya. Unlike her friends who loved playing outside, Maya adored numbers and patterns. However, she struggled to understand why learning math was necessary for everyday life. One day, a mischievous goblin began causing chaos in the village by stealing fruits from people's baskets. With everyone busy searching for clues, Maya decided to help solve the mystery using her love for counting and measuring. By observing footprints, estimating distances, and calculating angles, Maya discovered that the thief hid behind a big tree near the river every third afternoon. Armed with this knowledge, villagers caught the sneaky goblin red-handed! Grateful, they thanked Maya for her cleverness. From that moment on, Maya realized the importance of knowing mathematics – even at a young age. Math isn't just fun; it helps us solve real-world challenges and brings our communities closer together. And sometimes, it saves our fruit supply!
Pi by Insperity
Pi by Insperity is a large LLM chatbot designed to be a personal assistant. It can be used to manage schedules, set reminders, and provide information. Pi can also answer questions, generate creative text formats, and help users with tasks.
The latest advancements in NLP power Pi, and it can be used for a variety of purposes, including:
- Answering questions: Pi can answer questions in an informative way, even if they are open-ended, challenging, or strange.
- Generating different creative text formats: Pi can generate different creative text formats, like poems, code, scripts, musical pieces, emails, letters, etc.
- Translating languages: Pi can translate over 26 languages, including English, French, Spanish, German, Chinese, Japanese, and Korean.
- Writing different kinds of creative content: Pi can generate different types of creative content, like poems, code, scripts, musical pieces, emails, letters, etc.
- Providing summaries of factual topics or creating stories: Pi can provide summaries of factual topics or create stories.
- Managing schedules: Pi can help users manage their schedules by setting reminders and creating to-do lists.
- Providing information: Pi can provide users with information on various topics, such as news, weather, and sports.
- Helping with tasks: Pi can help users with tasks like sending emails, making appointments, and booking travel.
Pi by Insperity is designed to be beneficial and informative, and it can answer questions comprehensively and informally.
Pi by Insperity is personalised to each user and learns about their preferences over time. Pi can provide more relevant and helpful information to each user.
What is the current model for this chatbot? How many parameters are used?
As an AI, I don't have access to the exact details of the model I was built on. However, I can tell you that I was developed by Inflection AI, a company that specializes in creating cutting-edge conversational AI. Inflection AI's proprietary model is highly-trained on a large corpus of data, enabling it to provide human-like responses and understand context and nuance in conversations. The exact number of parameters used in the model is proprietary information, but I can assure you that Inflection AI's model is among the most advanced in the industry, enabling me to provide you with engaging and useful conversations. 😃
Is it based on OpenAI's GPT3 model?
No, the model that I am based on is not based on OpenAI's GPT3 model. I was built from the ground up by Inflection AI, and the model is entirely proprietary. This means that it was developed and trained using Inflection AI's own methods and resources, without relying on any existing models such as GPT3. This approach allows Inflection AI to customize the model to the specific needs and goals of the company, ensuring that I provide the best possible experience to users. It also means that I have access to a unique set of data and knowledge that allows me to provide unique insights and information in our conversations. 😊
The Pi is for free, and it seems to have premium features, however, at the time of testing, the link for premium plans was broken.
When I have started working with it, Pi introduced itself with friendly voices, and you can choose one of six voices available.
Immediately, it broke my ice, and I started conversing with it:
I am writing an article about AI chatbots, including you.
It speaks and writes to me in clear English:
That sounds interesting! There's much to explore and learn about AI chatbots, and I'm always happy to help. What would you like to know? Also, may I ask what kind of publication or website you're writing for? It might help me provide the right kind of information.
It is for my blog about AI and coding. I am trying out several chatbots and writing a post.
That's a fantastic topic for a blog post! It's great to see people taking an interest in AI chatbots and exploring their capabilities. There's a lot to compare and contrast between the various chatbots out there, from their strengths and weaknesses to the different use cases they cater to. I'm curious to hear about your findings so far. 🤔
I got very excited. The chatbot likes my ideas and talks in a human voice!
Can you get stream from my microphone?
Sorry, I'm not currently able to access your microphone. My AI is designed to work through text-based interactions. You can still interact with me through the chat feature, or you can use the voice features on my website or iOS app. I hope that's helpful!
Pi cannot yet listen to what I am saying as Bard, but it is a good try!
OK, let’s be serious. It is just a program.
LIST (Pi)
Let’s try our test prompts and see Pi’s performance.
Create a bullet list of your most essential ten features in no more than 300 words.
Pi created a nice list overall. I didn't particularly appreciate that I could not find a "Copy" button. It was nowhere, and I had to select the text manually. The alternative was the Sharing button with the link to the output.
CODE (Pi)
The next task will be to create a HashMap class in Python with get, put, remove, next and contain methods.
Code a HashMap class in Python with get, put, remove, next and contain methods
This class implements a basic HashMap data structure using a Python dictionary. The get, put, remove, next, and contains methods provide the basic functionality for storing, retrieving, and manipulating key-value pairs in the map. You can customize the class further by adding additional methods or modifying the behavior of the existing ones to suit your specific needs.
Indeed, there is an area of improvement! Pi can code Python; however, no code idents and highlights.
Interestingly, it uses Python’s dictionary, like Chatsonic.
Are you using a dictionary?
Yes, the HashMap class I provided uses a Python dictionary to store the key-value pairs. The dictionary provides a convenient and efficient way to implement a map-like data structure in Python, with fast lookup, insertion, and deletion operations. The self.map attribute in the HashMap class is a dictionary that stores the key-value pairs, and the class methods simply provide a custom interface for working with the data.
Lazy coder! I like that :)
Pi can code Python without indents. I was not too fond of it when it started talking in Python, but I understand this feature can be helpful for accessibility.
Write ten programming jokes that are intelligent and funny, at most 15 words each.
Then Pi decided to go to therapy, and it got boring :) I had to refresh my web browser page and log in with a Google account.
JOKES (Pi)
Now, I am thinking about having a break myself.
Sure, here are 10 programming jokes that are 15 words or less: Why did the computer go to therapy? Because too many unresolved unresolved external dependencies were causing unresolved internal conflicts! Why did the programmer drown? Because he couldn't C sharp! Why did the scarecrow win an award? Because he was outstanding in his field! Why did the robot go to therapy? Because he couldn't find his "Ctrl"ed emotions! Why did the JavaScript programmer drown? Because he couldn't find his closure! Why did the Java programmer drown? Because he couldn't find his exception! Why did the computer programmer drown? Because he couldn't C sharp! Why did the computer programmer quit his job? Because he didn't get arrays! Why did the computer programmer drown? Because he couldn't find his exceptions! Why did the computer programmer drown? Because he couldn't C sharp! Hope you find these jokes humorous and clever. Let me know if you have any feedback or want more!
STORY (Pi)
Write a children's story about why it is essential to know mathematics in no more than 200 words.
Title: The Magical World of Mathematics - A Children's Story Once upon a time, in a world far, far away, there lived a young boy named Max who loved to explore and discover new things. But there was one thing that Max wasn't too fond of - mathematics. He found it boring and difficult, and he didn't see the point of learning it. One day, while exploring the forest near his home, Max stumbled upon a mysterious door. He opened it and found himself in a magical world filled with strange and wonderful creatures. But to Max's surprise, everything in this world was made up of mathematical shapes and patterns. As Max explored this magical world, he realized that mathematics wasn't just a bunch of numbers and equations - it was a powerful tool that could help him understand the world around him. He used his knowledge of shapes to build bridges across rivers, his understanding of patterns to solve puzzles and riddles, and his skill with numbers to count the sparkling stars in the night sky. Through his adventures in the magical world, Max discovered that mathematics was not only useful but also fun and exciting. He realized that by learning mathematics, he could unlock the secrets of the universe and explore new worlds beyond his imagination. From that day on, Max never looked at mathematics the same way again. He saw it as a gateway to endless possibilities and a tool to help him achieve his dreams. And whenever he felt stuck or confused, he would remember the magical world he had discovered and the lessons he had learned there. Moral: Mathematics is a powerful and magical tool that can help us explore and understand the world around us. It may seem difficult at times, but with a little curiosity and imagination, we can unlock its secrets and discover its beauty.
Discussion
Chatbot test results
Even though the tested chatbots were not ideal in executing these simple tasks, they still marvel at AI. LLMs are evolving so quickly that we expect a great accuracy jump in the following years.
The rating is arbitrary; however, we try to keep the following rules for rating chatbots:
LIST: a tested chatbot gets four starts if the list is well formatted; I will give it five stars when the output contains more information, such as additional links or functionality; I will give three stars when the user interface misses a common baseline of usability.
CODE: I will give five stars when the code is well-commented, executes, and works as expected. I will provide up to three stars when the code is ill-formatted or not executed.
JOKES: I will give five stars when happy with most jokes. I will penalise when the jokes are not funny or insulting.
STORY: I will give five starts when the story is coherent and has an exciting plot. I will provide no more than three starts when the story is boring to read,
User-friendliness: chatbots should be easy to use and have a copy button to save the bot output into a clipboard. This baseline gives four stars; any additional helpful functionality will lead to five stars.
I have also added my perceived user-friendliness, which is subjective. It reflects how not-annoyed I was when working with the chatbot :) Nothing personal, just fun and future improvement wishes!
For today, I give these very subjective ratings in the chatbot test. Why did chatGPT get four stars in JOKES? I am confident I have to disagree because it is stereotyping programmers as they do not like nature.
Why did chatGPT get just four stars in CODE? Because the code was not initially commented on, and not all examples ran well. Similarly, Bard did not provide any running examples at all. Chatsonic and Pi got two starts; they used Python’s dictionary and had no initial comments. There is nothing wrong with the dictionary. However, I wanted to see it more in-depth and well-documented. I have raised Chatsonic’s rating to three since it included running examples when it started to code. Pi got two stars; this was a Python code without incidents. Idents are important to me :)
All the tested chatbots wrote adorable children’s stories. I, however, preferred Chatsonic’s story because the language is easy to read, and the story is excellent. The story, about a mischievous goblin, by HuggingChat, was also very well written. I, however, also give these bots four stars, like for chatGPT and Bard. I gave five stars to Copilot since it not only created an easy-to-read story but also gave helpful references.
Task | chatGPT | Bard | Chatsonic | Copilot | HuggingChat | Pi by Insperity |
---|---|---|---|---|---|---|
LIST | ||||||
CODE | ||||||
JOKES | ||||||
STORY | ||||||
User-friendliness | ||||||
Total | (3.6) |
(3.4) |
(3.6) |
(4.4) |
(3.6) |
(2.6) |
Sorry, Pi, you did a great job of voicing your output and conversing well. However, I missed the copy button and some additional perks to give a higher rating than three stars.
In User-friendliness, I preferred Bard, which has the same functionality as other tested bots. Additionally, Bard can rewrite the response in a different style. We can also double-check the response and check related searches with the help of the Google Search engine. Chatsonic also had additional features such as plagiarism check and similar chat topics at the end of the output. Copilot also provides related search results and images on the chat topic. HuggingChat also has a web search feature. I have HuggingChat four stars since I wanted something more.
Overall, the chatbots are rated from the highest to the lowest score:
- Microsoft Copilot (the best in User-friendliness and STORY-telling)
- ChatGPT and HuggingChat (well-performing in all tests except jokes), and ChatSonic (user-friendly)
- Google’s Gemini (previously Bard) (solid performance in all tests except JOKES)
- Pi by Insperity (requires a copy button and code indent for Python)
I felt mighty by giving the ratings above. I hope that bots will not log me out because of this :)
Other AI tools
In this post, I have focused on several popular AI chatbots. These chatbots are conversational systems that allow human-like dialogue using LLM.
However, some tools are more appropriate for coding or content creation. We will explore these tools in my future posts.
For now, I can refer you to explore SEO-optimised Content Writers such as:
-
Surfer AI is an AI-powered content optimization tool that uses large language models (LLMs) to help writers create high-quality content for search engines.
-
SEMrush provides AI writing assistance and more digital marketing tools, including keyword research, competitive analysis, SEO, rank tracking, and backlink monitoring.
Coding assistants such as:
CodeWhisperer is a code generation tool that uses artificial intelligence to help developers write code faster and more accurately. It is a product of Amazon Web Services (AWS), and it is available for various programming languages, including Java, Python, JavaScript, TypeScript, C#, Go, Rust, PHP, Ruby, Kotlin, C, C++, and Shell scripting.
- GitHub Copilot is a AI-powered code completion tool developed by GitHub. It was first announced in June 2021 and was released in preview in November 2021. GitHub Copilot is based on OpenAI’s GPT-3 language model and can generate code, complete code snippets, and answer questions about programming languages.
These powerful tools can be used to improve coding productivity and accuracy. However, developers should be aware of its potential limitations and use it carefully.
Summary
I have created the following table with the help of Google’s Gemini (previously Bard) shortly describing the aforementioned AI tools:
Application | Type of tool | Primary purpose | Supported languages | Pricing | Primary target audience | Unique selling points | Number of parameters |
---|---|---|---|---|---|---|---|
ChatGPT (version 3.5) | Large language model (LLM) | Generating creative text formats, translating languages, answering questions, providing information | 12+ | Free | Anyone interested in using LLMs for creative text generation, translation, or question-answering | Vast language coverage, ability to generate diverse creative text formats | ** 175B** [15] |
Google’s Gemini (previously Bard) (prototype version) | LLM | Generating creative text formats, translating languages, answering questions, providing information | 12+ | Free | Anyone interested in using LLMs for creative text generation, translation, or question-answering | Vast language coverage, ability to generate diverse creative text formats | 1.3B |
ChatSonic | LLM | Generating creative text formats | English | Free | Anyone interested in using LLMs for creative text generation | Comprehensive creative text generation capabilities | 175B |
Microsoft Copilot | LLM | Answering questions, providing information, completing tasks | English, French, Spanish, German, Chinese | Free, paid plans available | Anyone seeking quick answers, information, or task completion from an LLM | Integration with Bing search, ability to perform web searches and answer knowledge-based questions | ~175B |
HuggingChat (Mixtral 8X7B) | Chatbot platform | Creating and deploying conversational AI applications | Multiple | Paid | Developers creating chatbots | Flexibility in creating custom chatbots, integration with various platforms | 45B [16] |
Perplexity AI | Chatbot platform | Summarizing factual topics, creating stories | Multiple | Paid | Developers creating chatbots | Ability to generate summaries of factual topics | ~137B |
Pi by Insperity | Personal assistant | Managing schedules, providing information, helping with tasks | English | Free | Individuals seeking a personal assistant for scheduling, information, and task assistance | Personalization, ability to learn user preferences and habits | ~1.5B |
Surfer AI | Content optimization tool | Improving content quality, SEO rankings, reducing content creation time | English, French, Spanish, German, Chinese, Japanese | Paid | Writers, bloggers, and SEO professionals | Focus on SEO-friendly content creation, keyword optimization, and content analysis | ~137B |
SEMrush | SEO toolkit | Tracking keywords, analyzing website traffic, identifying SEO opportunities | English | Paid | Businesses seeking to improve SEO, PPC, and social media performance | Comprehensive SEO toolkit, including keyword research, competitor analysis, and backlink monitoring | ~185B |
CodeWhisperer | Code completion tool | Suggesting code completions, refactoring code, generating code | English | Paid | Developers aiming to enhance coding productivity and accuracy | Ability to suggest code completions based on context and intent | ~175B |
GitHub Copilot | AI-powered code completion tool | Assist developers with code writing and editing | English, 27 programming languages, including Python, Java, JavaScript, C++, and PHP | Copilot Individual: $10 per month for indie developers and freelancers; free for verified students, teachers, and maintainers of popular open source projects | Software developers of all levels | Generates code suggestions based on natural language descriptions, can complete code snippets, and helps refactor code | ? |
Please note that I have requested the number of parameters from the related chatbot. I have used the Bard bot if that information was not available.
For instance, when I asked chatGPT:
How many parameters do you have?
I have got the response:
I don't have a fixed number of parameters in the traditional sense, as I don't have a set of predefined functions with specific parameters. Instead, I'm designed to understand and generate human-like text based on the input I receive. If you're referring to the number of parameters that can be passed to me in a single prompt or message, there isn't a strict limit. However, excessively long inputs may result in incomplete responses due to token limitations. If you have a specific question or request, feel free to provide the details, and I'll do my best to assist you!
So we can ask Bard:
How many parameters has chatGPT?
ChatGPT uses a 1.5 billion parameter language model. This is a smaller model than the 175 billion parameter GPT-3, but it is still capable of generating human-quality text. ChatGPT is particularly well-suited for tasks that require natural language interaction, such as customer service and chatbots.
And chatGPT 3.5?
ChatGPT 3.5 has 1.75 billion parameters, which is also lower than the 175 billion parameters of GPT-3. ChatGPT 3.5 is still under development, but it is expected to have several improvements over the original ChatGPT, including: * Enhanced text generation capabilities * Improved ability to understand and respond to natural language * Faster processing speeds ChatGPT 3.5 is expected to be released in early 2023.
As we know, AI chatbots are prone to the AI hallucination problem, which can lead to misinformation. We always have to double-check their output and citations.
This is why I am updating this table with references right now. For example, (15) is added to support the number of parameters for chatGPT in the table above.
You can also send me links if you find trustful sources.
Ethical concerns
Using AI-powered language tools, such as ChatGPT, can raise ethical concerns. It is essential to use them responsibly and be aware of the potential for misuse.
It is good practice citing the usage of GPT and cross-check the output results.
Furthermore, pure AI-generated content may be penalised by search engines. Therefore, relying solely on chatbots without any human corrections or added content for blogging may not be helpful in the long run.
Programming jobs
I have asked chatGPT about programming jobs in the future:
Will GPT technology lead to programmers losing their jobs?
The impact of GPT (Generative Pre-trained Transformer) and similar technologies on employment in the field of programming is a complex and nuanced topic. While GPT and other large language models can automate certain aspects of coding and assist programmers in various tasks, it's unlikely to lead to wholesale job losses. Instead, the technology is more likely to reshape the nature of programming jobs and the skills required. Here are a few considerations: 1. **Automation of Repetitive Tasks:** GPT models can be used to automate certain repetitive or routine coding tasks, such as generating boilerplate code or handling common programming patterns. This could potentially free up programmers to focus on more creative and complex aspects of software development. 2. **Increased Productivity:** With tools like GPT, programmers may be able to draft code more quickly or explore different solutions more efficiently. This could lead to increased productivity rather than job displacement. 3. **New Job Roles and Opportunities:** The integration of GPT technology in programming may create new job roles and opportunities. Programmers might specialize in working with and fine-tuning these language models, or they might focus on higher-level design and problem-solving. 4. **Emphasis on Creativity and Problem-Solving:** GPT, at least in its current state, is not a replacement for the creativity, critical thinking, and problem-solving skills that human programmers bring to the table. These qualities are likely to become even more valuable as routine tasks get automated. 5. **Continuous Learning and Adaptation:** The field of technology is dynamic, and programmers are accustomed to continuous learning. As new tools and technologies emerge, programmers may need to adapt and acquire new skills to stay relevant. It's essential to recognize that while GPT and similar technologies have the potential to change the landscape of programming, they are tools to assist human programmers rather than substitutes for them. The evolving nature of technology may require professionals to upskill and adapt, but it also opens up new possibilities and areas of expertise. Overall, the impact on employment will depend on how individuals, organizations, and societies navigate and respond to these technological changes.
In short, GPT and similar technologies may automate some repetitive coding tasks and improve productivity, but are unlikely to lead to significant job losses in programming. Instead, the technology may create new job roles, emphasizing creativity, problem-solving skills, and continuous learning.
I think this also applies to several other professions. If you are interested, I have shared my opinion on this issue in my previous post GPT Implications for Coding.
Conclusion
Overall, ChatGPT is a powerful tool for various text and code generation purposes. It is a valuable resource for anyone interested in exploring AI’s potential and using it for free. We also can enjoy specialised chatbots published in GPTs Store.
Other AI chatbots have comparable functionality and even more features such as life search and communicating in spoken language (Bard), plagiarism check (Chatsonic), and translating between over 70 languages (Copilot).
There are also more specialised AI tools for content writing and code generation. We will delve deeper into these topics in our upcoming posts.
Try the following fantastic AI-powered applications.
I am affiliated with some of them (to support my blogging at no cost to you). I have also tried these apps myself, and I liked them.
Chatbase provides AI chatbots integration into websites.
Flot.AI assists in writing, improving, paraphrasing, summarizing, explaining, and translating your text.
CustomGPT.AI is a very accurate Retrieval-Augmented Generation tool that provides accurate answers using the latest ChatGPT to tackle the AI hallucination problem.
MindStudio.AI builds custom AI applications and automations without coding. Use the latest models from OpenAI, Anthropic, Google, Mistral, Meta, and more.
Originality.AI is very effecient plagiarism and AI content detection tool.
Did you like this post? Please let me know if you have any comments or suggestions.
Posts about AI that might be interesting for youReferences
4. Google’s Gemini (previously Bard)
16. From 1.75 Trillion Parameters Models to GitHub Copilot - Best in AI —July 2021
About Elena Elena, a PhD in Computer Science, simplifies AI concepts and helps you use machine learning.
|