Why You Should Start Using AI as Soon as Possible

Many years from now, when people recall 2023, they might only remember it as the year ChatGPT and various large language models were born - the first year of artificial intelligence!

You must start using ChatGPT and other large language models as soon as possible

Read More

Unexpected C++ String Modification Caused by COW (Copy-On-Write)

Recently, a colleague encountered a strange problem where in C++, after copying a string and modifying the copy’s content, the original value was also changed. For those not very familiar with C++, this seems a bit “spooky”. In this article, we’ll discuss this issue in depth, starting from a simple reproduction of the problem, to the underlying principles, and the changes in the C++ standard.

C++ string modification of copy affects original content

Read More

Learning to Write a Python SDK Library for ChatGPT API from OpenAI

After ChatGPT was released, OpenAI open-sourced the Python library openai-python for model invocation. This library is very comprehensive, encapsulating the APIs published by OpenAI, and is also very simple to use.

OpenAI-python library encapsulation

The first version of this library implemented Python abstract classes and invocation methods for parameter encapsulation of various ChatGPT APIs, using the requests and aiohttp libraries to send synchronous or asynchronous HTTP requests. Overall, the external interface is good and easy to use. The overall source code implementation has good logical abstraction, using many advanced Python features, and the code is beautifully written, worth learning from. But essentially, this is still “API boy“ work, more of repetitive manual labor without much technical content.

So, in November 2023, OpenAI began introducing Stainless, eliminating the need to manually write SDK code. Each time, they only need to provide API protocol updates, and then code can be automatically generated, freeing them from repetitive manual labor. Specifically, new code was introduced in Pull 677 and released as the official V1 version.

Read More