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) - Add GCS Pub/Sub Logging integration for sending DB SpendLogs to BigQuery #7976

Merged
merged 16 commits into from
Jan 25, 2025

Conversation

ishaan-jaff
Copy link
Contributor

@ishaan-jaff ishaan-jaff commented Jan 24, 2025

(Feat) - Add GCS Pub/Sub Logging integration for sending DB SpendLogs to BigQuery

Google Cloud Storage - PubSub Topic

Log LLM Logs/SpendLogs to Google Cloud Storage PubSub Topic

Property Details
Description Log LiteLLM SpendLogs Table to Google Cloud Storage PubSub Topic

When to use gcs_pubsub?

  • If your LiteLLM Database has crossed 1M+ spend logs and you want to send SpendLogs to a PubSub Topic that can be consumed by GCS BigQuery

Usage

  1. Add gcs_pubsub to LiteLLM Config.yaml
model_list:
- litellm_params:
    api_base: https://exampleopenaiendpoint-production.up.railway.app/
    api_key: my-fake-key
    model: openai/my-fake-model
  model_name: fake-openai-endpoint

litellm_settings:
  callbacks: ["gcs_pubsub"] # 👈 KEY CHANGE # 👈 KEY CHANGE
  1. Set required env variables
GCS_PUBSUB_TOPIC_ID="litellmDB"
GCS_PUBSUB_PROJECT_ID="reliableKeys"
  1. Start Proxy
litellm --config /path/to/config.yaml
  1. Test it!
curl --location 'http://0.0.0.0:4000/chat/completions' \
--header 'Content-Type: application/json' \
--data ' {
      "model": "fake-openai-endpoint",
      "messages": [
        {
          "role": "user",
          "content": "what llm are you"
        }
      ],
    }
'

Relevant issues

Type

🆕 New Feature
✅ Test

Changes

[REQUIRED] Testing - Attach a screenshot of any new tests passing locally

If UI changes, send a screenshot/GIF of working UI fixes

Copy link

vercel bot commented Jan 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 25, 2025 4:58am

@ishaan-jaff ishaan-jaff merged commit 74caef0 into main Jan 25, 2025
3 of 18 checks passed
jarobey pushed a commit to jarobey/litellm that referenced this pull request Jan 28, 2025
…s` to BigQuery (BerriAI#7976)

* add pub_sub

* fix custom batch logger for GCS PUB/SUB

* GCS_PUBSUB_PROJECT_ID

* e2e gcs pub sub

* add gcs pub sub

* fix logging

* add GcsPubSubLogger

* fix pub sub

* add pub sub

* docs gcs pub / sub

* docs on pub sub controls

* test_gcs_pub_sub

* fix publish_message

* test_async_gcs_pub_sub

* test_async_gcs_pub_sub
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.

1 participant