When I use the API, an article of 50-100 words takes about 3 minutes. Even if I apply for multiple APIKEYs on one opinai account, it doesn’t help. How can I make my articles faster. Can it be improved if I create multiple opinai accounts?
Multiple API keys will not help with speed. An article about 50-100 words, which is about 400 tokens max should not be taking this long for generation. Can you share you’re API call ? That would make the process easier to debug.
Your speed report is quite abnormal. I would measure the action time of function call to complete in your code were output to be suppressed.
Since streaming replies doesn’t immediately tokens, I instead both count words and the delta chunks of streaming for you with gpt-3.5-turbo:
Prompt of chatbot: “Introduction to ‘ChatMagic AI’ starts conversation.”
31 words/42 chunks in 2.2 seconds
Hello! I’m ChatMagic, an AI assistant. I’m here to help answer your questions, engage in conversation, and assist you with any tasks you may have. How can I assist you today?
Done. 31 words/42 chunks in 2.2 seconds.
Prompt: write a longer introduction to AI features.
350 words/421 chunks in 18.4 seconds.
Certainly! Here’s a longer introduction to AI and its features:
Artificial Intelligence, or AI, is a rapidly advancing field that aims to create intelligent machines capable of performing tasks that typically require human intelligence. These machines are designed to learn, reason, and problem-solve, making them incredibly versatile and valuable in various industries.
One of the key features of AI is its ability to process and analyze vast amounts of data at an unprecedented speed. By leveraging machine learning algorithms, AI systems can identify patterns, extract insights, and make predictions based on the information they have been trained on. This enables businesses to make data-driven decisions, optimize processes, and improve overall efficiency.
Another important aspect of AI is natural language processing (NLP), which allows machines to understand and interact with humans in a more human-like manner. NLP enables AI assistants, like ChatMagic, to comprehend and respond to text or speech inputs, making it easier for users to communicate and receive the information they need.
AI also plays a significant role in automation. By automating repetitive and mundane tasks, AI frees up human resources to focus on more complex and creative endeavors. This not only increases productivity but also enhances job satisfaction and innovation within organizations.
Furthermore, AI has made significant advancements in computer vision, enabling machines to interpret and understand visual information. This has led to breakthroughs in areas such as facial recognition, object detection, and autonomous vehicles, revolutionizing industries like security, healthcare, and transportation.
However, it’s important to note that AI is not without its challenges. Ethical considerations, privacy concerns, and the potential for bias are all areas that require careful attention and regulation as AI continues to evolve.
In summary, AI is a powerful technology that has the potential to transform industries and improve our daily lives. With its ability to process data, understand natural language, automate tasks, and interpret visual information, AI is poised to revolutionize the way we work, communicate, and solve problems. As an AI assistant, I’m here to assist you and provide information on a wide range of topics. How can I help you today?
–
Simple chat completion timed chatbot code
import openai
import time
openai.api_key = key
sys = [{“role”: “system”, “content”: “You are ChatMagic, an AI assistant.”}]
user = [{“role”: “user”, “content”: “Introduction to ChatMagic AI starts conversation.”}]
chat =
while not user[0][‘content’] == “exit”:
st = time.time()
ap = openai.ChatCompletion.create(
messages = sys + chat[-10:] + user,
model=“gpt-3.5-turbo”, temperature=0.1, stream=True)
resp = “”; wc = 0
for d in ap:
if d and not d[‘choices’][0][‘finish_reason’]:
w = d[‘choices’][0][‘delta’][‘content’]
resp += w; wc +=1
print(w, end =“”)
chat += user + [{“role”: “assistant”, “content”: resp}]
en = time.time() - st
print(f"\nDone. {len(resp.split())} words/{wc} chunks in {en:.1f} seconds.")
time.sleep(1)
user = [{“role”: “user”, “content”: input("Prompt: ")}]