Skip to content

Commit

Permalink
Update lago.py to accomodate API change (BerriAI#5495) (BerriAI#5543)
Browse files Browse the repository at this point in the history
* Update lago.py to accomodate API change (BerriAI#5495)

external_customer_id is deprecated. 

external_subscription_id is the replacement.

* fix(lago.py): fixes

\

---------

Co-authored-by: Raymond Weitekamp <19483938+rawwerks@users.noreply.github.com>
  • Loading branch information
krrishdholakia and rawwerks committed Sep 6, 2024
1 parent 6cd8951 commit 7ced9c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/my-website/docs/proxy/billing.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Bill internal teams for their usage
Set 'lago' as a callback on your proxy config.yaml

```yaml
model_name:
model_list:
- model_name: fake-openai-endpoint
litellm_params:
model: openai/fake
Expand Down
4 changes: 3 additions & 1 deletion litellm/integrations/lago.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _common_logic(self, kwargs: dict, response_obj) -> dict:
returned_val = {
"event": {
"transaction_id": str(uuid.uuid4()),
"external_customer_id": external_customer_id,
"external_subscription_id": external_customer_id,
"code": os.getenv("LAGO_API_EVENT_CODE"),
"properties": {"model": model, "response_cost": cost, **usage},
}
Expand Down Expand Up @@ -189,6 +189,8 @@ async def async_log_success_event(self, kwargs, response_obj, start_time, end_ti
)

response.raise_for_status()

verbose_logger.debug(f"Logged Lago Object: {response.text}")
except Exception as e:
if response is not None and hasattr(response, "text"):
litellm.print_verbose(f"\nError Message: {response.text}")
Expand Down

0 comments on commit 7ced9c8

Please sign in to comment.