csc-cia-stne 0.1.39__py3-none-any.whl → 0.1.41__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.
- csc_cia_stne/jerry.py +14 -4
- csc_cia_stne/utilitarios/validations/GcpBigQueryValidator.py +6 -11
- {csc_cia_stne-0.1.39.dist-info → csc_cia_stne-0.1.41.dist-info}/METADATA +1 -1
- {csc_cia_stne-0.1.39.dist-info → csc_cia_stne-0.1.41.dist-info}/RECORD +7 -7
- {csc_cia_stne-0.1.39.dist-info → csc_cia_stne-0.1.41.dist-info}/WHEEL +0 -0
- {csc_cia_stne-0.1.39.dist-info → csc_cia_stne-0.1.41.dist-info}/licenses/LICENCE +0 -0
- {csc_cia_stne-0.1.39.dist-info → csc_cia_stne-0.1.41.dist-info}/top_level.txt +0 -0
csc_cia_stne/jerry.py
CHANGED
|
@@ -176,7 +176,7 @@ class JerryClient:
|
|
|
176
176
|
self.error = f"Erro na autenticação: {e}"
|
|
177
177
|
return None
|
|
178
178
|
|
|
179
|
-
def v1_enviar_para_ia(self, system_prompt: str, user_prompt: str, arquivos: Optional[List[Dict[str, str]]] = None) -> Dict[str, Any]:
|
|
179
|
+
def v1_enviar_para_ia(self, system_prompt: str, user_prompt: str, arquivos: Optional[List[Dict[str, str]]] = None, tools: Optional[List[Dict[str, Any]]] = None, temperature: float = 0.3) -> Dict[str, Any]:
|
|
180
180
|
"""
|
|
181
181
|
Envia prompts e opcionalmente múltiplas imagens para a IA via Databricks.
|
|
182
182
|
|
|
@@ -190,6 +190,8 @@ class JerryClient:
|
|
|
190
190
|
- mime_type: Tipo MIME da imagem (deve ser image/*)
|
|
191
191
|
- name: Nome/descrição da imagem (opcional, para logs)
|
|
192
192
|
- file_path: Caminho original da imagem (opcional, para logs)
|
|
193
|
+
temperature (float): Temperatura para a geração de texto (default = 0.3)
|
|
194
|
+
tools (Optional[List[Dict[str, Any]]]): Lista de ferramentas (tools) para fornecer à IA
|
|
193
195
|
|
|
194
196
|
Tipos de imagem suportados:
|
|
195
197
|
✅ image/jpeg, image/jpg, image/png, image/gif, image/webp, image/bmp, image/tiff
|
|
@@ -461,7 +463,13 @@ class JerryClient:
|
|
|
461
463
|
"images_validated": images_stats
|
|
462
464
|
}
|
|
463
465
|
|
|
464
|
-
# 4.
|
|
466
|
+
# 4. PREPARAÇÃO E ENVIO COM TOOLS (SE FORNECIDO)
|
|
467
|
+
if tools:
|
|
468
|
+
self.log.info(f"{jerry_prompt}🔧 Ferramentas fornecidas para a IA:")
|
|
469
|
+
for tool in tools:
|
|
470
|
+
self.log.info(f"{jerry_prompt} - {tool['function']['name']}: {tool['function']['description']}")
|
|
471
|
+
|
|
472
|
+
# 5. REQUISIÇÃO PARA O DATABRICKS
|
|
465
473
|
max_retries = 3
|
|
466
474
|
for attempt in range(max_retries):
|
|
467
475
|
try:
|
|
@@ -497,7 +505,9 @@ class JerryClient:
|
|
|
497
505
|
self.log.info(f"{jerry_prompt}🚀 Enviando para Databricks (modelo: {self.ia_model})...")
|
|
498
506
|
response = self.client.chat.completions.create(
|
|
499
507
|
model=self.ia_model,
|
|
500
|
-
|
|
508
|
+
tools=tools,
|
|
509
|
+
temperature=temperature,
|
|
510
|
+
messages=messages,
|
|
501
511
|
)
|
|
502
512
|
|
|
503
513
|
# ✅ SUCESSO
|
|
@@ -506,7 +516,7 @@ class JerryClient:
|
|
|
506
516
|
self.log.info(f"{jerry_prompt}📄 Resposta bruta: {json.dumps(response.model_dump(), ensure_ascii=False)}")
|
|
507
517
|
|
|
508
518
|
content_processado = response.model_dump()
|
|
509
|
-
content_processado = content_processado["choices"][0]["message"]["content"]
|
|
519
|
+
#content_processado = content_processado["choices"][0]["message"]["content"]
|
|
510
520
|
|
|
511
521
|
return {
|
|
512
522
|
"success": True,
|
|
@@ -20,18 +20,13 @@ class InitParamsValidator(BaseModel):
|
|
|
20
20
|
return value
|
|
21
21
|
|
|
22
22
|
@model_validator(mode="after")
|
|
23
|
-
def check_others_input(
|
|
24
|
-
creds_dict =
|
|
25
|
-
creds_file =
|
|
23
|
+
def check_others_input(self):
|
|
24
|
+
creds_dict = isinstance(self.creds_dict, dict)
|
|
25
|
+
creds_file = isinstance(self.creds_file, str)
|
|
26
26
|
|
|
27
|
-
if
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
elif isinstance(creds_file, str) and creds_file.strip():
|
|
31
|
-
return model
|
|
32
|
-
|
|
33
|
-
else:
|
|
34
|
-
raise ValueError("Pelo menos um dos parâmetros 'creds_dict' ou 'creds_file' deve ser fornecido.")
|
|
27
|
+
if not creds_dict and not creds_file:
|
|
28
|
+
raise ValueError("É necessário fornecer 'creds_dict' ou 'creds_file' para autenticação")
|
|
29
|
+
return self
|
|
35
30
|
|
|
36
31
|
|
|
37
32
|
class tryQueryValidator(BaseModel):
|
|
@@ -7,7 +7,7 @@ csc_cia_stne/gcp_bigquery.py,sha256=foq8azvvv_f7uikMDslX9RcUIrx7RAS-Sn0AGW0QFQc,
|
|
|
7
7
|
csc_cia_stne/gcp_bucket.py,sha256=vMALWiW7IoBCuJAR8bUCpOV6BuBzI9AhRRk3b72OdMk,11515
|
|
8
8
|
csc_cia_stne/gcp_document_ai.py,sha256=Dzlk7YR3M_LxE0sHn-Lxz-PA1NsUZN2hgY5PyUfs0IQ,4506
|
|
9
9
|
csc_cia_stne/google_drive.py,sha256=7qwx4_RPEoSJgeVI02aLYNXA7o69_Z3qONvX5bfA4V0,44500
|
|
10
|
-
csc_cia_stne/jerry.py,sha256=
|
|
10
|
+
csc_cia_stne/jerry.py,sha256=TNdMz2B7c9NiW2USmIHcZcZT5KMuux8CJWzNBRKACFE,28451
|
|
11
11
|
csc_cia_stne/karavela.py,sha256=jJCYX43D49gGuzmwwK6bN9XVnv2dXdp9iHnnV5H1LMQ,4794
|
|
12
12
|
csc_cia_stne/logger_json.py,sha256=CXxSCOFGMymDi8XE9SKnPKjW4D0wJLqDLnxqePS26i8,3187
|
|
13
13
|
csc_cia_stne/logger_rich.py,sha256=fklgkBb4rblKQd7YZ3q-eWfhGg9eflO2k2-z4pGh_yo,5201
|
|
@@ -29,7 +29,7 @@ csc_cia_stne/utilitarios/functions/func_recriar_pastas.py,sha256=4whZpB3aJQaCPJ3
|
|
|
29
29
|
csc_cia_stne/utilitarios/functions/func_settings.py,sha256=XwlfqdcfocXQ8kTsDKZ6GsAtpzr0_u44AOTIMtdem7U,2059
|
|
30
30
|
csc_cia_stne/utilitarios/functions/func_titulo.py,sha256=bH4tYxovTARF-g2kWUK_GIzzXt8egbVdp6mWD6fc_3I,5345
|
|
31
31
|
csc_cia_stne/utilitarios/functions/func_validate_json.py,sha256=mAc2J5Eab8ZpNYqsDLJMKkKIeyrSbhytncdJ5G0jztA,1306
|
|
32
|
-
csc_cia_stne/utilitarios/validations/GcpBigQueryValidator.py,sha256=
|
|
32
|
+
csc_cia_stne/utilitarios/validations/GcpBigQueryValidator.py,sha256=A58HNGbOSm95ijWmeVeZ2HX6WrhiQz0WbrZhdYrJAgU,4545
|
|
33
33
|
csc_cia_stne/utilitarios/validations/GoogleDriveValidator.py,sha256=Q1oZTae4hDJ2TQ4sUL5Q5TkDNPoJo-DZQt6wIue2jwM,4811
|
|
34
34
|
csc_cia_stne/utilitarios/validations/ServiceNowValidator.py,sha256=yleKUIo1ZfyloP9fDPNjv3JJXdLcocT81WIgRSYmqEA,14423
|
|
35
35
|
csc_cia_stne/utilitarios/validations/__init__.py,sha256=O_qyEU2ji3u6LHUXZCXvUFsMpoMWL625qqHTXyXivTA,106
|
|
@@ -41,8 +41,8 @@ csc_cia_stne/utilitarios/web_screen/__init__.py,sha256=5QcOPXKd95SvP2DoZiHS0gaU6
|
|
|
41
41
|
csc_cia_stne/utilitarios/web_screen/web_screen_abstract.py,sha256=PjL8Vgfj_JdKidia7RFyCkro3avYLQu4RZRos41sh3w,3241
|
|
42
42
|
csc_cia_stne/utilitarios/web_screen/web_screen_botcity.py,sha256=Xi5YJjl2pcxlX3OimqcBWRNXZEpAE7asyUjDJ4Oho5U,12297
|
|
43
43
|
csc_cia_stne/utilitarios/web_screen/web_screen_selenium.py,sha256=JLIcPJE9ZX3Pd6zG6oTRMqqUAY063UzLY3ReRlxmiSM,15581
|
|
44
|
-
csc_cia_stne-0.1.
|
|
45
|
-
csc_cia_stne-0.1.
|
|
46
|
-
csc_cia_stne-0.1.
|
|
47
|
-
csc_cia_stne-0.1.
|
|
48
|
-
csc_cia_stne-0.1.
|
|
44
|
+
csc_cia_stne-0.1.41.dist-info/licenses/LICENCE,sha256=LPGMtgKki2C3KEZP7hDhA1HBrlq5JCHkIeStUCLEMx4,1073
|
|
45
|
+
csc_cia_stne-0.1.41.dist-info/METADATA,sha256=rL3cmx7Qg2zObO69ij_1LGd3pHtFNap3xfSt7yW2H9A,1574
|
|
46
|
+
csc_cia_stne-0.1.41.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
47
|
+
csc_cia_stne-0.1.41.dist-info/top_level.txt,sha256=ldo7GVv3tQx5KJvwBzdZzzQmjPys2NDVVn1rv0BOF2Q,13
|
|
48
|
+
csc_cia_stne-0.1.41.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|