Follow Discord
Sweep 22 Oct 2026 · 21:04Z Build v2.1.309 528 read Stable v2.1.308 Latest v2.1.309 Next v2.1.309 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

customer-support-chat changedabout-claude/use-case-guides/customer-support-chat

Nearest release: v2.1.309, published 3 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+24added
Lines−24removed
From line 384 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits14to this page, all time

The whole hunk

from line 384, old and new numbered
/
lines
from line 384
384384For this example, start with one tool for calculating the quote.
385385 
386386<Tip>
387 As a reminder, this tool does not perform the actual calculation; it just signals to the application that a tool should be used with whatever arguments specified.
387 As a reminder, this tool does not perform the actual calculation; it just signals to the application that a tool should be used with whatever arguments Claude specifies.
388388</Tip>
389389 
390390Add the model name, the tool definition, and a stub implementation to `config.py`:
from line 848
848848 
849849 Message generateMessage(List<MessageParam> messages, long maxTokens) {
850850 return anthropic.messages().create(MessageCreateParams.builder()
851 .model(MODEL)
852 .system(IDENTITY)
853 .maxTokens(maxTokens)
854 .messages(messages)
855 .tools(TOOLS)
856 .build());
851 .model(MODEL)
852 .system(IDENTITY)
853 .maxTokens(maxTokens)
854 .messages(messages)
855 .tools(TOOLS)
856 .build());
857857 }
858858 
859859 String processUserInput(String userInput) {
from line 866
866866 if (lastBlock.isToolUse()) {
867867 ToolUseBlock toolUse = lastBlock.asToolUse();
868868 Map<String, JsonValue> toolInput =
869 (Map<String, JsonValue>) toolUse._input().asObject().orElseThrow();
869 (Map<String, JsonValue>) toolUse._input().asObject().orElseThrow();
870870 String result = handleToolUse(toolUse.name(), toolInput);
871871 
872872 messages.add(MessageParam.ofAssistantOfContentBlockParams(
873 content.stream().map(ContentBlock::toParam).toList()));
873 content.stream().map(ContentBlock::toParam).toList()));
874874 messages.add(MessageParam.ofUserOfContentBlockParams(List.of(ContentBlockParam.ofToolResult(
875 ToolResultBlockParam.builder()
876 .toolUseId(toolUse.id())
877 .content(result)
878 .build()))));
875 ToolResultBlockParam.builder()
876 .toolUseId(toolUse.id())
877 .content(result)
878 .build()))));
879879 
880880 Message followUpResponse = generateMessage(messages, 2048);
881881 
882882 ContentBlock followUpBlock = followUpResponse.content().stream()
883 .filter(ContentBlock::isText)
884 .findFirst()
885 .orElseThrow(() -> new IllegalStateException("An error occurred: Unexpected response type"));
883 .filter(ContentBlock::isText)
884 .findFirst()
885 .orElseThrow(() -> new IllegalStateException("An error occurred: Unexpected response type"));
886886 String responseText = followUpBlock.asText().text();
887887 messages.add(MessageParam.ofAssistant(responseText));
888888 return responseText;
889889 } else {
890890 ContentBlock textBlock = content.stream()
891 .filter(ContentBlock::isText)
892 .findFirst()
893 .orElseThrow(() -> new IllegalStateException("An error occurred: Unexpected response type"));
891 .filter(ContentBlock::isText)
892 .findFirst()
893 .orElseThrow(() -> new IllegalStateException("An error occurred: Unexpected response type"));
894894 String responseText = textBlock.asText().text();
895895 messages.add(MessageParam.ofAssistant(responseText));
896896 return responseText;
from line 901
901901 return switch (funcName) {
902902 case "get_quote" -> {
903903 double premium = getQuote(
904 funcParams.get("make").asStringOrThrow(),
905 funcParams.get("model").asStringOrThrow(),
906 ((Number) funcParams.get("year").asNumber().orElseThrow()).longValue(),
907 ((Number) funcParams.get("mileage").asNumber().orElseThrow()).longValue(),
908 ((Number) funcParams.get("driver_age").asNumber().orElseThrow()).longValue());
904 funcParams.get("make").asStringOrThrow(),
905 funcParams.get("model").asStringOrThrow(),
906 ((Number) funcParams.get("year").asNumber().orElseThrow()).longValue(),
907 ((Number) funcParams.get("mileage").asNumber().orElseThrow()).longValue(),
908 ((Number) funcParams.get("driver_age").asNumber().orElseThrow()).longValue());
909909 yield "Quote generated: $%.2f per month".formatted(premium);
910910 }
911911 default -> throw new IllegalArgumentException("An unexpected tool was used");
Feedback