Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Foundation Models
    • All tutorials
    • Disabling request logging
    • Getting an API key
      • Estimating request size in tokens
      • Sending a request in prompt mode
      • Sending a series of requests in chat mode
      • Sending an asynchronous request
      • Invoking a function from a model
    • Batch processing
  • Yandex Cloud ML SDK
  • Compatibility with OpenAI
  • Access management
  • Pricing policy
  • Public materials
  • Release notes

In this article:

  • Getting started
  • Build a chat
  1. Step-by-step guides
  2. Text generation
  3. Sending a series of requests in chat mode

How to build a chat with YandexGPT Lite or YandexGPT Pro

Written by
Yandex Cloud
Updated at April 11, 2025
  • Getting started
  • Build a chat

YandexGPT Lite and YandexGPT Pro models do not retain the context of previous messages, so to have a continuous dialog with a selected model, you need to save the message history on your device and send it each time you are addressing the model. The chat available in the management console consists of multiple prompts where the context of each new text query includes the model's responses to previous ones. The text generation models are subject to context length limits.

Tip

Use AI Assistant API to create a chat with the model. For an example of a chat implemented using assistants and threads, see the Creating a simple assistant guide.

To create a chat with a model in your application and avoid delays in responses, send prompts in synchronous mode using the completion method or Yandex Cloud ML SDK.

Getting startedGetting started

SDK
cURL
Python

To use the examples of requests using SDK:

  1. Create a service account and assign the ai.languageModels.user role to it.

  2. Get the service account API key and save it.

    The following examples use API key authentication. Yandex Cloud ML SDK also supports IAM token and OAuth token authentication. For more information, see Authentication in Yandex Cloud ML SDK.

  3. Use the pip package manager to install the ML SDK library:

    pip install yandex-cloud-ml-sdk
    

Get API authentication credentials as described in Authentication with the Yandex Foundation Models API.

To use the examples, install cURL.

Get API authentication credentials as described in Authentication with the Yandex Foundation Models API.

Build a chatBuild a chat

SDK
cURL
Python
  1. Create a file named create-chat.py and paste the following code into it:

    #!/usr/bin/env python3
    
    from __future__ import annotations
    from yandex_cloud_ml_sdk import YCloudML
    
    messages = [
        {
            "role": "system",
            "text": "You are a smart assistant",
        },
        {
            "role": "user",
            "text": "Hi! What fields of science did Albert Einstein study?",
        },
    ]
    
    def main():
        sdk = YCloudML(
            folder_id="<folder_ID>",
            auth="<API_key>",
        )
    
        result = (
            sdk.models.completions("yandexgpt").configure(temperature=0.6).run(messages)
        )
    
        for alternative in result:
            print(alternative)
    
    if __name__ == "__main__":
        main()
    

    Where:

    Note

    As input data for a request, Yandex Cloud ML SDK can accept a string, a dictionary, an object of the TextMessage class, or an array containing any combination of these data types. For more information, see Yandex Cloud ML SDK usage.

    • messages: List of messages that set the context for the model:

      • role: Message sender's role:

        • user: Used for sending user messages to the model.
        • system: Used to set the query context and define the model's behavior.
        • assistant: Used for responses generated by the model. In chat mode, the model's responses tagged with the assistant role are included in the message to save the conversation context. Do not send user messages with this role.
      • text: Message text.

    • <folder_ID>: ID of the folder in which the service account was created.

    • <API_key>: Service account API key you got earlier required for authentication in the API.

      The following examples use API key authentication. Yandex Cloud ML SDK also supports IAM token and OAuth token authentication. For more information, see Authentication in Yandex Cloud ML SDK.

    For more information about accessing a specific model version, see Accessing models.

  2. Run the created file:

    python3 create-chat.py
    

    Result:

    Alternative(role='assistant', text='Albert Einstein studied **physics** and **mathematics**. His work had a major influence on both fields as well as on theoretical physics in general.', status=<AlternativeStatus.FINAL: 3>)
    
  3. Add the model's response to the previous request and the user's new question to the end of the messages array in the create-chat.py file:

    ...
    messages = [
        {
            "role": "system",
            "text": "You are a smart assistant",
        },
        {
            "role": "user",
            "text": "Hi! What fields of science did Albert Einstein study?",
        },
        {
            "role": "assistant",
            "text": ""”Albert Einstein studied **physics** and **mathematics**. 
    His work had a major influence on both fields 
    as well as on theoretical physics in general.""",
        },
        {
            "role": "user",
            "text": "What important discoveries did he make?",
        },
    ]
    ...
    
  4. Execute the file again:

    python3 create-chat.py
    

    Result:

    Alternative(role='assistant', text='Albert Einstein is one of the greatest scientists of the 20th century. Here are some of his important discoveries:\n* **Special theory of relativity.** Einstein has formulated the special theory of relativity, which describes motion, laws of mechanics, and spatiotemporal relationships at random velocities less than the speed of light in vacuum.\n* **General theory of relativity.** This theory describes gravity as the curvature of space-time and explains many astronomical phenomena, such as gravity waves and black holes.\n* **Photoelectric effect.** For this discovery, Einstein was awarded the Nobel Prize for Physics. His study explains how light can cause the emission of electrons from a material, providing the basis for quantum theory.\n* **Equivalence of mass and energy.** $E=mc^2$ is the most famous equation in science. It explains how mass can be transformed into energy and vice versa.', status=<AlternativeStatus.FINAL: 3>)
    
  5. Continue expanding the request context with the received responses and user questions:

    ...
    messages = [
        {
            "role": "system",
            "text": "You are a smart assistant",
        },
        {
            "role": "user",
            "text": "Hi! What fields of science did Albert Einstein study?",
        },
        {
            "role": "assistant",
            "text": ""”Albert Einstein studied **physics** and **mathematics**. 
    His work had a major influence on both fields 
    as well as on theoretical physics in general.""",
        },
        {
            "role": "user",
            "text": "What important discoveries did he make?",
        },
        {
            "role": "assistant",
            "text": """Albert Einstein is one of the greatest scientists of the 20th century. 
    Here are some of his important discoveries:\n* **Special theory of relativity.** 
    Einstein has formulated the special theory of relativity, which describes motion, 
    laws of mechanics, and spatiotemporal relationships at random velocities 
    less than the speed of light in a vacuum.\n* **General theory of relativity.** 
    This theory describes gravity as a curvature of space-time and explains 
    many astronomical phenomena, such as gravity waves and black holes.\n* 
    **Photoelectric effect.** For this discovery, Einstein was awarded 
    the Nobel Prize for Physics. His study explains how light can cause the emission of electrons 
    from a material, providing the basis for quantum theory.\n* **Equivalence of mass 
    and energy.** $E=mc^2$ is the most famous equation in science. 
    It explains how mass can be transformed into energy and vice versa.""",
        },
        {
            "role": "user",
            "text": "Make it shorter",
        },
    ]
    ...
    

    Result:

    Alternative(role='assistant', text='Albert Einstein is one of the greatest scientists of the 20th century. Here are some of his important discoveries:\n* The **special theory of relativity** describes motion, laws of mechanics, and spatiotemporal relationships at velocities less than the speed of light.\n* The **theory of general relativity** explains gravity as a curvature of space-time.\n* For the discovery of the **photoelectric effect**, Einstein was awarded the Nobel Prize for Physics. His work explains the emission of electrons from a material exposed to light.\n* The $E=mc^2$ equation expresses the **equivalence of mass and energy**.', status=<AlternativeStatus.FINAL: 3>)
    
  1. Prepare a model request file, e.g., body.json:

    {
      "modelUri": "gpt://<folder_ID>/yandexgpt",
      "completionOptions": {
        "stream": false,
        "temperature": 0.6,
        "maxTokens": "2000",
        "reasoningOptions": {
          "mode": "DISABLED"
        }
      },
      "messages": [
        {
          "role": "system",
          "text": "You are a smart assistant"
        },
        {
          "role": "user", 
          "text": "Hi! What fields of science did Albert Einstein study?"
        }
      ]
    }
    

    Where:

    • modelUri: ID of the model that will be used to generate the response. The parameter contains the Yandex Cloud folder ID or the tuned model's ID.

    • completionOptions: Request configuration options:

      • stream: Enables streaming of partially generated text. It can either be true or false.

      • temperature: With a higher temperature, you get more creative and randomized responses from the model. Its values range from 0 to 1, inclusive. The default value is 0.3.

      • maxTokens: Sets a limit on the model's output in tokens. The maximum number of tokens per generation depends on the model. For more information, see Quotas and limits in Yandex Foundation Models.

      • reasoningOptions.mode: Reasoning mode parameters. This is an optional parameter. The default value is DISABLED. The possible values are:

        • DISABLED: Reasoning mode is disabled.
        • ENABLED_HIDDEN: Reasoning mode is enabled. The model will decide by itself whether or not to use this mode for each particular request.
    • messages: List of messages that set the context for the model:

      • role: Message sender's role:

        • user: Used for sending user messages to the model.
        • system: Used to set the query context and define the model's behavior.
        • assistant: Used for responses generated by the model. In chat mode, the model's responses tagged with the assistant role are included in the message to save the conversation context. Do not send user messages with this role.
      • text: Message text.

  2. Send a request to the model:

    export FOLDER_ID=<folder_ID>
    export IAM_TOKEN=<IAM_token>
    curl \
      --request POST \
      --header "Content-Type: application/json" \
      --header "Authorization: Bearer ${IAM_TOKEN}" \
      --header "x-folder-id: ${FOLDER_ID}" \
      --data "@<path_to_JSON_file>" \
      "https://llm.api.cloud.yandex.net/foundationModels/v1/completion"
    

    Where:

    • FOLDER_ID: ID of the folder for which your account has the ai.languageModels.user role or higher.
    • IAM_TOKEN: Your account's IAM token.
  3. In response to your request, the model will return the generated text:

    Result:
    {
      "result": {
        "alternatives": [
          {
            "message": {
              "role": "assistant",
              "text": "Albert Einstein was an outstanding physicist, whose works in theoretical physics, theoretical mechanics, and philosophy of science became fundamental. He dedicated his career to studying the fundamentals of the universe, including the theory of relativity, both special and general. Additionally, Albert Einstein studied:\n\n* thermodynamics,\n* statistical mechanics,\n* electromagnetism,\n* quantum theory,\n* special relativity, and more.\n\nHis general relativity works found wide recognition and had a profound influence on the development of modern physics."
            },
            "status": "ALTERNATIVE_STATUS_FINAL"
          }
        ],
        "usage": {
          "inputTextTokens": "28",
          "completionTokens": "110",
          "totalTokens": "138"
        },
        "modelVersion": "18.01.2024"
      }
    }
    

    Save the message record value for use in subsequent requests.

  4. Add the message record value from the model's response to the previous request and the user's new question to the end of the messages array in the request file:

    {
      "modelUri": "gpt://<folder_ID>/yandexgpt",
      "completionOptions": {
        "stream": false,
        "temperature": 0.6,
        "maxTokens": "2000",
        "reasoningOptions": {
          "mode": "DISABLED"
        }
      },
      "messages": [
        {
          "role": "system",
          "text": "You are a smart assistant"
        },
        {
          "role": "user", 
          "text": "Hi! What fields of science did Albert Einstein study?"
        },
        {
          "role": "assistant", 
          "text": "Albert Einstein was an outstanding physicist, whose works in theoretical physics, theoretical mechanics, and philosophy of science became fundamental. He dedicated his career to studying the fundamentals of the universe, including the theory of relativity, both special and general. Additionally, Albert Einstein studied:\n\n* thermodynamics,\n* statistical mechanics,\n* electromagnetism,\n* quantum theory,\n* special relativity, and more.\n\nHis general relativity works found wide recognition and had a profound influence on the development of modern physics."
        },
        {
          "role": "user", 
          "text": "What important discoveries did he make?"
        }
      ]
    }
    
  5. Send a new request to the model by repeating Step 2 of this guide. In response to your request, the model will again return the generated text:

    Result:
    {
      "result": {
        "alternatives": [
          {
            "message": {
              "role": "assistant",
              "text": Here are some discoveries commonly associated with the name of Albert Einstein:\n1. **Special theory of relativity (STR)**: Theory describing motion, laws of mechanics, and spatiotemporal relationships at random velocities less than the speed of light in a vacuum.\n1. **General theory of relativity (GTR)**: Geometric theory of gravitation based on the prediction of the interrelation between the spacetime, matter, and energy coordinates.\n1. **Quantum theory of the photoelectric effect**: Explanation of the photoelectric effect, a phenomenon of electron emission from matter under the influence of electromagnetic radiation.\n1. **Brownian motion**: Phenomenon of chaotic, random movement of microscopic particles suspended in a liquid or gas, caused by the thermal motion of molecules in the surrounding medium.\n1. **Equivalence principle**: Idea that gravitational and inertial mass are different aspects of the same physical quantity.\n1. **Cosmological solutions of the GTR equations**: Contribution to the theory of the structure and dynamics of the universe.\n1. **Nuclear model of the atom**: Description of the atom structure based on protons, neutrons, and electrons.\nThese are just some of the discoveries made by Albert Einstein. His contributions to science and philosophy are immense, and his research continues to shape our ideas of nature and the universe."
            },
            "status": "ALTERNATIVE_STATUS_FINAL"
          }
        ],
        "usage": {
          "inputTextTokens": "154",
          "completionTokens": "278",
          "totalTokens": "432"
        },
        "modelVersion": "18.01.2024"
      }
    }
    

    Once again, save the message record value for use in subsequent requests.

  6. Continue expanding the request context with the received responses and user questions:

    {
      "modelUri": "gpt://<folder_ID>/yandexgpt",
      "completionOptions": {
        "stream": false,
        "temperature": 0.6,
        "maxTokens": "2000",
        "reasoningOptions": {
          "mode": "DISABLED"
        }
      },
      "messages": [
        {
          "role": "system",
          "text": "You are a smart assistant"
        },
        {
          "role": "user", 
          "text": "Hi! What fields of science did Albert Einstein study?"
        },
        {
          "role": "assistant", 
          "text": "Albert Einstein was an outstanding physicist, whose works in theoretical physics, theoretical mechanics, and philosophy of science became fundamental. He dedicated his career to studying the fundamentals of the universe, including the theory of relativity, both special and general. Additionally, Albert Einstein studied:\n\n* thermodynamics,\n* statistical mechanics,\n* electromagnetism,\n* quantum theory,\n* special relativity, and more.\n\nHis general relativity works found wide recognition and had a profound influence on the development of modern physics."
        },
        {
          "role": "user", 
          "text": "What important discoveries did he make?"
        },
        {
          "role": "assistant",
          "text": Here are some discoveries commonly associated with the name of Albert Einstein:\n1. **Special theory of relativity (STR)**: Theory describing motion, laws of mechanics, and spatiotemporal relationships at random velocities less than the speed of light in a vacuum.\n1. **General theory of relativity (GTR)**: Geometric theory of gravitation based on the prediction of the interrelation between the spacetime, matter, and energy coordinates.\n1. **Quantum theory of the photoelectric effect**: Explanation of the photoelectric effect, a phenomenon of electron emission from matter under the influence of electromagnetic radiation.\n1. **Brownian motion**: Phenomenon of chaotic, random movement of microscopic particles suspended in a liquid or gas, caused by the thermal motion of molecules in the surrounding medium.\n1. **Equivalence principle**: Idea that gravitational and inertial mass are different aspects of the same physical quantity.\n1. **Cosmological solutions of the GTR equations**: Contribution to the theory of the structure and dynamics of the universe.\n1. **Nuclear model of the atom**: Description of the atom structure based on protons, neutrons, and electrons.\nThese are just some of the discoveries made by Albert Einstein. His contributions to science and philosophy are immense, and his research continues to shape our ideas of nature and the universe."
        },
        {
          "role": "user",
          "text": "Give me a shorter response"
        }
      ]
    }
    
    Result:
    {
      "result": {
        "alternatives": [
          {
            "message": {
              "role": "assistant",
              "text": "Albert Einstein was an outstanding physicist who studied the fundamentals of the universe, including the theory of relativity, thermodynamics, and electromagnetism.\n\nSome of his well-known discoveries include the following: special and general theories of relativity, quantum theory of the photoelectric effect, and others."
            },
            "status": "ALTERNATIVE_STATUS_FINAL"
          }
        ],
        "usage": {
          "inputTextTokens": "452",
          "completionTokens": "54",
          "totalTokens": "506"
        },
        "modelVersion": "18.01.2024"
      }
    }
    
  1. Prepare a model request file, e.g., body.json:

    {
      "modelUri": "gpt://<folder_ID>/yandexgpt",
      "completionOptions": {
        "stream": false,
        "temperature": 0.6,
        "maxTokens": "2000",
        "reasoningOptions": {
          "mode": "DISABLED"
        }
      },
      "messages": [
        {
          "role": "system",
          "text": "You are a smart assistant"
        },
        {
          "role": "user", 
          "text": "Hi! What fields of science did Albert Einstein study?"
        }
      ]
    }
    

    Where:

    • modelUri: ID of the model that will be used to generate the response. The parameter contains the Yandex Cloud folder ID or the tuned model's ID.

    • completionOptions: Request configuration options:

      • stream: Enables streaming of partially generated text. It can either be true or false.

      • temperature: With a higher temperature, you get more creative and randomized responses from the model. Its values range from 0 to 1, inclusive. The default value is 0.3.

      • maxTokens: Sets a limit on the model's output in tokens. The maximum number of tokens per generation depends on the model. For more information, see Quotas and limits in Yandex Foundation Models.

      • reasoningOptions.mode: Reasoning mode parameters. This is an optional parameter. The default value is DISABLED. The possible values are:

        • DISABLED: Reasoning mode is disabled.
        • ENABLED_HIDDEN: Reasoning mode is enabled. The model will decide by itself whether or not to use this mode for each particular request.
    • messages: List of messages that set the context for the model:

      • role: Message sender's role:

        • user: Used for sending user messages to the model.
        • system: Used to set the query context and define the model's behavior.
        • assistant: Used for responses generated by the model. In chat mode, the model's responses tagged with the assistant role are included in the message to save the conversation context. Do not send user messages with this role.
      • text: Message text.

  2. Send a request to the model:

    1. Create a file named index.py and add the following code to it:

      import requests
      import json
      import os
      
      def gpt(auth_headers):
      
          url = 'https://llm.api.cloud.yandex.net/foundationModels/v1/completion'
      
          with open('body.json', 'r', encoding='utf-8') as f:
              data = json.dumps(json.load(f))
          resp = requests.post(url, headers=auth_headers, data=data)
      
          if resp.status_code != 200:
              raise RuntimeError(
                  'Invalid response received: code: {}, message: {}'.format(
                      {resp.status_code}, {resp.text}
                  )
              )
      
          return resp.text
      
      if __name__ == "__main__":
          if os.getenv('IAM_TOKEN') is not None:
              iam_token = os.environ['IAM_TOKEN']
              headers = {
                  'Authorization': f'Bearer {iam_token}',
              }
          elif os.getenv('API_KEY') is not None:
              api_key = os.environ['API_KEY']
              headers = {
                  'Authorization': f'Api-Key {api_key}',
              }
          else:
              print ('Please save either an IAM token or an API key into a corresponding `IAM_TOKEN` or `API_KEY` environment variable.')
              exit()
      
          print(gpt(headers))
      
    2. Save the authentication data to the environment variable:

      Authentication with an IAM token:

      export IAM_TOKEN=<IAM_token>
      

      Authentication with an API key (for service accounts only):

      export API_KEY=<API_key>
      
    3. Run the created file:

      python index.py
      
  3. In response to your request, the model will return the generated text:

    Result:
    {
      "result": {
        "alternatives": [
          {
            "message": {
              "role": "assistant",
              "text": "Albert Einstein was an outstanding physicist, whose works in theoretical physics, theoretical mechanics, and philosophy of science became fundamental. He dedicated his career to studying the fundamentals of the universe, including the theory of relativity, both special and general. Additionally, Albert Einstein studied:\n\n* thermodynamics,\n* statistical mechanics,\n* electromagnetism,\n* quantum theory,\n* special relativity, and more.\n\nHis general relativity works found wide recognition and had a profound influence on the development of modern physics."
            },
            "status": "ALTERNATIVE_STATUS_FINAL"
          }
        ],
        "usage": {
          "inputTextTokens": "28",
          "completionTokens": "110",
          "totalTokens": "138"
        },
        "modelVersion": "18.01.2024"
      }
    }
    

    Save the message record value for use in subsequent requests.

  4. Add the message record value from the model's response to the previous request and the user's new question to the end of the messages array in the request file:

    {
      "modelUri": "gpt://<folder_ID>/yandexgpt",
      "completionOptions": {
        "stream": false,
        "temperature": 0.6,
        "maxTokens": "2000",
        "reasoningOptions": {
          "mode": "DISABLED"
        }
      },
      "messages": [
        {
          "role": "system",
          "text": "You are a smart assistant"
        },
        {
          "role": "user", 
          "text": "Hi! What fields of science did Albert Einstein study?"
        },
        {
          "role": "assistant", 
          "text": "Albert Einstein was an outstanding physicist, whose works in theoretical physics, theoretical mechanics, and philosophy of science became fundamental. He dedicated his career to studying the fundamentals of the universe, including the theory of relativity, both special and general. Additionally, Albert Einstein studied:\n\n* thermodynamics,\n* statistical mechanics,\n* electromagnetism,\n* quantum theory,\n* special relativity, and more.\n\nHis general relativity works found wide recognition and had a profound influence on the development of modern physics."
        },
        {
          "role": "user", 
          "text": "What important discoveries did he make?"
        }
      ]
    }
    
  5. Send a new request to the model by repeating Step 2.3 of this guide. In response to your request, the model will again return the generated text:

    Result:
    {
      "result": {
        "alternatives": [
          {
            "message": {
              "role": "assistant",
              "text": Here are some discoveries commonly associated with the name of Albert Einstein:\n1. **Special theory of relativity (STR)**: Theory describing motion, laws of mechanics, and spatiotemporal relationships at random velocities less than the speed of light in a vacuum.\n1. **General theory of relativity (GTR)**: Geometric theory of gravitation based on the prediction of the interrelation between the spacetime, matter, and energy coordinates.\n1. **Quantum theory of the photoelectric effect**: Explanation of the photoelectric effect, a phenomenon of electron emission from matter under the influence of electromagnetic radiation.\n1. **Brownian motion**: Phenomenon of chaotic, random movement of microscopic particles suspended in a liquid or gas, caused by the thermal motion of molecules in the surrounding medium.\n1. **Equivalence principle**: Idea that gravitational and inertial mass are different aspects of the same physical quantity.\n1. **Cosmological solutions of the GTR equations**: Contribution to the theory of the structure and dynamics of the universe.\n1. **Nuclear model of the atom**: Description of the atom structure based on protons, neutrons, and electrons.\nThese are just some of the discoveries made by Albert Einstein. His contributions to science and philosophy are immense, and his research continues to shape our ideas of nature and the universe."
            },
            "status": "ALTERNATIVE_STATUS_FINAL"
          }
        ],
        "usage": {
          "inputTextTokens": "154",
          "completionTokens": "278",
          "totalTokens": "432"
        },
        "modelVersion": "18.01.2024"
      }
    }
    

    Once again, save the message record value for use in subsequent requests.

  6. Continue expanding the request context with the received responses and user questions:

    {
      "modelUri": "gpt://<folder_ID>/yandexgpt",
      "completionOptions": {
        "stream": false,
        "temperature": 0.6,
        "maxTokens": "2000",
        "reasoningOptions": {
          "mode": "DISABLED"
        }
      },
      "messages": [
        {
          "role": "system",
          "text": "You are a smart assistant"
        },
        {
          "role": "user", 
          "text": "Hi! What fields of science did Albert Einstein study?"
        },
        {
          "role": "assistant", 
          "text": "Albert Einstein was an outstanding physicist, whose works in theoretical physics, theoretical mechanics, and philosophy of science became fundamental. He dedicated his career to studying the fundamentals of the universe, including the theory of relativity, both special and general. Additionally, Albert Einstein studied:\n\n* thermodynamics,\n* statistical mechanics,\n* electromagnetism,\n* quantum theory,\n* special relativity, and more.\n\nHis general relativity works found wide recognition and had a profound influence on the development of modern physics."
        },
        {
          "role": "user", 
          "text": "What important discoveries did he make?"
        },
        {
          "role": "assistant",
          "text": Here are some discoveries commonly associated with the name of Albert Einstein:\n1. **Special theory of relativity (STR)**: Theory describing motion, laws of mechanics, and spatiotemporal relationships at random velocities less than the speed of light in a vacuum.\n1. **General theory of relativity (GTR)**: Geometric theory of gravitation based on the prediction of the interrelation between the spacetime, matter, and energy coordinates.\n1. **Quantum theory of the photoelectric effect**: Explanation of the photoelectric effect, a phenomenon of electron emission from matter under the influence of electromagnetic radiation.\n1. **Brownian motion**: Phenomenon of chaotic, random movement of microscopic particles suspended in a liquid or gas, caused by the thermal motion of molecules in the surrounding medium.\n1. **Equivalence principle**: Idea that gravitational and inertial mass are different aspects of the same physical quantity.\n1. **Cosmological solutions of the GTR equations**: Contribution to the theory of the structure and dynamics of the universe.\n1. **Nuclear model of the atom**: Description of the atom structure based on protons, neutrons, and electrons.\nThese are just some of the discoveries made by Albert Einstein. His contributions to science and philosophy are immense, and his research continues to shape our ideas of nature and the universe."
        },
        {
          "role": "user",
          "text": "Give me a shorter response"
        }
      ]
    }
    
    Result:
    {
      "result": {
        "alternatives": [
          {
            "message": {
              "role": "assistant",
              "text": "Albert Einstein was an outstanding physicist who studied the fundamentals of the universe, including the theory of relativity, thermodynamics, and electromagnetism.\n\nSome of his well-known discoveries include the following: special and general theories of relativity, quantum theory of the photoelectric effect, and others."
            },
            "status": "ALTERNATIVE_STATUS_FINAL"
          }
        ],
        "usage": {
          "inputTextTokens": "452",
          "completionTokens": "54",
          "totalTokens": "506"
        },
        "modelVersion": "18.01.2024"
      }
    }
    

See alsoSee also

  • Text generation overview
  • Examples of working with ML SDK on GitHub

Was the article helpful?

Previous
Sending a request in prompt mode
Next
Sending an asynchronous request
Yandex project
© 2025 Yandex.Cloud LLC