Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(llmobs): submit llmobs payloads from gemini integration #10619

Merged
merged 39 commits into from
Sep 11, 2024

Conversation

Yun-Kim
Copy link
Contributor

@Yun-Kim Yun-Kim commented Sep 10, 2024

This PR enables submitting LLMObs spans from the Gemini integration.

generate_content/generate_content_async() calls are traced by the Gemini APM integration. This PR also generates LLMObs span events from those spans and submits them to LLM Observability.

The following data is collected by Gemini LLMObs spans:

  • span kind: LLM
  • provider: google
  • model name
  • metadata: collects any of (temperature/max_output_tokens/candidate_count/top_p/top_k) if set on the model instance or in the request itself
  • input messages: includes system instruction as a system message (if provided), and history of input messages passed to the model/request (also includes function calls/responses in addition to text messages)
  • output_messages: self explanatory (also includes function calls in addition to text responses)
  • metrics: token metrics (input/output/total)
  • additional span data provided ootb by LLMObs (span duration/error/tags/etc)

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

@Yun-Kim Yun-Kim requested review from a team as code owners September 10, 2024 19:44
@Yun-Kim Yun-Kim requested review from emmettbutler and romainkomorndatadog and removed request for a team September 10, 2024 19:44
@Yun-Kim Yun-Kim marked this pull request as draft September 10, 2024 19:45
Copy link
Contributor

github-actions bot commented Sep 10, 2024

CODEOWNERS have been resolved as:

releasenotes/notes/feat-llmobs-gemini-b65c714ceef9eb12.yaml             @DataDog/apm-python
tests/contrib/google_generativeai/test_google_generativeai_llmobs.py    @DataDog/ml-observability
ddtrace/contrib/google_generativeai/__init__.py                         @DataDog/ml-observability
ddtrace/contrib/internal/google_generativeai/_utils.py                  @DataDog/ml-observability
ddtrace/contrib/internal/google_generativeai/patch.py                   @DataDog/ml-observability
ddtrace/llmobs/_constants.py                                            @DataDog/ml-observability
ddtrace/llmobs/_integrations/gemini.py                                  @DataDog/ml-observability
ddtrace/llmobs/_utils.py                                                @DataDog/ml-observability
tests/contrib/google_generativeai/conftest.py                           @DataDog/ml-observability
tests/llmobs/_utils.py                                                  @DataDog/ml-observability

@pr-commenter
Copy link

pr-commenter bot commented Sep 10, 2024

Benchmarks

Benchmark execution time: 2024-09-11 21:26:06

Comparing candidate commit cc859e6 in PR branch yunkim/llmobs-gemini with baseline commit c0fd013 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 353 metrics, 47 unstable metrics.

ddtrace/llmobs/_integrations/gemini.py Outdated Show resolved Hide resolved
ddtrace/llmobs/_integrations/gemini.py Outdated Show resolved Hide resolved
ddtrace/llmobs/_integrations/gemini.py Outdated Show resolved Hide resolved
ddtrace/llmobs/_integrations/gemini.py Outdated Show resolved Hide resolved
@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Sep 10, 2024

Datadog Report

Branch report: yunkim/llmobs-gemini
Commit report: d6379e6
Test service: dd-trace-py

✅ 0 Failed, 3724 Passed, 5180 Skipped, 53m 46.44s Total duration (1h 13m 21.8s time saved)

@yahya-mouman
Copy link
Contributor

Besides some test CIs are failing for assertions. It looks good to me 👍

Base automatically changed from yunkim/gemini-integration to main September 11, 2024 20:45
@Yun-Kim Yun-Kim requested review from a team as code owners September 11, 2024 20:45
@Yun-Kim Yun-Kim enabled auto-merge (squash) September 11, 2024 20:49
@Yun-Kim Yun-Kim merged commit dc7e31e into main Sep 11, 2024
517 of 518 checks passed
@Yun-Kim Yun-Kim deleted the yunkim/llmobs-gemini branch September 11, 2024 21:27
Copy link
Contributor

The backport to 2.13 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.13 2.13
# Navigate to the new working tree
cd .worktrees/backport-2.13
# Create a new branch
git switch --create backport-10619-to-2.13
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 dc7e31ecd0e06735d850e5c317f2ee18fed98c32
# Push it to GitHub
git push --set-upstream origin backport-10619-to-2.13
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.13

Then, create a pull request where the base branch is 2.13 and the compare/head branch is backport-10619-to-2.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants