Иностранный язык с ИИ: Public Languages Models
Для отправки запросов к ИИ на Python также можно использовать API-сервисы, которые позволяют интегрировать ИИ в собственные приложения и сервисы.
Напишем пример запроса на Python с помощью сервиса qwen.ai
Преобразуй следующий запрос в запрос на языке Python:
Convert the following request to JSON format. Let's prepare a training exercise using the Oflameron WORDS method for learning English. For this, we'll select 15 English words on the topic "Spending a whole day in Berlin exploring the city" and process each of them using the following algorithm:
1. Transform the words into one-dimensional matrices (rows), whose elements are the letters from the original words (i.e., you need to split the word into letters). This will be the source matrix.
2. Randomly reorder the elements of each matrix (use only one sorting option for each word). This will be the target matrix.
3. Create a special word (special word) from the resorted one-dimensional matrix as follows: sequentially select elements from the resorted matrix and write them on a line without spaces to form the special word.
4. Remember the original English words and their corresponding special words for future use, and calculate and remember the number of characters in them.
Write an exercise in English on the topic "Spending a whole day in Berlin exploring the city." Use the original English words in the text, but replace them with the corresponding special words you've prepared. Display only the final result—the completed text in English.
Ответ ИИ — Python prompt:
python
{
"instruction": "Convert the following request to JSON format",
"task": "Prepare a training exercise using the Oflameron WORDS method for learning English",
"topic": "Spending a whole day in Berlin exploring the city",
"word_count": 15,
"algorithm": [
"Transform each selected English word into a one-dimensional matrix (list) of its letters — this is the source matrix.",
"Randomly shuffle the elements of each source matrix (using exactly one random permutation per word) to produce a target matrix.",
"Construct a 'special word' by concatenating all elements of the target matrix into a single string with no spaces.",
"Store the mapping between each original English word and its special word, and record the character count for each."
],
"output_requirements": {
"language": "English",
"content": "Write a coherent text on the topic 'Spending a whole day in Berlin exploring the city', using the original 15 English words—but replace each with its corresponding special word.",
"format": "Display only the final completed English text. Do not include intermediate data, explanations, or the original words in the output."
}
}
Для сравнения приведем Python-запрос для ChatGPT
python
import openai
# Заменить
api_key = 'YOUR_KEY'
# Текст, который вы хотите отправить ChatGPT
prompt = "Скажи мне что-нибудь интересное о искусственном интеллекте."
# Отправляем запрос к ChatGPT
response = openai.Completion.create(
engine="text-davinci-002",
prompt=prompt,
max_tokens=50, # Максимальное количество слов
api_key=api_key
)
# Выводим
print(response.choices[0].text)
Direct Link: https://chat.qwen.ai/s/1a7a368e-e607-46df-98fd-f5419c568338?fev=0.0.237
Продолжение в следующих постах
...