Mixins
This file contains the mixins for the provider model.
- class smarter.apps.prompt.providers.mixins.InternalKeys[source]
Bases:
objectThis class contains the internal keys for the provider model.
- CompletionTokens = 'completion_tokens'
- PromptTokens = 'prompt_tokens'
- TotalTokens = 'total_tokens'
- class smarter.apps.prompt.providers.mixins.ProviderDbMixin(*args, **kwargs)[source]
Bases:
AccountMixinThis mixin contains the database related methods for the provider model.
- property db_charges: QuerySet
This method returns the charge instance. prompt_tokens = models.IntegerField() completion_tokens = models.IntegerField() total_tokens = models.IntegerField()
- property db_chat_plugin_usage: ChatPluginUsage
This method returns the chat plugin usage instance.
- property db_chat_tool_call: ChatToolCall
This method returns the chat tool call instance.
- db_insert_charge(provider, charge_type, completion_tokens, prompt_tokens, total_tokens, model, reference)[source]
- This method inserts a new charge record.
provider=self.provider, charge_type=charge_type, completion_tokens=self.completion_tokens, prompt_tokens=self.prompt_tokens, total_tokens=self.total_tokens, model=self.model, reference=self.reference or “ChatProviderBase._insert_charge_by_type()”,
- db_insert_chat_plugin_usage(*args, **kwargs)[source]
This method inserts the chat plugin usage instance.
- property db_message_history: list[dict]
This method returns the most recently persisted messages in the chat history.