Prompt Engineering Exercises
Summarizing a document - One valuable use of AI would be to summarize a long report or document so that you can get a high level understanding of the content without having to read through the entire document. Let's take the latest Nvidia conference call. I can instruct Gemini to summarize the text from a specific link.
SUMMARIZE THE TEXT FROM THIS LINK - [https://in.investing.com/news/transcripts/earnings-call-transcript-nvidia-q4-2026-beats-expectations-stock-rises-93CH-5258698](https://in.investing.com/news/transcripts/earnings-call-transcript-nvidia-q4-2026-beats-expectations-stock-rises-93CH-5258698)
The output from the model gives us -
NVIDIA’s Fourth Quarter Fiscal 2026 earnings call, held on February 25, 2026, highlighted another record-breaking period driven by the "agentic AI" inflection point and the rapid rollout of the Blackwell architecture.
The following is a summary of the key financial results and strategic highlights from the call:
1. Record-Breaking Financial Performance
Revenue: Reached a record $68.1 billion, up 20% sequentially and 73% year-over-year, beating analyst expectations of ~$65.6 billion.
Earnings Per Share (EPS): Reported at $1.62 (Non-GAAP) and $1.76 (GAAP), surpassing the consensus estimate of $1.52.
Gross Margins: Maintained exceptionally high levels at 75.2% (Non-GAAP), reflecting strong pricing power and operational efficiency.
Fiscal Year 2026 Totals: Full-year revenue reached $215.9 billion, a 65% increase from the previous year.
2. Segment Highlights
Data Center (The Growth Engine): Revenue hit a record $62.3 billion (up 75% YoY). This segment now accounts for over 90% of NVIDIA's total revenue. Growth was fueled by "Blackwell" and "Rubin" architectures and a massive shift toward GPU-accelerated computing.
Networking: Generated $11 billion in revenue, growing 3.5x year-over-year. This was driven by the adoption of NVLink, Spectrum-X Ethernet, and InfiniBand as customers scale their AI clusters.
Gaming & AI PC: Revenue was $3.7 billion (up 47% YoY). While strong annually, it saw a 13% sequential dip as inventory levels normalized after the holiday season.
Professional Visualization: Revenue rose 159% YoY to $1.3 billion, driven by demand for Blackwell-based workstations and the NVIDIA Omniverse.
3. Strategic Key Takeaways
The "Agentic AI" Era: CEO Jensen Huang emphasized that the world is moving beyond simple chatbots to "agentic AI"—autonomous AI agents that can reason and execute complex tasks. This is driving a new wave of industrial AI investment.
Blackwell Production: Management confirmed that Blackwell is in full production and seeing "exceptional" demand. They expect sequential revenue growth throughout calendar 2026.
Sovereign AI: A significant portion of growth is now coming from "Sovereign AI," as nations invest in their own domestic AI infrastructure and data centers.
Shareholder Returns: NVIDIA returned $41.1 billion to shareholders in FY2026 through buybacks and dividends, with $58.5 billion still remaining in its authorized repurchase program.
4. Future Outlook (Q1 Fiscal 2027)
Revenue Guidance: Projected to be $78.0 billion (plus or minus 2%), which is significantly higher than previous market expectations.
China Impact: The company noted that its outlook assumes zero Data Center compute revenue from China due to ongoing export controls.
Margins: Expected to remain stable at approximately 75%.
Market Reaction: Following the announcement, the stock rose in after-hours trading as the "beat and raise" calmed fears of an AI spending slowdown. Analysts subsequently raised price targets, with some reaching as high as $300–$325.
Earnings call
Thus providing you with a fast and easy way to understand a call that went on for 1 hour without listening or reading the entire transcript.
Python Code
First I ask gemini to find the latest earnings transcript I want to analyze
link for the latest nvidia conference call from motley fool
Note: I need to use motley fool because they do not block API access
As a Google cloud developer I use AI to help speed up the process or debug issues in code. I can use AI to either generate new code or change existing code based upon parameters that I provide. Staying with the same Example, ask the model to provide document and paragraph level sentiment for an earnings call.
As a python developer build a program using google cloud nlp libraries to extract the document and paragraph level sentiment scores with of the following article link - https://www.fool.com/earnings/call-transcripts/2026/02/25/nvidia-nvda-q4-2026-earnings-call-transcript/ - the output should be in JSON format - limit paragraph scores to first 10 paragraphs
Google will provide the code and a proper way to implement it on the cloud.
Results:
To fulfill your request, I have developed a Python solution that utilizes the Google Cloud Natural Language API to perform sentiment analysis on the document and the first 10 paragraphs of the Nvidia Q4 2026 earnings call transcript.
john_iacovacci1@cloudshell:~ (cloud-project-examples)$ mkdir prompt-eng
john_iacovacci1@cloudshell:~ (cloud-project-examples)$ cd prompt-eng/
john_iacovacci1@cloudshell:~/prompt-eng (cloud-project-examples)$ gcloud services enable language.googleapis.com
Note: Use your JSON key not mine
john_iacovacci1@cloudshell:~/prompt-eng (cloud-project-examples)$ export GOOGLE_APPLICATION_CREDENTIALS="/home/john_iacovacci1/cloud-project-examples-316c375c6892.json"
john_iacovacci1@cloudshell:~/prompt-eng (cloud-project-examples)$ pip install google-cloud-language beautifulsoup4 requests
Python code from gemini - sent_scores.py
========================================================
import json
from google.cloud import language_v1
import requests
from bs4 import BeautifulSoup
def analyze_sentiment(text_content):
"""Performs sentiment analysis using Google Cloud NLP."""
client = language_v1.LanguageServiceClient()
document = language_v1.Document(
content=text_content,
type_=language_v1.Document.Type.PLAIN_TEXT
)
# Extract Document and Sentence level sentiment
response = client.analyze_sentiment(request={'document': document})
return response
def get_transcript_paragraphs(url, limit=10):
"""Scrapes the transcript and extracts the first N paragraphs."""
headers = {'User-Agent': 'Mozilla/5.0'}
page = requests.get(url, headers=headers)
soup = BeautifulSoup(page.content, 'html.parser')
# Finding transcript text - typically within 'article-body' or specific divs
# This selector is optimized for the Motley Fool layout
content = soup.find('div', class_='article-body')
paragraphs = [p.get_text().strip() for p in content.find_all('p') if p.get_text().strip()]
return paragraphs[:limit]
def main():
url = "https://www.fool.com/earnings/call-transcripts/2026/02/25/nvidia-nvda-q4-2026-earnings-call-transcript/"
# 1. Extract content
paragraphs = get_transcript_paragraphs(url, limit=10)
full_text = "\n".join(paragraphs)
# 2. Call Google Cloud NLP
# Analyze the whole document (first 10 paragraphs combined)
doc_response = analyze_sentiment(full_text)
output = {
"document_sentiment": {
"score": round(doc_response.document_sentiment.score, 2),
"magnitude": round(doc_response.document_sentiment.magnitude, 2)
},
"paragraph_sentiments": []
}
# 3. Analyze each paragraph individually
for i, para in enumerate(paragraphs):
para_response = analyze_sentiment(para)
output["paragraph_sentiments"].append({
"paragraph_index": i + 1,
"text_snippet": para[:100] + "...",
"score": round(para_response.document_sentiment.score, 2),
"magnitude": round(para_response.document_sentiment.magnitude, 2)
})
# 4. Export to JSON
print(json.dumps(output, indent=4))
if __name__ == "__main__":
main()
========================================================
Results:
john_iacovacci1@cloudshell:~/prompt-eng (cloud-project-examples)$ python3 sent_scores.py
{
"document_sentiment": {
"score": 0.1,
"magnitude": 13.3
},
"paragraph_sentiments": [
{
"paragraph_index": 1,
"text_snippet": "Image source: The Motley Fool....",
"score": 0.1,
"magnitude": 0.1
},
{
"paragraph_index": 2,
"text_snippet": "Wednesday, Feb. 25, 2026 at 5 p.m. ET...",
"score": 0.0,
"magnitude": 0.0
},
{
"paragraph_index": 3,
"text_snippet": "Need a quote from a Motley Fool analyst? Email [email\u00a0protected]...",
"score": 0.0,
"magnitude": 0.2
},
{
"paragraph_index": 4,
"text_snippet": "The call revealed outsized growth in Data Center and Networking revenue underpinned by expanded cust...",
"score": 0.5,
"magnitude": 2.0
},
{
"paragraph_index": 5,
"text_snippet": "Toshiya Hari: Good afternoon, everyone, and welcome to NVIDIA Corporation's conference call for 2026...",
"score": -0.1,
"magnitude": 1.8
},
{
"paragraph_index": 6,
"text_snippet": "For a discussion of factors that could affect our future financial results and business, please refe...",
"score": -0.1,
"magnitude": 1.0
},
{
"paragraph_index": 7,
"text_snippet": "Colette Kress: Thanks, Toshiya. We delivered another outstanding quarter, with record revenue, opera...",
"score": 0.5,
"magnitude": 3.0
},
{
"paragraph_index": 8,
"text_snippet": "Agentic and physical AI applications built on increasingly smarter and multimodal models are beginni...",
"score": 0.4,
"magnitude": 0.4
},
{
"paragraph_index": 9,
"text_snippet": "On a full-year basis, Data Center generated revenue of $194,000,000,000, up 68% year over year. We h...",
"score": 0.0,
"magnitude": 1.8
},
{
"paragraph_index": 10,
"text_snippet": "SemiAnalysis declared NVIDIA Corporation inference king as recent results from InferenceX reinforced...",
"score": 0.7,
"magnitude": 2.9
}
]
}
john_iacovacci1@cloudshell:~/prompt-eng (cloud-project-examples)$
No comments:
Post a Comment