Module 1 Wrap-up: Verification and First Call
·LangChain

Module 1 Wrap-up: Verification and First Call

Hands-on: Verify your complete installation and take the Module 1 challenge.

Module 1 Wrap-up: System Check

Congratulations! You have completed the foundational setup. In the professional world, this is the phase where most projects fail due to configuration errors. You have navigated virtual environments, package modularity, and secret management.


Hands-on Challenge: The Explorer

Now that you have your first run working, let's try to find out more about your "Brain."

1. The Task

Modify your hello_langchain.py to print not just the content, but the token usage metadata.

2. The Solution Snippet

# ... setup code ...
response = model.invoke("Write a 3-word sentence.")

print(f"Content: {response.content}")
print(f"Tokens Used: {response.response_metadata['token_usage']}")

3. Verification Checklist

  • I can see (venv) in my terminal.
  • My .env file does NOT have quotes around the API key.
  • I have verified that .env is listed in my .gitignore.
  • My script runs without a "ModuleNotFoundError".

Module 1 Summary

  • Setup: We built an isolated sandbox for our code.
  • Libraries: We learned about the modular structure of LangChain.
  • Secrets: We learned how to move keys from code to environment files.
  • Execution: We performed a successful invocation of a Cloud LLM.

Coming Up Next...

In Module 2, we explore the Models abstraction in depth. We will learn the difference between Chat and Completion models, and how to use Streaming to make your apps feel faster.


Module 1 Quiz

  1. What is the command to create a virtual environment?
  2. Why should we install langchain-openai instead of just the OpenAI Python library?
  3. What happens if you forget to run load_dotenv()?
  4. What is the standard parameter name for controlling model "creativity"?

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn