-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstep1_llm.py
More file actions
34 lines (28 loc) · 1.01 KB
/
Copy pathstep1_llm.py
File metadata and controls
34 lines (28 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
STEP 1 — A plain LLM call.
Goal: see the simplest possible interaction with an LLM,
and discover its main limitation: it can't act on the world.
"""
import os
import sys
sys.stdout.reconfigure(encoding='utf-8')
from dotenv import load_dotenv
from google import genai
load_dotenv()
# The client auto-reads the GEMINI_API_KEY environment variable.
client = genai.Client()
MODEL = "gemma-4-31b-it"
# A question the LLM CAN answer from training data
print("\n--- Q1: something it knows ---")
print(client.models.generate_content(
model=MODEL,
contents="In one sentence, what is retrieval-augmented generation (RAG)?",
).text)
# A question the LLM CANNOT answer — it has no tools, no web, no clock
print("\n--- Q2: something it CANNOT know ---")
print(client.models.generate_content(
model=MODEL,
contents="What is NVIDIA's latest stock price right now, and what is 22% of that?",
).text)
print("\n👉 Notice: the second answer is hallucinated or refused.")
print(" That's why we need TOOLS. On to step 2!")