Skip to main content
This guide provides a quick overview for getting started with Naver’s HyperCLOVA X chat models via CLOVA Studio. For detailed documentation of all ChatClovaX features and configurations head to the API reference. CLOVA Studio has several chat models. You can find information about the latest models, including their costs, context windows, and supported input types, in the CLOVA Studio Guide documentation.

Overview

Integration details

Model features

Setup

Before using the chat model, you must go through the four steps below.
  1. Creating NAVER Cloud Platform account
  2. Apply to use CLOVA Studio
  3. Create a CLOVA Studio Test App or Service App of a model to use (See here.)
  4. Issue a Test or Service API key (See here.)

Credentials

Set the CLOVASTUDIO_API_KEY environment variable with your API key. You can add them to your environment variables as below:
To enable automated tracing of your model calls, set your LangSmith API key:

Installation

The LangChain Naver integration lives in the langchain-naver package:

Instantiation

Now we can instantiate our model object and generate chat completions:

Invocation

In addition to invoke below, ChatClovaX also supports batch, stream and their async functionalities.

Chaining

We can chain our model with a prompt template like so:

Streaming

Tool calling

CLOVA Studio supports tool calling (also known as “function calling”) that lets you describe tools and their arguments, and have the model return a JSON object with a tool to invoke and the inputs to that tool. It is extremely useful for building tool-using chains and agents, and for getting structured outputs from models more generally. Note: You should set max_tokens larger than 1024 to utilize the tool calling feature in CLOVA Studio.

ChatClovaX.bind_tools()

With ChatClovaX.bind_tools, we can easily pass in Pydantic classes, dict schemas, LangChain tools, or even functions as tools to the model. Under the hood these are converted to an OpenAI-compatible tool schemas, which looks like:
and passed in every model invocation.

AIMessage.tool_calls

Notice that the AIMessage has a tool_calls attribute. This contains in a standardized ToolCall format that is model-provider agnostic.

Structured Outputs

For supporting model(s), you can use the Structured Outputs feature to force the model to generates responses in a specific structure, such as Pydantic model or TypedDict or JSON. Note: Structured Outputs requires Thinking mode to be disabled. Set thinking.effort to none.
Note: CLOVA Studio supports Structured Outputs with a json schema method. Set method to json_schema.

Thinking

For supporting model(s), when Thinking feature is enabled (by default), it will output the step-by-step reasoning process that led to its final answer. Specify the thinking parameter to control the feature—enable or disable the thinking process and configure its depth.

Accessing the thinking process

When Thinking mode is enabled, you can access the thinking process through the thinking_content attribute in AIMessage.additional_kwargs.

Additional functionalities

Using fine-tuned models

You can call fine-tuned models by passing the task_id to the model parameter as: ft:{task_id}. You can check task_id from corresponding Test App or Service App details.

API reference

For detailed documentation of all ChatClovaX features and configurations head to the API reference