Besides reading this guide on how to implement the API for blog writing we recommend you to have a look at our article about long-form and blog writing is hard that's why we take away 70% of your work with TextCortex.
Starting to generate unique and creative blog articles programmatically with our API is pretty simple. Just instruct the title of the blog post you want to generate together with the keywords that are important. For example:
Blog Title: 'Why SEO is important for your Business?'
Keywords: 'SEO', 'Business'
If you are using TextCortex python library, you can generate blog articles with 3 lines of code:
from textcortex import TextCortex
hemingwai = TextCortex(api_key='YOUR_API_KEY')
blog = hemingwai.generate_blog(blog_title='Why SEO is important for your Business?', blog_categories=['SEO', 'Business'],
source_language='en', character_count=400, creativity=0.7, n_gen=2)
for row in product_description:
print(row)
Here is how the post request looks like using TextCortex JS library:
import { TextCortex } from "textcortex-hemingwai-js";
const hemingwai = new TextCortex(YOUR_API_KEY);
hemingwai
.generateBlog({
blog_title: "Why SEO is important for your Business?",
blog_categories: ["SEO", "Business"],
character_count: 300,
creativity: 0.5,
source_language: "en",
n_gen: 2,
})
.then((res) => {
console.log("res: ", res);
})
.catch((err) => {
console.log("err", err);
});
Here is how the post request looks like using Axios NodeJS library:
var axios = require('axios');
var data = JSON.stringify({
"prompt": "Why SEO is important for your Business?",
"parameters": "'SEO', 'Business'",
"character_count": 400,
"source_language": "en",
"category": "Blog Body",
"temperature": 0.7,
"n_gen": 5,
"api_key": "YOUR_API_KEY"
});
var config = {
method: 'post',
url: 'https://api.textcortex.com/hemingwai/generate_text',
headers: {
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Text generation variables:
As you can see, there are some parameters that you can use to fine-tune the generated content. Here is the list of those parameters and what they do:
- prompt: Prompting is a way to instruct the Enterprise API to start writing on a specific subject
- parameters: Used for setting the tone of the generated copy text. It can be basically anything but please keep it plausible :)
- category: This defines which type of content needs to be generated.
- creativity: Floating number between 0-1. 0 being the lowest creativity and 1 being the highest. Default is 0.7
- character_length: Integer which defines the maximum amount of characters that can be produced.
- source_language: Language code of the source language of the written prompt. for example 'en' for English and 'de' for German. We support 72 languages. If you don't know the language code you can also use 'auto' for this field our system will recognize the language of the instructed prompt and follow through with it in its generation.
Pro advice:
As mentioned in the beginning of the article we recommend reading the long-form and blog writing is hard that's why we take away 70% of your work with TextCortex article.
1) Give clear instructions.
If you ever feel disappointed by the text our AI writers have written for you, ask yourself:
- What might be the pattern which the AI writers are following?
- Was my instruction unclear? Ask yourself would my friend understand the assignment?
- Did I leave out information that I wanted to have in there?
- Did I limit the creativity of the AI writers too much so they don’t dare to do something different?
Often, you can do the following:
- Does the creation look like a list of items? Were my instructions a list and it is just building on top of it?
- Try to change the instructions to something with more context.
- Add more information with the fitting context into your instructions
Learn more about how our AI writers think and work here!
2) Divide & Conquer
Like with so many big problems it helps to divide the task into smaller bite-sized pieces.
So instead of expecting a 2000 word article right from the start, you can start with smaller problems. Think about it an article is often consisting of an intro, the main part, and a conclusion.
Think about a content brief before starting to create.
For example, if you want want to write a blog about "how SEO helps businesses grow organically" and in the best you want around 2000 words this is quite big of a task. Divide & conquer the challenge and break it down.
-
Intro: Why is SEO important for businesses?
-> POST request
-
Main part: How can you improve SEO with text content?
-> POST request
-
Conclusion: What is the first step to get into SEO?
-> POST request
Then bundle the responses together into a bigger piece of text content.