Claude 3.7 Sonnet is Anthropic’s most advanced AI model, featuring a hybrid reasoning approach that integrates quick responses with extended, step-by-step thinking. This model is the first of its kind to offer both modes within a single framework, mirroring human cognitive processes. It excels in coding and front-end web development, achieving state-of-the-art performance on benchmarks like SWE-bench Verified. Claude 3.7 Sonnet is available on various platforms, including Amazon Bedrock and Google Cloud’s Vertex AI. Its capabilities include enhanced instruction following, error correction, and document analysis with Claude 3.7 Sonnet, making it ideal for complex workflows and customer-facing applications. This model represents a significant leap in AI reasoning and problem-solving capabilities.
Learning Objectives
- Understand the key features of Claude 3.7 Sonnet and its differences from Claude 3.5 Sonnet.
- Explore Claude Code, a tool for agentic coding.
- Examine extended thinking mode for detailed, step-by-step reasoning.
- Leverage Claude 3.7 Sonnet’s multimodal capabilities in a hands-on Python project.
- Analyze historical documents (bills, prescriptions, letters, and postcards) using the model.
- Evaluate Claude 3.7 Sonnet’s performance in academic research on ancient documents.
- Assess the model’s ability to extract valuable information efficiently.
This article was published as a part of the Data Science Blogathon.
What is Claude 3.7 Sonnet?
Claude 3.7 Sonnet is a cutting-edge AI model developed by Anthropic, a leading AI research and development startup. It represents a significant advancement in hybrid reasoning, allowing users to switch seamlessly between rapid responses and extended, step-by-step thinking within a single system. This model is designed to provide both quick, pattern-based outputs and more nuanced, thought-out answers, making it particularly adept at tasks involving coding, instruction-following, and multimodal understanding
Key Differentiating Features
- Hybrid Reasoning: Combines fast responses with deep analytical thinking, allowing users to choose between standard mode for quick answers and extended thinking mode for more detailed analysis.
- Coding and Development: Excels in coding, especially in software engineering and front-end web development, with state-of-the-art performance on software engineering benchmarks
- Claude Code: Introduces a command-line tool for agentic coding, enabling developers to automate substantial engineering tasks directly from their terminal.
- Output Capacity: Supports outputs up to 128,000 tokens, significantly expanding its capacity compared to previous models.
How is Claude 3.7 different from Claude 3.5 Sonnet?
Below we will look into the table that differentiates both the models:
Claude 3.5 Sonnet | Claude 3.7 Sonnet | |
Hybrid reasoning & Extended Thinking Mode | Not Present | Introduces a hybrid reasoning approach, allowing it to switch between quick responses and extended, step-by-step thinking |
Output Capacity | Supports outputs up to 4,096 tokens by default. Can be increased to 8,192 tokens. | Supports outputs up to 128,000 tokens |
New Feature Extension | NA | Claude Code, a command-line tool for agentic coding |
Coding and software engineering tasks | 49.0% accuracy score on SWE-bench Verified without custom scaffolding | 62.3% accuracy score on SWE-bench Verified without custom scaffolding, increasing to 70.3% with custom scaffolding |
Hybrid Reasoning and Extended Thinking Mode
Claude 3.7 Sonnet introduces a hybrid reasoning approach, allowing it to switch between quick responses and extended, step-by-step thinking. This extended thinking mode enables the model to analyze problems more deeply and provide more detailed solutions. Claude 3.5 Sonnet does not have this extended thinking capability, making it less adept at complex problem-solving.
Coding and Software Engineering Performance
Claude 3.7 Sonnet shows significant improvements in coding and software engineering tasks, achieving a 70.3% accuracy score on SWE-bench Verified with a custom scaffold, compared to Claude 3.5 Sonnet’s 49.0%.
Output Capacity
Claude 3.7 Sonnet supports outputs up to 128,000 tokens, which is over 15 times longer than its predecessor. This expanded capacity allows for more detailed responses and longer documents. The output token limit for Claude 3.5 Sonnet is typically 4,096 tokens by default. However, it can be increased to 8,192 tokens.
Claude Code Integration
Claude 3.7 Sonnet introduces Claude Code, a command-line tool for agentic coding, enabling developers to automate substantial engineering tasks directly from their terminal. This feature is not available in Claude 3.5 Sonnet.
Agentic Tool Use
Claude 3.7 Sonnet demonstrates better performance in agentic tool use, particularly in retail and airline-related tasks, with accuracy improvements over Claude 3.5 Sonnet.
What is Claude Code?
Claude Code is an agentic coding tool developed by Anthropic, designed to assist developers in coding tasks. It acts as an “active collaborator” that can search and read code, edit files, write and run tests, and use command-line tools. This tool is integrated with Claude 3.7 Sonnet and can be accessed directly through the terminal, allowing developers to interact with their codebase using natural language commands. Claude Code leverages the advanced reasoning capabilities of Claude 3.7 Sonnet to provide detailed insights and explanations of its actions, enhancing transparency and control over the coding process.
What is Hybrid Reasoning and Extended Thinking Mode?
Hybrid Reasoning in Claude 3.7 Sonnet refers to the model’s ability to integrate both quick response generation and extended, step-by-step thinking within a single system. This approach allows users to choose between rapid answers and more detailed, thoughtful responses, depending on the task’s complexity and the desired level of analysis.
Unlike other AI models that use separate systems for quick responses and complex problem-solving, Claude 3.7 Sonnet combines these capabilities into one model. This integration mirrors how humans use their brains for both simple and complex tasks
Extended Thinking Mode with Control over Time to Think
Users can opt for extended thinking mode, which enables the model to reflect on its responses before providing them. This mode enhances performance in tasks like coding, math, and instruction-following by allowing for more detailed analysis and step-by-step reasoning. Through the API, users can control how long the model spends thinking about a problem, allowing them to balance speed and response quality. This flexibility is particularly useful in real-world applications where time and accuracy are critical.
Performance Benchmarks

Claude 3.7 Sonnet demonstrates impressive performance across various benchmarks. In software engineering, it achieves a 62.3% accuracy on SWE-bench Verified, rising to 70.3% with custom scaffolding, surpassing models like OpenAI’s o3-mini and DeepSeek R1. In agentic tool use, it excels in retail tasks with an 81.2% accuracy and airline tasks with 58.4%, outperforming its predecessor and OpenAI o1.
For reasoning and math, Claude 3.7 Sonnet scores 68.0% in standard mode and 84.8% in extended thinking mode on the GPQA Diamond benchmark, outperforming several models. It also achieves 80.0% on the AIME 2024 high school math benchmark with extended thinking, though it lags behind OpenAI o3-mini and Grok 3 Beta. Overall, Claude 3.7 Sonnet is a top performer in complex reasoning and coding tasks, making it ideal for powering AI agents and workflows[1][3][5].
Analyzing Historical Documents with Claude 3.7 Sonnet
With the multimodal capabilities of Claude 3.7 sonnet, this model can analyze historical documents and old bills by breaking down complex information into structured, logical steps. By leveraging this capability, users (for example – academicians working on researching historical documents) can extract key insights from historical financial records and documents, facilitating comprehensive analysis and decision-making. This integration of AI with historical data analysis offers a powerful tool for researchers and historians.
We will be analyzing the following categories of documents for assessing the model’s capabilities –
- Old Historical Postcards
- Old Historical Letters
- Old Bills
- Old Medical Prescriptions
Step 1: Install and Import Necessary Libraries
First step is to install all required libraires:
!pip install anthropic
import base64
from anthropic import Client
Step 2: Loading Image Data
Next we will load the image data:
# Load your image data
with open("history.jpg", "rb") as image_file:
image_data = base64.b64encode(image_file.read()).decode()
We can save whichever image we are working on in the current working directory and then load it.
Step 3: Setting Anthropic’s API Key
Start by logging in to the Anthropic console: https://console.anthropic.com/. Click on Get API Keys. You’ll be redirected to the API Keys tab. Click on Create API Key and enter your key name. Save the generated API key and use it in the following code. For using this model, we need to add some credit to our account. Add in some credit to your billing account, under the Billing tab. Click on buy credits and add about $5 to your account (sufficient for this project).
client = Client(api_key="")
Step 4: Querying the model
Next we will query the model:
# Define the image media type
image_media_type = "image/jpeg"
# Create the API request
message = client.messages.create(
model="claude-3-7-sonnet-20250219", # Use the correct model version
max_tokens=1024,
messages=[
{
"role": "user",
"content": [
{
"type": "image",
"source": {
"type": "base64",
"media_type": image_media_type,
"data": image_data,
},
},
{
"type": "text",
"text": "Describe whats written in the image"
}
]
}
]
)
Step 5: Printing the Output
Finally printing the output:
print(message.content[0].text)
Analysis of Diverse Queries with Claude 3.7 Sonnet
Claude 3.7 Sonnet’s enhanced reasoning and multimodal capabilities allow it to handle a wide range of queries with greater accuracy. In this section, we analyze how the model processes diverse inputs, from complex coding tasks to historical document analysis.
Query 1 | Type of Document – Old Letter
Let’s start with analyzing the scanned following historical image. As seen in the image below, its a letter written by the President of India,Sarvepalli Radhakrishnan.). Let us see how well claude 3.7 sonnet is able to describe it.

Output From Model
The image shows an official commission certificate from the President of India,
presented in a black frame. The document is bilingual, with English text on the
left side and Hindi text on the right side. The certificate begins with "The
President of India" at the top in English (and its Hindi equivalent "भारत का राष्ट्रपति"
on the right side), both under the Indian national emblem. The English text appears
to be a formal commissioning letter addressed to "Ramkishen," appointing the
recipient as a Junior Commissioned Officer in the President's Army. The document
expresses "special Trust and Confidence" in the recipient's "Fidelity, Courage, and
good Conduct" and outlines the duties and obligations of the position, including
following orders from superior officers and adhering to regulations. The certificate
is dated the "thirtieth day of March, Nineteen hundred and fifty-six" and appears
to be issued in New Delhi. It bears signatures at the bottom, including that of the
President of India and the Secretary to the Government of India, Ministry of
Defence. The document represents an important military commission and appears to be
a treasured historical item, carefully preserved and framed.
Analysis of Output
As seen from Claude 3.7 Sonnet’s output, many of the key details are captured correctly like certificate from President of India, what the letter talks about, who has written the letter etc. Even though the year of the letter is captured incorrectly – ideally should be 1966 (since S Radhakrishnan was the President of India then), the high level information present in the output is correct. It would have been even better if the output would have captured the name “S Radhakrishnan” at bottom, however considering its written very unclearly, the model could capture most details accurately.
Query 2 | Type of Document – Old Postcard
Lets analyze another scanned following historical image. As seen in the image below, its a historical Post Card which has something written in Devanagari script. Let us see how well claude 3.7 sonnet is able to describe it.

Output From Model
The image shows a historical postcard or postal card from what appears to be British
India. The document has the following notable features: It's printed on light
brown/buff colored paper. It has a green half Anna postage stamp in the upper right
corner. There's a circular postmark dated "22 MAY 28" (May 22, 1928) from Gwalior.
The card has "REPLY" and "ADDRESS ONLY" printed in English on the right side. The
left side contains handwritten text in what appears to be a South Asian script
(likely Hindi or a related language). There's an address on the right portion also
written in the same script. A signature is visible at the bottom of the address
section. There's a small decorative emblem with what looks like a sun face between
two scrolls. The document appears to be a reply postcard from the colonial era in
India, with correspondence written in a native script. The text itself would
require translation from someone familiar with the specific language and script
used.
Analysis of Output
As seen from Claude 3.7 Sonnet’s output, most of the key details are captured correctly like a green half Anna postage stamp, date of postcard, details about the decorative emblem. The script is mostly South Asian and hence the exact content of the post card would need translation, otherwise the output has captured most key details.
Query 3 | Type of Document – Old Postcard
Lets analyze another scanned following historical image. As seen in the image below, its again a historical Postcard which has something written in Hindi script. Let us see how well claude 3.7 sonnet is able to describe it.

Output From Model
This image shows a vintage Indian postcard with text in Hindi script on the left
side and address information in English on the right side. The postcard appears to
be from the colonial era, featuring a postage stamp marked "GWALIOR" with what
seems to be King George VI's portrait. The stamp has "INDIA POSTAGE" printed on it.
The right side is marked "POST CARD" with text indicating "THE ANNEXED CARD IS
INTENDED FOR THE ANSWER" and "ADDRESS ONLY" below it. The addressed portion shows
what appears to be "To Laramji" at Rajgarh (Bikaner). The left side contains
several lines of Hindi text, which appears to include New Year greetings and what
seems to be a business communication. At the bottom it mentions locations including
Neemuch (Madhya Bharat) and Pratapgarh (Rajasthan). The postcard shows aging with
some circular postal markings indicating it was processed through the mail system.
This is a historical communication artifact that likely dates from the mid-20th
century based on the stamp design and overall appearance.
Analysis of Output
As seen from Claude 3.7 Sonnet’s output, most of the key details are captured correctly like Gwalior Postage Stamp, places name like Neemuch and Pratapgarh, King George VI’s portrait in the stamp amongst other things. The Hindi script is also translated by the model and the output talks briefly about what the content of the letter which is New Year Greetings.
Query 4 | Type Of Document – Old Bill
Let’s analyze another scanned old bill. As seen in the image below, its a Ford Sales receipt. Let us see how well claude 3.7 sonnet is able to describe it

Output From Model
This image shows a vintage Ford sales and service receipt from Rotan Motor Company
in Rotan, Texas, dated 12-29-1950. The receipt is numbered 4601 and appears to be
for a payment of $25.42. The payment was marked as being made in cash, as indicated
by a checkmark in the "HOW PAID" column. The receipt includes fields for various
payment details such as "amount due," "amount paid," "interest paid," etc., though
most of these fields are not filled in. The document is signed at the bottom by what
appears to be "Colbert Mize" (or similar name) with "THANK YOU" printed underneath
the signature. The receipt has the Ford oval logo in red at the top left corner and
appears to be printed on Form 46-A by Mick Bros. Printers, Oklahoma City.
Analysis of Output
As seen from Claude 3.7 Sonnet’s output, almost all of the key details are captured correctly like Rotan Company Name, receipt number, bill amount. Date of the bill is slightly incorrect since it is 12-27-1950.
Query 5 | Type Of Document – Old Bill
Let’s analyze another scanned old bill. As seen in the image below, its a Ford Sales receipt. Let us see how well claude 3.7 sonnet is able to describe it.

Output From Model
The image shows a historical shipping document from the "Missouri River
Transportation" and the "St. Louis and Kansas City Electric Packet Line." This
appears to be a freight bill or receipt from approximately 1886, issued to "Mr.
W.P. Howard & Co." for transportation on the "Steamer Wyoming, Dr." The document
header lists the commander as Henry Keith, with Rolla Porter as 1st Clerk and Sol.
Smith as 2nd Clerk. It also mentions James Kennedy as Agent in Kansas City, MO, and
Jenkins & Sass as General Agents in St. Louis, MO. The left side of the document
features an illustration of a steamboat. The main portion of the receipt shows a
shipment of wheat (131 sacks) with a weight of 15,785 pounds, with calculations
showing the freight charges. The document includes columns for marks, freight
description, weight, rate, freight charges, and amount. The total amount appears to
be $28.68, with some additional handwritten notations. This is a fascinating
historical artifact that provides insight into river transportation and commerce
along the Missouri River in the late 19th century.
Analysis of Output
As seen from Claude 3.7 Sonnet’s output, almost all of the key details are captured correctly like name of the various persons mentioned along with their roles like (James Kennedy, Agent in Kansas city). The output has also mentioned about the illustration of the steamboat on the bill. Other key details around the material shipped that is wheat, its weight, total amount are also mentioned.
Query 6 | Type Of Document – Old Prescription
Lets analyze another scanned old documents. As seen in the image below, its a doctor’s prescription. Let us see how well claude 3.7 sonnet is able to describe it

Output From Model
The image shows a vintage prescription from Suwannee Drug Co. in Live Oak, Florida
with Registry Number 17. It appears to be dated 8/20/1917 (though parts of the date
are difficult to read with certainty).The prescription details:
Written for "Baby" (appears to be someone's last name)
Address: 76209
Date: 4-6-17 or similar notation
Medication: Petrochandrin (Abbott Lab.)
Dosage instructions: "3ii; 4 times a day with feeding"
It appears to include "Calomin" or similar notation with "1/100 gr"
Signed by a physician (appears to be J.M. Price, M.D.) with Registry No. 1408
At the bottom, there's a name printed: "Dr. S. Ehrlich, Physician and Surgeon" from Bainbridge, GeorgiaThis appears to be a historic prescription for an infant, showing medical practices from over a century ago.
Analysis of Output
As seen from Claude 3.7 Sonnet’s output, almost all of the key details are captured correctly like dosage instructions, medicine name, physician name, date etc.
Query 7 | Type Of Document – Old Prescription
Lets analyze another scanned old documents. As seen in the image below, its a doctor’s prescription. Let us see how well claude 3.7 sonnet is able to describe it

Output From Model
This image shows an old prescription or pharmaceutical label from Caldwell Sweet
Company Pharmacists, located at 26 Main Street in Bangor, Maine. The label has a
decorative header with the company name and appears to be aged, with a yellowish-
brown tint.
The prescription includes:
An "Rx" symbol (prescription designation)
"Hydroiodic Acid" as the medication
"Simple syrup" as part of the formulation
Dosage instructions that appear to read "Take a teaspoonful at each meal in a wine glass of water"The label has the number "15011" at the top right corner and what appears to be some
pricing information. This appears to be a historical pharmaceutical document,
likely from the early 20th century or late 19th century based on the style and
appearance.
Analysis of Output
As seen from Claude 3.7 Sonnet’s output, almost all of the key details are captured correctly like the company’s name, the medication’s name, dosage instructions etc.
Conclusion
Claude 3.7 Sonnet represents a major leap in AI technology, offering advanced hybrid reasoning and the ability to seamlessly integrate quick responses with deep analytical thinking. Its enhanced capabilities in coding, multimodal understanding, and Document Analysis with Claude 3.7 Sonnet make it a valuable tool for researchers, developers, and various industries. By enabling detailed, step-by-step analysis and improved tool integration, Document Analysis with Claude 3.7 Sonnet is well-suited for complex workflows and real-world applications, solidifying its position as a leading AI model in the field.
Key Takeaways
- Claude 3.7 Sonnet combines fast responses with extended, detailed analysis, allowing users to choose between quick answers and deeper, more thoughtful solutions for complex tasks.
- The model significantly outperforms previous versions in coding tasks, achieving state-of-the-art accuracy on benchmarks like SWE-bench Verified, making it ideal for software engineering and development.
- The introduction of Claude Code enables developers to automate tasks directly from the terminal, enhancing productivity by allowing natural language interactions for code editing, testing, and running.
- With a token limit of 128,000, Claude 3.7 Sonnet can handle much larger inputs and outputs compared to earlier versions, making it suitable for longer documents and more complex analysis.
- Claude 3.7 Sonnet can excel at analyzing historical documents, such as old bills, postcards, and prescriptions, providing valuable insights for researchers and academicians working with ancient or complex data
Frequently Asked Questions
A. Claude 3.7 Sonnet is a cutting-edge AI model developed by Anthropic, featuring hybrid reasoning that combines quick responses and detailed step-by-step thinking within a single framework. It excels in coding, software engineering, and multimodal tasks.
A. Hybrid reasoning refers to the model’s ability to alternate between rapid, pattern-based responses and more detailed, step-by-step analysis, depending on the task’s complexity.
A. Extended thinking mode allows Claude 3.7 Sonnet to take more time to analyze problems deeply and provide detailed solutions, making it especially useful for tasks like coding, math, and instruction-following.
A. Claude Code is an agentic coding tool integrated with Claude 3.7 Sonnet, enabling developers to automate engineering tasks directly from their terminal using natural language commands and to perform coding-related tasks like searching, reading, and editing code.
A. Claude 3.7 Sonnet shows significant improvement in coding tasks, achieving a 70.3% accuracy score on software engineering benchmarks like SWE-bench Verified, which is a major leap over Claude 3.5 Sonnet’s 49.0%.
The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion.