ia-tracker-qca 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ia_cost_tracker/__init__.py +1 -1
- ia_cost_tracker/tracker.py +19 -19
- {ia_tracker_qca-0.1.1.dist-info → ia_tracker_qca-0.1.2.dist-info}/METADATA +11 -5
- {ia_tracker_qca-0.1.1.dist-info → ia_tracker_qca-0.1.2.dist-info}/RECORD +7 -7
- {ia_tracker_qca-0.1.1.dist-info → ia_tracker_qca-0.1.2.dist-info}/WHEEL +0 -0
- {ia_tracker_qca-0.1.1.dist-info → ia_tracker_qca-0.1.2.dist-info}/licenses/LICENCE +0 -0
- {ia_tracker_qca-0.1.1.dist-info → ia_tracker_qca-0.1.2.dist-info}/top_level.txt +0 -0
ia_cost_tracker/__init__.py
CHANGED
ia_cost_tracker/tracker.py
CHANGED
|
@@ -112,16 +112,16 @@ class IATracker:
|
|
|
112
112
|
return modelos
|
|
113
113
|
|
|
114
114
|
def registrar_chamada(self,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
provedor: str,
|
|
116
|
+
modelo: str,
|
|
117
|
+
tokens_input: int,
|
|
118
|
+
tokens_output: int,
|
|
119
|
+
aplicacao: Optional[str] = None,
|
|
120
|
+
tag_funcionalidade: Optional[str] = None,
|
|
121
|
+
usuario: Optional[str] = None,
|
|
122
|
+
tempo_resposta_ms: Optional[int] = None,
|
|
123
|
+
erro: bool = False,
|
|
124
|
+
mensagem_erro: Optional[str] = None) -> int:
|
|
125
125
|
"""
|
|
126
126
|
Registra uma chamada de IA no banco de dados.
|
|
127
127
|
|
|
@@ -163,15 +163,15 @@ class IATracker:
|
|
|
163
163
|
f"Para Anthropic, adicione o modelo manualmente no banco."
|
|
164
164
|
)
|
|
165
165
|
|
|
166
|
-
# Calcular custos
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
166
|
+
# ✅ CORREÇÃO: Calcular custos diretamente (sem precisar de provider!)
|
|
167
|
+
custo_input = (tokens_input / 1000) * modelo_db.custo_input_por_1k
|
|
168
|
+
custo_output = (tokens_output / 1000) * modelo_db.custo_output_por_1k
|
|
169
|
+
|
|
170
|
+
custos = {
|
|
171
|
+
'custo_input': round(custo_input, 6),
|
|
172
|
+
'custo_output': round(custo_output, 6),
|
|
173
|
+
'custo_total': round(custo_input + custo_output, 6)
|
|
174
|
+
}
|
|
175
175
|
|
|
176
176
|
# Criar registro de uso
|
|
177
177
|
uso = UsoToken(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ia_tracker_qca
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Biblioteca para rastreamento e auditoria de custos de APIs de IA
|
|
5
5
|
Author-email: Sua Equipe <contato@suaempresa.com>
|
|
6
6
|
License: MIT
|
|
@@ -140,10 +140,16 @@ for modelo in modelos:
|
|
|
140
140
|
```
|
|
141
141
|
|
|
142
142
|
# Para att a lib:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
|
|
144
|
+
# ⚠️ ANTES DE RODAR O COMANDO:
|
|
145
|
+
# 1. Editar arquivos (código/README)
|
|
146
|
+
# 2. Mudar version em pyproject.toml
|
|
147
|
+
# 3. Mudar __version__ em src/ia_cost_tracker/__init__.py
|
|
148
|
+
# 4. Mudar v0.1.X abaixo para a nova versão
|
|
149
|
+
|
|
146
150
|
```bash
|
|
147
|
-
Remove-Item -Recurse -Force dist, build -ErrorAction SilentlyContinue; Get-ChildItem -Recurse -Filter "*.egg-info" | Remove-Item -Recurse -Force; python -m build; python -m twine upload dist/*; git add .; git commit -m "Release v0.1.
|
|
151
|
+
Remove-Item -Recurse -Force dist, build -ErrorAction SilentlyContinue; Get-ChildItem -Recurse -Filter "*.egg-info" | Remove-Item -Recurse -Force; python -m build; python -m twine upload dist/*; git add .; git commit -m "Release v0.1.X"; git tag v0.1.X; git push origin main; git push --tags
|
|
148
152
|
|
|
149
153
|
```
|
|
154
|
+
|
|
155
|
+
# ✅ Depois disso NÃO precisa fazer mais NADA!
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
ia_cost_tracker/__init__.py,sha256=
|
|
1
|
+
ia_cost_tracker/__init__.py,sha256=TVZT-vKdBXFIOrrYN2eXlnqALsv52APZZKxx11cPkQQ,646
|
|
2
2
|
ia_cost_tracker/database.py,sha256=11JEiBjAEDzrlJzZXz7SKCDyvCK54GJPzjQ4-5bHWiM,10282
|
|
3
3
|
ia_cost_tracker/exceptions.py,sha256=vm032KW8XPVQCCASzsRU0GPK7qYgc40ds15KO0QLs3E,636
|
|
4
4
|
ia_cost_tracker/models.py,sha256=pGc3bbgUx6VerlfG9-yG_bgyM8NLs0Eef-5OOglZSeM,2500
|
|
5
|
-
ia_cost_tracker/tracker.py,sha256=
|
|
5
|
+
ia_cost_tracker/tracker.py,sha256=y_u5Pzkjb-p2zZcIXnK4ye5soqWWGAJyaPc_IgYdRRI,13863
|
|
6
6
|
ia_cost_tracker/providers/__init__.py,sha256=XRL0u59YpikkjmgDfAd-e6fX-_3rsJHyqmJBPeo7q5U,240
|
|
7
7
|
ia_cost_tracker/providers/anthropic.py,sha256=S8utx3aR0o1Hmt8G5QI7zcNwJJCob-oEIqUeyKVB-BQ,2795
|
|
8
8
|
ia_cost_tracker/providers/base.py,sha256=V-8s8qUHVxJSOo3difQO30Q3IGN6e1yt5sxUCsPOMQM,1687
|
|
9
9
|
ia_cost_tracker/providers/maritaca.py,sha256=JnRwt0naBRnPH0FHdNVkZ9ZfwpSJwHpmFYBv6rl3P88,5735
|
|
10
|
-
ia_tracker_qca-0.1.
|
|
11
|
-
ia_tracker_qca-0.1.
|
|
12
|
-
ia_tracker_qca-0.1.
|
|
13
|
-
ia_tracker_qca-0.1.
|
|
14
|
-
ia_tracker_qca-0.1.
|
|
10
|
+
ia_tracker_qca-0.1.2.dist-info/licenses/LICENCE,sha256=Xpa1tEk-XW4tkTokBTU-bngiw8cbfGtqBoNVBjKnFAo,1096
|
|
11
|
+
ia_tracker_qca-0.1.2.dist-info/METADATA,sha256=yeKtrhQ1HSOrLkEg7O7OBSsQfHSE-MDVBglFubMZW3M,4787
|
|
12
|
+
ia_tracker_qca-0.1.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
13
|
+
ia_tracker_qca-0.1.2.dist-info/top_level.txt,sha256=OUDlog_CDGtGd2Xc1EQuCg-hiYQfGcsf91c5Ob4NelQ,16
|
|
14
|
+
ia_tracker_qca-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|