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

Add token usage information #107

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vishwamartur
Copy link

Related to #50

Add token usage information to the response from the LLM.

  • aisuite/framework/chat_completion_response.py

    • Add attributes for token usage information to the ChatCompletionResponse class.
    • Update the __init__ method to initialize token usage attributes.
  • aisuite/providers/anthropic_provider.py

    • Update the normalize_response method to include token usage data.
  • aisuite/providers/aws_provider.py

    • Update the normalize_response method to include token usage data.
  • aisuite/providers/azure_provider.py

    • Update the chat_completions_create method to handle token information.
    • Add normalize_response method to include token usage data.
  • aisuite/providers/fireworks_provider.py

    • Update the _normalize_response method to include token usage data.
  • aisuite/providers/google_provider.py

    • Update the normalize_response method to include token usage data.
  • aisuite/providers/huggingface_provider.py

    • Update the _normalize_response method to include token usage data.
  • aisuite/providers/ollama_provider.py

    • Update the _normalize_response method to include token usage data.
  • aisuite/providers/together_provider.py

    • Update the _normalize_response method to include token usage data.

Related to andrewyng#50

Add token usage information to the response from the LLM.

* **aisuite/framework/chat_completion_response.py**
  - Add attributes for token usage information to the `ChatCompletionResponse` class.
  - Update the `__init__` method to initialize token usage attributes.

* **aisuite/providers/anthropic_provider.py**
  - Update the `normalize_response` method to include token usage data.

* **aisuite/providers/aws_provider.py**
  - Update the `normalize_response` method to include token usage data.

* **aisuite/providers/azure_provider.py**
  - Update the `chat_completions_create` method to handle token information.
  - Add `normalize_response` method to include token usage data.

* **aisuite/providers/fireworks_provider.py**
  - Update the `_normalize_response` method to include token usage data.

* **aisuite/providers/google_provider.py**
  - Update the `normalize_response` method to include token usage data.

* **aisuite/providers/huggingface_provider.py**
  - Update the `_normalize_response` method to include token usage data.

* **aisuite/providers/ollama_provider.py**
  - Update the `_normalize_response` method to include token usage data.

* **aisuite/providers/together_provider.py**
  - Update the `_normalize_response` method to include token usage data.
@rohitprasad15
Copy link
Collaborator

Thanks for this PR. Can you re-visit and check your solution after the addition of pydantic checks in the codebase.
Please tag me for any questions or for review once you are done.

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.

2 participants