Skip to content

DataForScience/ClaudeAI

Repository files navigation

GitHub Twitter @data4sci GitHub top language GitHub repo size GitHub last commit

Data For Science Substack Data Science Briefing

Claude API for Python Developers

Anthropic has quickly become one of the leaders in generative AI foundation models. Anthropic’s Claude family of models (Haiku, Sonnet, and Opus) have proven to be able to process various visual formats, a high degree of accuracy, generate high-quality code all while keeping hallucinations under control.

In this course, we will introduce the main concepts behind this class of models and how their functionality is made accessible through the Anthropic API. We will build example applications to illustrate the use of each of these tools and how they can be composed and highlight when to use each model to obtain high-quality outputs at the lowest cost.

References

Contents

This tutorial is divided into five parts:

1. Generative AI and Anthropic

Introduction to generative AI concepts.

  • Basic Principles
  • Transformers
  • Large Language Models
  • Temperature
  • Hallucinations
  • Image Models
  • API Structure

Notebook: 1. Generative AI.ipynb

2. Claude Models

Getting started with the Claude API.

  • Basic Usage
  • Input Formatting
  • Multi-Step Prompts
  • Document Summarization

Notebook: 2. Claude Models.ipynb

3. Embeddings

Working with text embeddings using Voyage AI

  • Understanding Embeddings
  • Questing Answering
  • Recommendations
  • Long Texts

Notebook: 3. Embeddings.ipynb

4. Tools and Agents

Implementing function calling with Claude.

  • Tool Overview
  • Structured Outputs
  • Choosing the Right Tool
  • Workflow

Notebook: 4. Tools.ipynb

5. Code Generation and Explanation

Best practices for prompting Claude to write and analyze code.

  • Generating Code from a Prompt
  • Explaining Existing Code
  • Generating Comments

Notebook: 5. Code Generation.ipynb

Environment Setup

This project manages dependencies using uv (recommended) or standard pip.

Prerequisites

  • Python 3.13 or higher (as specified in pyproject.toml)

Option 1: Using uv (Recommended)

This repository includes a uv.lock file for reproducible environments.

  1. Install uv: Follow instructions at docs.astral.sh/uv.
  2. Sync dependencies:
    uv sync
  3. Run Jupyter:
    uv run jupyter notebook

Option 2: Using pip

You can install the dependencies directly from the pyproject.toml file.

pip install .

Author

Bruno Gonçalves

Bruno Gonçalves

Data For Science, Inc.

Web: www.data4sci.com
Twitter/X: @bgoncalves
LinkedIn: @bmtgoncalves
Email: info@data4sci.com
Schedule a Call: https://data4sci.com/call

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published