ia-tracker-qca 0.1.0__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.
@@ -8,7 +8,7 @@ Para Maritaca: sincroniza preços via API
8
8
  Para Anthropic: usa preços mantidos no banco de dados
9
9
  """
10
10
 
11
- __version__ = "0.1.0"
11
+ __version__ = "0.1.2"
12
12
 
13
13
  from .tracker import IATracker
14
14
  from .exceptions import (
@@ -112,16 +112,16 @@ class IATracker:
112
112
  return modelos
113
113
 
114
114
  def registrar_chamada(self,
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:
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
- provider = self._get_provider(provedor)
168
- custos = provider.calcular_custo(
169
- modelo,
170
- tokens_input,
171
- tokens_output,
172
- modelo_db.custo_input_por_1k,
173
- modelo_db.custo_output_por_1k
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.0
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
@@ -43,14 +43,14 @@ Biblioteca Python para rastreamento e auditoria de custos de APIs de IA (Maritac
43
43
  ## Instalação
44
44
 
45
45
  ```bash
46
- pip install pip install ia_tracker_qca
46
+ pip install ia_tracker_qca
47
47
 
48
48
  ```
49
49
 
50
50
  Uso básico (não recomendado pois demora mais por causa que busca os valores atualizados na hora!):
51
51
 
52
52
  ```python
53
- from ia_cost_tracker import IATracker
53
+ from ia_tracker_qca import IATracker
54
54
 
55
55
  # Inicializar
56
56
  tracker = IATracker(
@@ -84,7 +84,7 @@ print(f"Total de chamadas: {stats['total_chamadas']}")
84
84
 
85
85
  Exemplo de uso em uma aplicação em produção:
86
86
  ```python
87
- from ia_cost_tracker import IATracker
87
+ from ia_tracker_qca import IATracker
88
88
 
89
89
  tracker = IATracker(db_connection_string=os.getenv("DB_CONNECTION_STRING"))
90
90
 
@@ -138,3 +138,18 @@ for modelo in modelos:
138
138
  f"R$ {modelo.custo_output_por_1k}/1k output")
139
139
 
140
140
  ```
141
+
142
+ # Para att a lib:
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
+
150
+ ```bash
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
152
+
153
+ ```
154
+
155
+ # ✅ Depois disso NÃO precisa fazer mais NADA!
@@ -1,14 +1,14 @@
1
- ia_cost_tracker/__init__.py,sha256=zxycoNe5hNjk7UVI0wIisyzsVatDIJhYofZY1oIODW8,646
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=1fNqav0dlSBZsqLV5WZIF3bjL7IzcgYufMwHXumFTL0,13717
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.0.dist-info/licenses/LICENCE,sha256=Xpa1tEk-XW4tkTokBTU-bngiw8cbfGtqBoNVBjKnFAo,1096
11
- ia_tracker_qca-0.1.0.dist-info/METADATA,sha256=F-CIvLcAvWNRSHZ7ok40DsLFB64OzcfGl1Md9suffIU,4198
12
- ia_tracker_qca-0.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
13
- ia_tracker_qca-0.1.0.dist-info/top_level.txt,sha256=OUDlog_CDGtGd2Xc1EQuCg-hiYQfGcsf91c5Ob4NelQ,16
14
- ia_tracker_qca-0.1.0.dist-info/RECORD,,
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,,