Skip to content

feat(py): add telemetry plugins and new model providers (Mistral AI, Hugging Face)#4406

Merged
yesudeep merged 6 commits intomainfrom
yesudeep/feat/uptight-language
Feb 2, 2026
Merged

feat(py): add telemetry plugins and new model providers (Mistral AI, Hugging Face)#4406
yesudeep merged 6 commits intomainfrom
yesudeep/feat/uptight-language

Conversation

@yesudeep
Copy link
Contributor

@yesudeep yesudeep commented Feb 2, 2026

Summary

This PR introduces three new telemetry plugins and two new model provider plugins for the Python SDK, enabling Genkit users to export observability data to various backends and access additional AI models.

Note: This PR temporarily ignores some Ruff security/async linting rules (S110, S112, S310, T201) for the core framework (packages/genkit/) via per-file-ignores. The actual fixes require changes to the core framework and will be addressed in a separate PR once the core team can review. See commit 09aa1df7d.

New Plugins

Telemetry Plugins

Plugin Package Purpose
Azure genkit-plugin-azure Export traces to Azure Application Insights
Cloudflare (CF) genkit-plugin-cf Export traces via OTLP to any compatible backend
Observability genkit-plugin-observability Unified presets for Sentry, Honeycomb, Datadog, Grafana, Axiom

Model Provider Plugins (NEW)

Plugin Package Purpose
Mistral AI genkit-plugin-mistral Native Mistral AI integration (Large, Small, Codestral, Pixtral)
Hugging Face genkit-plugin-huggingface Access to 1M+ models via HF Inference API

Plugin Architecture

┌─────────────────────────────────────────────────────────────────────────┐
│                    TELEMETRY PLUGIN SELECTION GUIDE                     │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│   "I want native AWS X-Ray"           → aws plugin (existing)           │
│   "I want native GCP Cloud Trace"     → google-cloud plugin (existing)  │
│   "I want native Azure App Insights"  → azure plugin (NEW)              │
│                                                                         │
│   "I'm on AWS but want Honeycomb"     → observability plugin (NEW)      │
│   "I'm on GCP but want Sentry"        → observability plugin (NEW)      │
│   "I'm multi-cloud, want Datadog"     → observability plugin (NEW)      │
│   "I want generic OTLP export"        → cf plugin (NEW)                 │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────────────┐
│                    MODEL PROVIDER SELECTION GUIDE                       │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│   "I want Mistral AI models"          → mistral plugin (NEW)            │
│       • mistral-large-latest (complex reasoning)                        │
│       • mistral-small-latest (fast, efficient)                          │
│       • codestral-latest (code generation)                              │
│       • pixtral-large-latest (vision-language)                          │
│                                                                         │
│   "I want 1M+ open source models"     → huggingface plugin (NEW)        │
│       • meta-llama/Llama-3.3-70B-Instruct                               │
│       • Qwen/Qwen2.5-72B-Instruct                                       │
│       • google/gemma-2-27b-it                                           │
│       • Any model on huggingface.co                                     │
│       • 17+ inference providers (Cerebras, Groq, Together)              │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

Changes

New Model Provider Plugins (py/plugins/)

  • mistral/ - Mistral AI plugin

    • Mistral plugin class with lazy model loading
    • Supported models: mistral-large-latest, mistral-small-latest, codestral-latest, pixtral-large-latest, ministral-8b/3b-latest
    • Chat completion with streaming support
    • Tool calling and structured output support
    • Uses official mistralai Python SDK
    • Environment variable: MISTRAL_API_KEY
    • Comprehensive unit tests
  • huggingface/ - Hugging Face plugin

    • HuggingFace plugin class with lazy model loading
    • Access to 1,000,000+ models on huggingface.co
    • Inference providers support (Cerebras, Groq, Together, etc.)
    • Chat completion with streaming support
    • Tool calling and structured output support
    • Uses official huggingface_hub Python SDK
    • Environment variable: HF_TOKEN
    • Comprehensive unit tests

New Telemetry Plugins (py/plugins/)

  • azure/ - Azure Application Insights telemetry plugin

    • add_azure_telemetry() function for easy setup
    • Uses official Azure Monitor OpenTelemetry exporter (optional dependency)
    • Falls back to generic OTLP if Azure SDK not installed
    • PII redaction enabled by default
    • Structured logging with trace correlation (trace_id, span_id)
    • Unit tests
  • cf/ - Cloudflare/OTLP telemetry plugin

    • add_cf_telemetry() function for OTLP export
    • Bearer token authentication support
    • Works with any OTLP-compatible backend (Grafana, Honeycomb, etc.)
    • Structured logging with trace correlation
    • Unit tests
  • observability/ - Third-party observability presets

    • configure_telemetry() with backend presets
    • Supported backends: Sentry, Honeycomb, Datadog, Grafana Cloud, Axiom
    • Custom OTLP endpoint support
    • Uses official environment variable names for each provider
    • Structured logging with trace correlation (log-trace linking)
    • Unit tests

New Samples (py/samples/)

  • mistral-hello/ - Mistral AI demo (chat, streaming, tool calling, structured output)
  • huggingface-hello/ - Hugging Face demo (multiple models, streaming, tool calling)
  • azure-hello/ - Azure Application Insights demo
  • cf-hello/ - Generic OTLP export demo
  • observability-hello/ - Third-party backend demo (Honeycomb example)

Test Coverage

Added comprehensive unit tests for all new plugins:

  • plugins/mistral/tests/ - Plugin and model tests
  • plugins/huggingface/tests/ - Plugin and model tests
  • plugins/azure/tests/ - Plugin tests
  • plugins/cf/tests/ - Plugin tests
  • plugins/observability/tests/ - Plugin tests
  • plugins/google-genai/tests/ - Plugin tests
  • plugins/firebase/tests/ - Plugin tests
  • plugins/evaluators/tests/ - Plugin tests
  • plugins/dev-local-vectorstore/tests/ - Plugin tests
  • plugins/vertex-ai/tests/ - Plugin tests

Release Automation (py/bin/)

  • check_consistency - Automated consistency checker (18 checks):

    • Python version consistency
    • Plugin version sync
    • Package naming consistency
    • Workspace completeness
    • Test file naming convention
    • README files exist
    • LICENSE files exist
    • py.typed marker files (PEP 561)
    • Dependency resolution
    • In-function imports detection
    • Required pyproject.toml fields
    • Sample run.sh scripts
    • Hardcoded secrets detection
    • Typos and spelling errors
    • __all__ exports for IDE autocomplete
    • Broad # type: ignore comments
    • Python version classifiers (3.10-3.14)
    • Namespace package __init__.py validation
  • release_check - Comprehensive pre-release validation

  • bump_version - Automated version bumping

  • fix_classifiers.py - Add missing PyPI classifiers

  • fix_package_metadata.py - Add missing keywords and URLs

Documentation Updates

  • py/GEMINI.md - Comprehensive updates:
    • Marked bin/lint as mandatory for all PRs
    • Added URL verification requirements
    • Added test coverage requirements
    • Added workspace completeness checks
    • Added naming consistency requirements
    • Added dependency verification best practices
    • Added release process documentation
    • Added automated consistency checks table
    • Updated provider documentation links table
  • py/plugins/README.md - Updated plugin tables with Mistral and Hugging Face
  • py/samples/README.md - Updated environment variables documentation
  • py/engdoc/parity-analysis/roadmap.md - Added M8 section for new model provider plugins
  • py/CHANGELOG.md - Created changelog file

Configuration Updates

  • py/pyproject.toml - Added workspace sources for new plugins and samples, added deptry and typos to lint dependencies, temporarily ignored security/async rules for core framework
  • bin/lint - Added license check (bin/check_license) and consistency check (py/bin/check_consistency)
  • py/typos.toml - Created typos configuration for spell checking

Bug Fixes

  • plugins/cf-ai/models/model_info.py - Fixed Gemma 7B model prefix (@hf/google/gemma-7b-it instead of @cf/google/gemma-7b-it)
  • plugins/google-cloud/tests/tracing_test.py - Fixed test to clear project env vars
  • Sample naming consistency - Fixed mismatches between directory names and package names:
    • evaluator-demo/ package name: eval-demoevaluator-demo
    • model-garden/ package name: model-garden-examplemodel-garden
    • ollama-simple-embed/ package name: ollama_simple_embedollama-simple-embed
  • samples/evaluator-demo/evaluator_demo/eval_in_code.py - Fixed typo "programatically" → "programmatically"

Environment Variables

Model Providers

Variable Plugin Documentation
MISTRAL_API_KEY mistral Mistral Console
HF_TOKEN huggingface HF Tokens

Telemetry

Backend Environment Variables Documentation
Sentry SENTRY_DSN Sentry OTLP
Honeycomb HONEYCOMB_API_KEY, HONEYCOMB_DATASET* Honeycomb API Keys
Datadog DD_API_KEY, DD_SITE* Datadog OTLP
Grafana Cloud GRAFANA_OTLP_ENDPOINT, GRAFANA_USER_ID, GRAFANA_API_KEY Grafana Cloud OTLP
Axiom AXIOM_TOKEN, AXIOM_DATASET* Axiom API Tokens

*Optional

Test Plan

  • bin/lint passes with 0 errors (with temporary ignores for core framework)
  • All type checkers pass (ty, pyrefly, pyright)
  • Security checks pass (PySentry)
  • License checks pass (bin/check_license)
  • Unit tests pass (uv run pytest .)
  • Cross-checked all plugins against official provider documentation
  • Sample naming consistency verified
  • All plugins and samples added to workspace
  • Python 3.10-3.14 classifiers verified for all packages
  • Namespace package structure verified (no __init__.py in genkit/ or genkit/plugins/)
  • Manual testing with Mistral API key
  • Manual testing with Hugging Face token
  • Manual testing with Azure Application Insights credentials
  • Manual testing with Honeycomb API key

Follow-up Work

The following will be addressed in a separate PR once the core team can review:

  • Fix S310 (urllib.request.urlopen) - replace with httpx async client
  • Fix S112 (try-except-continue) - add explicit noqa comments with justification
  • Fix S110 (try-except-pass) - add explicit noqa comments with justification
  • Fix T201 (print) - replace with logging or warnings.warn

@github-actions github-actions bot added docs Improvements or additions to documentation feature New feature or request python Python config labels Feb 2, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @yesudeep, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly expands the Python Genkit framework's observability capabilities by integrating with a wider range of telemetry providers. It introduces new plugins for Azure Application Insights and generic OTLP export (compatible with Cloudflare and others), alongside a versatile observability plugin that supports popular third-party services through pre-configured settings. These additions are accompanied by comprehensive documentation updates and new sample applications, making it easier for developers to monitor their Genkit applications across diverse cloud and observability platforms.

Highlights

  • New Telemetry Plugins: Introduced three new telemetry plugins: one for Azure Application Insights, one for Cloudflare (generic OTLP export), and a general observability plugin with presets for various third-party backends like Sentry, Honeycomb, Datadog, Grafana, and Axiom.
  • Updated Documentation and Guidelines: The py/GEMINI.md file has been significantly updated with new guidelines for plugin development, including detailed sections on sample entry points, environment variable naming conventions, model configuration parameters, and telemetry plugin conventions. The main py/plugins/README.md and py/samples/README.md files have also been updated to reflect the new plugins and samples.
  • New Sample Applications: Added dedicated sample applications (azure-hello, cf-hello, observability-hello) to demonstrate the usage and configuration of each new telemetry plugin, complete with README.md files, pyproject.toml configurations, run.sh scripts, and example main.py files.
  • Test Improvements: A test in py/plugins/google-cloud/tests/tracing_test.py was updated to ensure environment variables are correctly cleared, improving test reliability for project ID resolution.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@yesudeep yesudeep force-pushed the yesudeep/feat/uptight-language branch from cb79c61 to 60dbf87 Compare February 2, 2026 02:32
@yesudeep yesudeep changed the title feat: more plugins feat(py): add placeholder telemetry plugins (azure, cf, observability) Feb 2, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces three valuable telemetry plugins for Azure, Cloudflare (and other OTLP backends), and a general observability plugin for popular third-party platforms. The code is well-structured and includes comprehensive documentation and samples. My review focuses on the observability plugin, where I've identified a critical issue with the Sentry configuration and a couple of medium-severity improvement opportunities related to the Grafana configuration and log-trace correlation that would enhance usability and align it with the other new telemetry plugins.

@yesudeep yesudeep force-pushed the yesudeep/feat/uptight-language branch 2 times, most recently from 1dcbf64 to b0f1dd7 Compare February 2, 2026 02:49
@yesudeep
Copy link
Contributor Author

yesudeep commented Feb 2, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This PR is a significant feature addition, introducing three new telemetry plugins (azure, cf, observability) and corresponding samples. The code quality is high, with excellent documentation in docstrings, including diagrams and ELI5 explanations. The plugin design, especially the observability plugin with its backend presets, is well-thought-out and provides a great user experience. The changes to the development guidelines and the new README.md for samples are also valuable additions. I've identified a few areas for improvement related to packaging configuration, test clarity, and the robustness of the Sentry integration. Overall, this is a fantastic contribution.

@yesudeep yesudeep force-pushed the yesudeep/feat/uptight-language branch 6 times, most recently from 5c4bd58 to 5f4fdf4 Compare February 2, 2026 03:12
@yesudeep
Copy link
Contributor Author

yesudeep commented Feb 2, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is an impressive and substantial contribution. You've added three powerful telemetry plugins (azure, cf, observability) that significantly expand Genkit's observability capabilities. The architecture of these plugins, especially the observability plugin with its backend presets, is well-designed and provides a great user experience. The new samples are clear and will be very helpful for users to get started.

The extensive documentation updates, including the new plugin development guidelines in GEMINI.md and the comprehensive README files, are of very high quality and will be invaluable for the community and future contributors. The attention to detail, like fixing the Mistral model prefix and improving the Grafana auth flow, is also appreciated.

I found one minor inconsistency in the new documentation, which I've commented on. Overall, this is an excellent pull request that greatly enhances the Genkit Python SDK.

@yesudeep yesudeep force-pushed the yesudeep/feat/uptight-language branch 4 times, most recently from 95e9ad0 to 4f4c1b6 Compare February 2, 2026 03:35
@yesudeep yesudeep changed the title feat(py): add placeholder telemetry plugins (azure, cf, observability) feat(py): add telemetry plugins and new model providers (Mistral AI, Hugging Face) Feb 2, 2026
@yesudeep yesudeep force-pushed the yesudeep/feat/uptight-language branch from 4f4c1b6 to 451761b Compare February 2, 2026 03:37
@yesudeep yesudeep requested a review from huangjeff5 as a code owner February 2, 2026 05:26
@yesudeep yesudeep force-pushed the yesudeep/feat/uptight-language branch 8 times, most recently from 761b5f6 to 54d50a4 Compare February 2, 2026 06:24
@yesudeep yesudeep force-pushed the yesudeep/feat/uptight-language branch from 54d50a4 to 8a91a67 Compare February 2, 2026 06:26
…ramework

The new Ruff security (S110, S112, S310) and print (T201) rules require
changes to the core framework code. Since the core framework code owner
is unavailable for approvals, temporarily ignore these rules for the
packages/genkit/ directory.

These will be addressed in a separate PR with core framework changes.
@yesudeep
Copy link
Contributor Author

yesudeep commented Feb 2, 2026

/gemini review

… URLs directly

The test was trying to use httpx to fetch a data URL, but httpx only
supports http:// and https:// protocols. Data URLs are inline base64
encoded data and should be decoded directly.

Changed the test to:
- Parse the data URL and verify its format
- Decode the base64 content directly
- Compare with expected bytes
Same fix as the Gemini test - decode data URLs directly instead of
trying to fetch them with httpx (which only supports http/https).
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is an impressive pull request that significantly expands the capabilities of the Genkit Python SDK. The addition of new telemetry plugins (Azure, Cloudflare/OTLP, Observability presets) and major model providers (Mistral AI, Hugging Face) is a huge win for users. I'm particularly impressed by the extensive work on release automation and consistency checking, which will greatly improve the long-term maintainability of the repository. The updates to the GEMINI.md contributing guide are thorough and set a high standard for future contributions. The code quality is generally high, with good use of modern Python features and a clear focus on async best practices. My review includes a few minor suggestions for improving code clarity and consistency.

- msfoundry: Sort __all__ exports alphabetically for maintainability
- google-genai-code-execution sample: Restore display_code_execution
  function with proper print statements (samples are allowed to use
  print for demonstration purposes, with noqa comments)
@yesudeep
Copy link
Contributor Author

yesudeep commented Feb 2, 2026

/gemini review

@yesudeep yesudeep enabled auto-merge (squash) February 2, 2026 06:44
@yesudeep yesudeep disabled auto-merge February 2, 2026 06:45
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is an impressive and substantial pull request that adds significant new functionality with telemetry and model provider plugins. The quality of the new code is very high, with excellent documentation, robust automation scripts, and adherence to best practices. The refactoring of existing code to use modern Python features like pathlib and aiofiles is also a great improvement. I've only found a couple of minor opportunities for improvement related to performance and code consistency.

@yesudeep yesudeep enabled auto-merge (squash) February 2, 2026 06:53
Replace mixed os.path.join/pathlib.Path usage with pure pathlib
operators for better readability and modern Python practices.
@yesudeep yesudeep force-pushed the yesudeep/feat/uptight-language branch from 2bb113e to 8c8097a Compare February 2, 2026 06:54
@yesudeep yesudeep merged commit 0bfaea6 into main Feb 2, 2026
23 checks passed
@yesudeep yesudeep deleted the yesudeep/feat/uptight-language branch February 2, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config docs Improvements or additions to documentation feature New feature or request python Python

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants