How to Use OpenAI's ChatGPT For Text Completion And Code Completion

TL;DR With OpenAI making their Research Release public, we thought it was time for us to explain the power of OpenAI's ChatGPT. At Three Ventures our OpenAI Consultants have been Beta testing with OpenAI for over a year, and have seen the power of OpenAI's APIs which are what support ChatGPT, DALL E 2, and Whisper. We've played with these tools and we see the toolset as becoming crucial for employees to do more work in less time.

Curtis morte
Head of Development & Co-Founder
Let's Talk ChatGPT & OpenAI
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Contact form success icon

Thank you for getting in touch!

We will get back to you as soon as possible
(usually within one work day).

Table of Contents -

What is ChatGPT?

ChatGPT is a machine learning model that OpenAI trained which allows you to interact with the model in a conversational way. GPT stands for "Generative Pre-trained Transformer", and there are very powerful models currently available (3.5 and 4.0). The model has been trained using a massive amount of data from the internet (content from June 2021 and earlier as of January 1st 2023) and is purpose built to handle a variety of language tasks which include translation, summarization, question answering, and text generation. OpenAI released their Research Release which allows the public to play with ChatGPT for free. So if you're looking to try the tool out, you can use it now before you have to pay for access. Be sure to take a look at the usage policies before you start asking ChatGPT questions, as you can get your account suspended for breaking the rules. The rules are enforced, and it's really important to the OpenAI team that they preserve the integrity of the reward model.

There are some limitations of the tool, so it's important that we call those out before continuing:

  1. Some answers sound plausible, but are incorrect or nonsensical.
  2. The questions you ask are sensitive to tweaks. So some questions may produce the correct answer, and other questions may not produce an answer.
  3. Answers can be overly verbose.
  4. The model tends to guess on certain parts of a question when the user asks an ambiguous question.
  5. Harmful or biased behavior may occur with the tool.

Remember, the model powering ChatGPT was trained using a large amount of data from the internet (up until June 2021). This data was created by all of the humans in the world who have contributed and disbursed content on the web. Therefore it's plausible and probable that some of the limitation scenarios above can occur.

What Does This Article Cover?

This article will cover the following topics:

  1. How to Generate Content with ChatGPT
  2. How to Generate, Edit, and Explain Code With ChatGPT
  3. How to Have Your Employees Complete More Work in Less Time With ChatGPT
  4. How to Integrate and Train GPT Models For Your Business.

For those of you that are curious about the technology, the first 2-3 topics will be of the most interest. For business owners, entrepreneurs, and the like looking to leverage this technology, the first 3 sections will spark your curiosity with the the last topic being how you can take action.

How to Generate Content With ChatGPT

ChatGPT generates natural language based on user input. In short, you can instruct ChatGPT to generate content for you by giving it very specific input. You could say something like "Create an interesting title for a blog post about HubSpot's Operations Hub" and the tool will output something like:

  • Streamlining Your Business Operations with HubSpot's Operations Hub
  • Revolutionizing Your Workflow with HubSpot's Operations Hub
  • Maximizing Efficiency with HubSpot's Operations Hub
  • The Ultimate Solution for Your Business Operations: HubSpot's Operations Hub
  • Elevate Your Operations with HubSpot's Operations Hub

Yes, we used ChatGPT to generate these and those were what we received as inputs on the first reply. Try it out for yourself here.

It's obvious why marketers, copywriters, and other people responsible for producing content are raving about this! They see it as a tool for them to essentially automate a large part of their job by being strategic about what they ask ChatGPT to do for them. Essentially, they can instruct ChatGPT on what they need to do and have ChatGPT do the heavy lifting. This sounds great, and is great, but should be used with precautions that we will discuss later.

There is a lot more that you can do to generate content. The ideas here are pretty limitless, yet the general concept is the same. Ask a question, get an answer. Refine your question to produce a better answer. Ask a related question to adjust the answer to your specific needs (ex: can you put this list into a table?). So let's try this with our previous question. I asked ChatGPT to "Use option 1 and outline what parts of Operations Hub should be streamlined". The response is below:

HubSpot's Operations Hub is a powerful tool that can help businesses streamline and optimize their operations. Some areas where Operations Hub can be particularly useful for streamlining include:

  1. Workflow automation: Operations Hub allows businesses to automate repetitive tasks and processes, freeing up time and resources for more important tasks.
  2. Task management: The platform's built-in task management features help businesses stay organized and on top of their to-do lists.
  3. Customer service: Operations Hub includes a range of customer service tools, including a shared team inbox, live chat, and a knowledge base, making it easier for businesses to manage and respond to customer inquiries.
  4. Data analysis: Operations Hub includes powerful analytics and reporting tools that help businesses track their performance and identify areas for improvement.
  5. Collaboration: Operations Hub allows teams to collaborate in real-time, making it easier for businesses to stay aligned and work together effectively.
Overall, Operations Hub is a valuable tool for streamlining and optimizing business operations, helping businesses save time and resources and improve their overall efficiency.

That wasn't bad. The response was missing some key context around HubSpot's Operations Hub, specifically about the ability to sync, clean, and curate customer data. So when I asked ChatGPT to "Remove the bullet about "Customer service" and replace it with information about syncing, cleaning, and curating customer data.", the answer was updated to use the following:

  1. ...
  2. ...
  3. Customer data management: Operations Hub includes features for syncing, cleaning, and curating customer data, helping businesses maintain accurate and up-to-date records of their customers.
  4. ...
  5. ...

This allowed me to use my platform specific knowledge about HubSpot to help the tool answer my question in a way that met my expectations for what I was looking for.

How to Generate, Edit, and Explain Code With ChatGPT

ChatGPT can also generate, edit, and explain code. Yes you read that right - generate, edit, and explain. You can ask ChatGPT to create a code snippet for you, using plain english. If you don't like the snippet, you can ask to modify the code. You can also take code that you're having a problem with, and ask ChatGPT to find the error for you.

Generating Code With ChatGPT

ChatGPT takes user input, like "Make a GET request to a weather API that outputs the current weather for Roseville, California to a div with ID currentWeather" and gives you a code snippet output along with an explanation. The tool responds back to you in a manner that feels like a personalized blog post where you can read how the tool generated your code. The following output was produced when we asked ChatGPT the aforementioned question:

To make a GET request to a weather API and output the current weather for Roseville, California to a div with ID currentWeather, you can use the fetch function in JavaScript.

Here's an example of how you can do this:
const API_URL = '';

async function getWeather() {
  try {
    const response = await fetch(API_URL);
    const data = await response.json();
  } catch (error) {

In this example, the API_URL variable contains the URL for the weather API with the latitude and longitude for Roseville, California. The getWeather function makes a GET request to the API using the fetch function and parses the response as JSON.

To output the current weather to the div with ID currentWeather, you can use the innerHTML property of the div element. Here's an example of how you can do this:
const weatherDiv = document.getElementById('currentWeather');

weatherDiv.innerHTML = `The current temperature is ${data.temperature}°F and the sky is ${}`;
This will set the HTML content of the currentWeather div to a string containing the current temperature and sky conditions.

Note: You will need to replace your-api-key in the API_URL with your actual API key. You will also need to modify the code to extract the relevant data from the API response, as the structure of the response will depend on the specific weather API you are using.

Editing Code With ChatGPT

You can get more specific with your code generation requests, like asking to use the Axios library instead of async await. As someone who has spent the last decade in software development and architecture, I know that the initial code output wasn't quite what I would want for a production specific implementation. So modifying my results by asking ChatGPT "How can I make the request using the axios library?" and then asking ChatGPT "Can you make the request without async await?". In doing this, I was able to get to a meaningful snippet of code that seems usable in the way that I would want.

import axios from 'axios';

const API_URL = '';

function getWeather() {
    .then(response => {
      const data =;
    .catch(error => {


This is the true power of ChatGPT out of the box in the Research Release. It allows people who have specific skillsets, domain expertise, or business specific understanding to help guide the tool in a way that gets a meaningful response. You might be wondering if there is a way you can train ChatGPT to produce initial answers that are tailored towards your specific use cases? There is a way to train ChatGPT to produce meaningful responses quickly, but this requires a more technical approach to train a model that is specific to your businesses needs. More on this to come in the following sections.

How to Explain Code With ChatGPT

This is one of our favorite parts of ChatGPT as it allows the tool to provide feedback to you based on code you have written. Take for example the following code snippet.

const values = [1, 2, 3, 4, 5];
    console.log('6 was not found');

When we asked ChatGPT the following:

Why does the message never get logged to the console?

const values = [1, 2, 3, 4, 5];
console.log('6 was not found');

It responded back to us with:

The message "6 was not found" is not being logged to the console because the condition in the if statement is always evaluating to true.

The indexOf method returns the index of the first occurrence of a given element in an array, or -1 if the element is not present in the array.

In the code you provided, the indexOf method is being called on the values array with the argument 6. Since 6 is not present in the array, the indexOf method will return -1.

The condition in the if statement is evaluating the result of indexOf as a boolean value. In JavaScript, any value that is not null, undefined, 0, or an empty string is considered truthy. Therefore, the value -1 is considered truthy, and the condition in the if statement will always be true.

To fix this issue, you can explicitly check for the value -1:
const values = [1, 2, 3, 4, 5];
if(values.indexOf(6) === -1){
    console.log('6 was not found');
This will log the message "6 was not found" to the console when the value 6 is not present in the values array.

This is very powerful because it can allow for a few different scenarios to take place:

  • People who are learning to program, but aren't developers, can get help with their code without needing to talk to a developer (which takes the developers time).
  • Developers who are running into an issue, and need a second set of eyes can rely on ChatGPT to help them when no one else is available (think about geographically dispersed teams across timezones).
  • Developers who need help optimizing their code can quickly instruct ChatGPT to make their code better. This provides benefits for the application (it runs faster) and the developer who is learning how to write better code from the onset of development (think of junior developers or those fresh out of college / code bootcamp). It's like having a senior developer in your back pocket all the time.

How to Have Your Employees Complete More Work in Less Time With ChatGPT

The key attraction of ChatGPT is the tool allows us to do more in less time. The ability to reduce the amount of time marketers, copywriters, developers and the like spend to complete tasks is valuable to any business. You'll be able to do more with your existing teams, or not need as much help to run your business. Here are some use cases per skillset that ChatGPT can be used for.

What are some ways marketers save time using ChatGPT?

  • Content Generation. Marketers can get help writing blog posts, articles, social media updates and more.
  • Social Media Management. Marketers can get help generating updates, responding to customers, and handling interactions from customers.
  • Summarization. Marketers can get the key topics from long form content. This could be to learn, provide updates to customers / clients, etc.
  • Translation. Marketers could translate content into other languages to reach wider audiences.

This enables marketers to produce content quickly, get past creative block, automate mundane tasks, free up their time and more. We really see a lot of marketers responsibilities being affected in some way by ChatGPT. We think that the most success for marketers will come in the form being an expert at using ChatGPT and also training a model that is specific to your marketing needs.

What are some ways copywriters save time using ChatGPT?

  • Research. Copywriters can gather and summarize information. This can be used to get key points needed for writing.
  • Brainstorming. Copywriters can generate slogans, headlines, and more.
  • Content Generation. Copywriters can get help writing blog posts, articles, social media updates and more.
  • Editing & Proof Reading.

This enables copywriters to research and brainstorm in a fraction of the time it used to take, generate content, and get help polishing their words into a finished piece of content. This definitely frees up copywriters time, and may actually mean that those who aren't copy writers (like developers) can actually start to produce content. We see this as a shift in how copywriting is done, where those who have the specific domain expertise could actually end up producing the necessary copy content in a minimal amount of time. Thus, removing the need for a specific position that is solely focused on copywriting.

What are some ways developers save time using ChatGPT?

  • Generation of code. Developers can generate code for simple / routine tasks, create boilerplate, generate basic models, etc.
  • Debugging of code. Developers (especially junior developers) can get help with a specific error they are facing.
  • Converting code to a different language. Developers can get a snippet of code converted to another language, say JavaScript to Python; useful for serverless functions and code rebases.
  • Summarization. Developers can quickly get the important topics from long-form technical documentation.
  • Testing. Developers can generate test cases and scenarios to test their code bases.

This enables developers to speed up the course of development because they can generate code stubs, get help debugging, and automate test creation and documentation. Developers will mostly focus on complex business logic, which is the most valuable to any organization creating software because it's bespoke to their needs. We see this as a shift in how developers will spend their time. They can focus on working with designers, product teams, management and others to understand the whole picture on how the software / applications can delight customers / users.

What do we want you to take away from all of this?

ChatGPT and other AI language models can be incredibly helpful tools. However, the tools should be used as part of a larger strategy where employees are still guiding the human judgement and creativity. Like we have shown in our previous topics, if you have specific skillsets and domain expertise, you can help mold the responses into usable content by consistently refining your questions.

Be wary of employees in your organization who start to become super producers overnight. They might be using the technology, but are they being discipline and diligent in being a shepherd of the tool?

How to Integrate and Train GPT Models For Your Business

If you're looking to integrate or train the GPT models, it's important to know all of the features, models and how it works. Features include text generation, code generation, and image generation (not covered in this article). Features can be integrated into your applications using the various libraries that are available. At the time of writing this article, Python and Node.js are the two supported libraries from OpenAI and there are community editions for other languages as well.

The primary difference between something like OpenAI's Research Release and your ability to integrate the GPT model selected into your applications are how the inputs are collected and fine tuning of the model. Collecting inputs can be from your users, user's actions, automation, or anything else really. Fine tuning lets you get more out of the models available in the APIs by providing higher quality results, ability to train on more examples, optimize costs by using shorter prompts, and having lower latency requests. In short, when you make the model aware of your specific use cases, data, and needs, you're able to reduce costs and get correct answers/responses in less time.

Fine tuning, as described by OpenAI for brevity, can be done by:

At a high level, fine-tuning involves the following steps:
  1. Prepare and upload training data
  2. Train a new fine-tuned model
  3. Use your fine-tuned model
Visit our pricing page to learn more about how fine-tuned model training and usage are billed.

While the Research Release is free to use (as of January 2023), the OpenAI APIs are not free and require you to pay for access. Billing is based on usage, and you buy tokens which are consumed when you ask an API for information. From OpenAI's site:

You can think of tokens as pieces of words used for natural language processing. For English text, 1 token is approximately 4 characters or 0.75 words. As a point of reference, the collected works of Shakespeare are about 900,000 words or 1.2M tokens.

As a pricing example, if we take one of our inputs from the code generation section:

Why does the message never get logged to the console?

const values = [1, 2, 3, 4, 5];
console.log('6 was not found');

This would be 52 tokens, which is approximately 145 characters. Now while this is less than 4 characters per token on average, you can see how the tokens were broken down by color:

You can use the Tokenizer to understand how text would be billed against your account. At the time of writing this (January 2023), the cost to use the Davinci model (the most powerful version of GPT-3) for the text above would be $0.00624 (52 tokens / 1000 tokens = .052 * $0.12 = $0.00624). Note that the cost per 1000 tokens in Davinci is $0.12.

If you're looking to leverage OpenAI for your business, and would like to work with a team of AI consultants experienced with the technology since it's initial beta release in 2021 (Pre-chatGPT), please reach out to us. We can help you understand how to leverage the technology, implement the technology, or educate your teams about our experiences + successes with ChatGPT and their models.

About the author

Curtis morte

Curtis Morte

Head of Development & Co-Founder

Passionate about Full Stack Development, DevOps, and Solutions Architecture in the Cloud. Lover of efficient algorithms and most things JavaScript.

See other posts from Curtis Chat with the author on LinkedIn

Contact Us

Our Clients Turn Customer Data Into Dollars.