class AssistantMessageTypeAdapter extends TypeAdapter<AssistantMessage> {

    static final TypeAdapterFactory ASSISTANT_MESSAGE_TYPE_ADAPTER_FACTORY = new TypeAdapterFactory() {

        @Override
        @SuppressWarnings("unchecked")
        public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
            if (type.getRawType() != AssistantMessage.class) {
                return null;
            }
            TypeAdapter<AssistantMessage> delegate =
                    (TypeAdapter<AssistantMessage>) gson.getDelegateAdapter(this, type);
            return (TypeAdapter<T>) new AssistantMessageTypeAdapter(delegate);
        }
    };

    private final TypeAdapter<AssistantMessage> delegate;

    private AssistantMessageTypeAdapter(TypeAdapter<AssistantMessage> delegate) {
        this.delegate = delegate;
    }

    @Override
    public void write(JsonWriter out, AssistantMessage assistantMessage) throws IOException {<FILL_FUNCTION_BODY>}

    @Override
    public AssistantMessage read(JsonReader in) throws IOException {
        return delegate.read(in);
    }
}

        out.beginObject();

        out.name("role");
        out.value(assistantMessage.getRole().toString().toLowerCase());

        out.name("content");
        if (assistantMessage.getContent() == null) {
            boolean serializeNulls = out.getSerializeNulls();
            out.setSerializeNulls(true);
            out.nullValue(); // serialize "content": null
            out.setSerializeNulls(serializeNulls);
        } else {
            out.value(assistantMessage.getContent());
        }

        if (assistantMessage.getName() != null) {
            out.name("name");
            out.value(assistantMessage.getName());
        }

        List<ToolCall> toolCalls = assistantMessage.getToolCalls();
        if (toolCalls != null && !toolCalls.isEmpty()) {
            out.name("tool_calls");
            out.beginArray();
            TypeAdapter<ToolCall> toolCallTypeAdapter = Json.GSON.getAdapter(ToolCall.class);
            for (ToolCall toolCall : toolCalls) {
                toolCallTypeAdapter.write(out, toolCall);
            }
            out.endArray();
        }

        out.endObject();
    
<no_super_class>