Carlex22 commited on
Commit
144312a
·
1 Parent(s): d8f6394

Revert "ParaAIV3.1"

Browse files

This reverts commit 4f77cbdb185e28b1181748ae1c0c5362dddb7404.

core/orchestrator.py CHANGED
@@ -39,7 +39,7 @@ class PipelineOrchestrator:
39
  self.llm_manager = llm_manager
40
  self.specialists = specialists
41
  self.context_builder = ContextBuilder()
42
- self.validator = SchemaValidator('protocolo_v13_6_schema.json')
43
 
44
  # Organizar fases
45
  self.phases = self._organize_phases()
 
39
  self.llm_manager = llm_manager
40
  self.specialists = specialists
41
  self.context_builder = ContextBuilder()
42
+ self.validator = SchemaValidator('./schemas/protocolo_v13_6_schema.json')
43
 
44
  # Organizar fases
45
  self.phases = self._organize_phases()
core/validator.py CHANGED
@@ -7,13 +7,12 @@ import json
7
  from typing import Dict, Any, Tuple, List
8
 
9
  try:
10
- if True;
11
  import jsonschema
12
  from jsonschema import validate, ValidationError
13
  HAS_JSONSCHEMA = True
14
- #except ImportError:
15
- # HAS_JSONSCHEMA = False
16
- # logging.warning("⚠️ jsonschema não instalado. Validação desabilitada.")
17
 
18
  from api.utils.logger import setup_logger
19
 
 
7
  from typing import Dict, Any, Tuple, List
8
 
9
  try:
 
10
  import jsonschema
11
  from jsonschema import validate, ValidationError
12
  HAS_JSONSCHEMA = True
13
+ except ImportError:
14
+ HAS_JSONSCHEMA = False
15
+ logging.warning("⚠️ jsonschema não instalado. Validação desabilitada.")
16
 
17
  from api.utils.logger import setup_logger
18
 
protocolo_v13_6_schema.json DELETED
@@ -1,816 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "title": "Protocolo Para.AI v13.6 - Schema Unificado de Manifestação Judicial",
4
- "description": "Schema unificado para processamento de acórdãos e agravos do TJPR. EVOLUÇÃO: V11 (textual) → V13.5 (condensado 46% economia, 96.8% completude) → V13.6 (unificação + RAG). DATA: 2026-01-16",
5
- "type": "object",
6
- "required": [
7
- "protocolo_versao",
8
- "id_manifestacao",
9
- "metadados",
10
- "classificacao_tematica",
11
- "RELATORIO",
12
- "FUNDAMENTACAO",
13
- "DECISAO",
14
- "analise_arquivista"
15
- ],
16
- "properties": {
17
- "protocolo_versao": {
18
- "type": "string",
19
- "const": "v13.6",
20
- "description": "Versão do protocolo de processamento"
21
- },
22
- "id_manifestacao": {
23
- "type": "integer",
24
- "description": "Identificador único sequencial da manifestação no dataset Para.AI",
25
- "minimum": 1
26
- },
27
- "hashes": {
28
- "type": "object",
29
- "description": "NOVO V13.6: Hashes SHA-256 para deduplicação e integridade",
30
- "required": [
31
- "hash_numero_processo",
32
- "hash_ementa"
33
- ],
34
- "properties": {
35
- "hash_numero_processo": {
36
- "type": "string",
37
- "pattern": "^[a-f0-9]{64}$",
38
- "description": "SHA-256 do número do processo principal"
39
- },
40
- "hash_ementa": {
41
- "type": "string",
42
- "pattern": "^[a-f0-9]{64}$",
43
- "description": "SHA-256 do texto da ementa"
44
- },
45
- "hash_inteiro_teor": {
46
- "type": [
47
- "string",
48
- "null"
49
- ],
50
- "pattern": "^[a-f0-9]{64}$",
51
- "description": "SHA-256 do inteiro teor (quando disponível)"
52
- }
53
- }
54
- },
55
- "metadados": {
56
- "type": "object",
57
- "description": "Metadados básicos da manifestação judicial",
58
- "required": [
59
- "tribunal",
60
- "orgao_julgador",
61
- "numeros_processo",
62
- "data_julgamento"
63
- ],
64
- "properties": {
65
- "tribunal": {
66
- "type": "string",
67
- "const": "TJPR",
68
- "description": "Tribunal de origem"
69
- },
70
- "orgao_julgador": {
71
- "type": "string",
72
- "description": "Câmara, Turma ou Órgão julgador"
73
- },
74
- "classe_processual": {
75
- "type": "string",
76
- "description": "Classe do processo"
77
- },
78
- "numeros_processo": {
79
- "type": "array",
80
- "description": "Lista de números de processo (formato CNJ)",
81
- "minItems": 1,
82
- "items": {
83
- "type": "string"
84
- }
85
- },
86
- "relator": {
87
- "type": "string",
88
- "description": "Nome do relator"
89
- },
90
- "data_julgamento": {
91
- "type": "string",
92
- "format": "date",
93
- "description": "Data do julgamento (YYYY-MM-DD)"
94
- },
95
- "data_publicacao": {
96
- "type": [
97
- "string",
98
- "null"
99
- ],
100
- "format": "date"
101
- },
102
- "url_original": {
103
- "type": [
104
- "string",
105
- "null"
106
- ],
107
- "format": "uri"
108
- }
109
- }
110
- },
111
- "classificacao_tematica": {
112
- "type": "object",
113
- "description": "Classificação hierárquica por ramo do direito",
114
- "required": [
115
- "RAMO_EXPECIALIZACAO_DIREITO"
116
- ],
117
- "properties": {
118
- "RAMO_EXPECIALIZACAO_DIREITO": {
119
- "type": "object",
120
- "required": [
121
- "descricao",
122
- "relevancia_para_caso"
123
- ],
124
- "properties": {
125
- "descricao": {
126
- "type": "string",
127
- "enum": [
128
- "Direito Civil",
129
- "Direito do Consumidor",
130
- "Direito Penal",
131
- "Direito Processual Civil",
132
- "Direito Processual Penal",
133
- "Direito Tributário",
134
- "Direito Administrativo",
135
- "Direito de Família",
136
- "Direito do Trabalho",
137
- "Direito Empresarial",
138
- "Direito Constitucional",
139
- "Direito Ambiental",
140
- "Outros"
141
- ]
142
- },
143
- "relevancia_para_caso": {
144
- "type": "integer",
145
- "minimum": 1,
146
- "maximum": 100
147
- }
148
- }
149
- },
150
- "ramos_secundarios": {
151
- "type": "array",
152
- "items": {
153
- "type": "object",
154
- "properties": {
155
- "descricao": {
156
- "type": "string"
157
- },
158
- "relevancia_para_caso": {
159
- "type": "integer",
160
- "minimum": 1,
161
- "maximum": 100
162
- }
163
- }
164
- }
165
- }
166
- }
167
- },
168
- "RELATORIO": {
169
- "type": "object",
170
- "description": "Narrativa dos fatos e teses das partes",
171
- "required": [
172
- "teses_fragmentadas",
173
- "etiquetas_relatorio"
174
- ],
175
- "properties": {
176
- "sintese_conectora_narrativa": {
177
- "type": "string",
178
- "maxLength": 80
179
- },
180
- "teses_fragmentadas": {
181
- "type": "array",
182
- "items": {
183
- "type": "object",
184
- "required": [
185
- "parte",
186
- "nucleo_logico_argumentativo"
187
- ],
188
- "properties": {
189
- "parte": {
190
- "type": "string",
191
- "enum": [
192
- "autor",
193
- "reu",
194
- "recorrente",
195
- "recorrido",
196
- "apelante",
197
- "apelado",
198
- "agravante",
199
- "agravado",
200
- "ministerio_publico",
201
- "terceiro_interessado"
202
- ]
203
- },
204
- "nucleo_logico_argumentativo": {
205
- "type": "string",
206
- "maxLength": 120
207
- },
208
- "peso_merito": {
209
- "type": "integer",
210
- "minimum": 0,
211
- "maximum": 100
212
- },
213
- "elementos_factuais": {
214
- "type": "array",
215
- "items": {
216
- "type": "string",
217
- "maxLength": 80
218
- }
219
- },
220
- "etiquetas_semanticas": {
221
- "type": "array",
222
- "items": {
223
- "type": "string",
224
- "pattern": "^#[a-z_]+$"
225
- }
226
- },
227
- "correlacao_positiva": {
228
- "type": [
229
- "object",
230
- "null"
231
- ],
232
- "properties": {
233
- "sintese_conectora": {
234
- "type": "string",
235
- "maxLength": 80
236
- },
237
- "etiquetas_ativadas": {
238
- "type": "array",
239
- "items": {
240
- "type": "string"
241
- }
242
- }
243
- }
244
- },
245
- "correlacao_negativa": {
246
- "type": [
247
- "object",
248
- "null"
249
- ],
250
- "properties": {
251
- "sintese_conectora": {
252
- "type": "string",
253
- "maxLength": 80
254
- },
255
- "etiquetas_ativadas": {
256
- "type": "array",
257
- "items": {
258
- "type": "string"
259
- }
260
- }
261
- }
262
- }
263
- }
264
- }
265
- },
266
- "etiquetas_relatorio": {
267
- "type": "array",
268
- "items": {
269
- "type": "string",
270
- "pattern": "^#[a-z_]+$"
271
- }
272
- }
273
- }
274
- },
275
- "FUNDAMENTACAO": {
276
- "type": "object",
277
- "required": [
278
- "teses_relator"
279
- ],
280
- "properties": {
281
- "sintese_conectora_fundamentacao": {
282
- "type": "string",
283
- "maxLength": 80
284
- },
285
- "teses_relator": {
286
- "type": "array",
287
- "items": {
288
- "type": "object",
289
- "required": [
290
- "nucleo_logico_argumentativo"
291
- ],
292
- "properties": {
293
- "nucleo_logico_argumentativo": {
294
- "type": "string",
295
- "maxLength": 120
296
- },
297
- "peso_merito": {
298
- "type": "integer",
299
- "minimum": 0,
300
- "maximum": 100
301
- },
302
- "fundamentos_legal": {
303
- "type": "array",
304
- "items": {
305
- "type": "object",
306
- "required": [
307
- "tipo",
308
- "citacao_fonte"
309
- ],
310
- "properties": {
311
- "tipo": {
312
- "type": "string",
313
- "enum": [
314
- "lei",
315
- "jurisprudencia",
316
- "principio",
317
- "doutrina",
318
- "sumula",
319
- "entendimento_consolidado"
320
- ]
321
- },
322
- "citacao_fonte": {
323
- "type": "string",
324
- "maxLength": 200
325
- },
326
- "nucleo_logico": {
327
- "type": "string",
328
- "maxLength": 120
329
- },
330
- "resumo_transcricao": {
331
- "type": [
332
- "string",
333
- "null"
334
- ]
335
- }
336
- }
337
- }
338
- },
339
- "etiquetas_semanticas": {
340
- "type": "array",
341
- "items": {
342
- "type": "string",
343
- "pattern": "^#[a-z_]+$"
344
- }
345
- }
346
- }
347
- }
348
- },
349
- "etiquetas_fundamentacao": {
350
- "type": "array",
351
- "items": {
352
- "type": "string",
353
- "pattern": "^#[a-z_]+$"
354
- }
355
- }
356
- }
357
- },
358
- "DECISAO": {
359
- "type": "object",
360
- "required": [
361
- "resultado",
362
- "mapa_pedidos"
363
- ],
364
- "properties": {
365
- "resultado": {
366
- "type": "string",
367
- "enum": [
368
- "PROVIDO",
369
- "IMPROVIDO",
370
- "PARCIALMENTE_PROVIDO",
371
- "NAO_CONHECIDO",
372
- "EXTINTO_SEM_RESOLUCAO_MERITO",
373
- "PREJUDICADO",
374
- "DESISTENCIA_HOMOLOGADA"
375
- ]
376
- },
377
- "sintese_decisao": {
378
- "type": "string",
379
- "maxLength": 80
380
- },
381
- "mapa_pedidos": {
382
- "type": "array",
383
- "items": {
384
- "type": "object",
385
- "required": [
386
- "pedido",
387
- "parte"
388
- ],
389
- "properties": {
390
- "pedido": {
391
- "type": "string"
392
- },
393
- "parte": {
394
- "type": "string"
395
- },
396
- "foi_conhecido": {
397
- "type": "boolean"
398
- },
399
- "resultado_pedido": {
400
- "type": [
401
- "string",
402
- "null"
403
- ],
404
- "enum": [
405
- "deferido",
406
- "indeferido",
407
- "parcialmente_deferido",
408
- "nao_conhecido",
409
- null
410
- ]
411
- },
412
- "valor_pedido": {
413
- "type": [
414
- "number",
415
- "null"
416
- ]
417
- },
418
- "valor_concedido": {
419
- "type": [
420
- "number",
421
- "null"
422
- ]
423
- },
424
- "fundamento_decisivo": {
425
- "type": [
426
- "string",
427
- "null"
428
- ],
429
- "maxLength": 120
430
- }
431
- }
432
- }
433
- },
434
- "etiquetas_decisao": {
435
- "type": "array",
436
- "items": {
437
- "type": "string",
438
- "pattern": "^#[a-z_]+$"
439
- }
440
- },
441
- "votacao": {
442
- "type": [
443
- "object",
444
- "null"
445
- ],
446
- "properties": {
447
- "unanime": {
448
- "type": "boolean"
449
- },
450
- "votos_favoraveis": {
451
- "type": "integer",
452
- "minimum": 0
453
- },
454
- "votos_contrarios": {
455
- "type": "integer",
456
- "minimum": 0
457
- },
458
- "voto_vencido": {
459
- "type": [
460
- "string",
461
- "null"
462
- ]
463
- }
464
- }
465
- }
466
- }
467
- },
468
- "analise_arquivista": {
469
- "type": "object",
470
- "description": "Análise meta-cognitiva da manifestação pelo LLM",
471
- "required": [
472
- "grau_confianca"
473
- ],
474
- "properties": {
475
- "grau_confianca": {
476
- "type": "string",
477
- "enum": [
478
- "alta",
479
- "media",
480
- "baixa",
481
- "muito_baixa"
482
- ]
483
- },
484
- "justificativa_confianca": {
485
- "type": [
486
- "string",
487
- "null"
488
- ]
489
- },
490
- "partes": {
491
- "type": "array",
492
- "description": "NOVO V13.6: Análise dialética expandida (incorpora V11)",
493
- "items": {
494
- "type": "object",
495
- "required": [
496
- "parte"
497
- ],
498
- "properties": {
499
- "parte": {
500
- "type": "string"
501
- },
502
- "arquetipo_simbolico_carl_young": {
503
- "type": "array",
504
- "items": {
505
- "type": "string",
506
- "enum": [
507
- "#heroi",
508
- "#inocente",
509
- "#sabio",
510
- "#explorador",
511
- "#rebelde",
512
- "#mago",
513
- "#amante",
514
- "#bobo",
515
- "#cuidador",
516
- "#criador",
517
- "#governante",
518
- "#humorista"
519
- ]
520
- }
521
- },
522
- "resumo_positivo": {
523
- "type": [
524
- "object",
525
- "null"
526
- ],
527
- "properties": {
528
- "sintese_conectora": {
529
- "type": "string",
530
- "maxLength": 80
531
- },
532
- "etiquetas_ativadas": {
533
- "type": "array",
534
- "items": {
535
- "type": "string"
536
- }
537
- },
538
- "texto_completo": {
539
- "type": [
540
- "string",
541
- "null"
542
- ],
543
- "description": "NOVO V13.6: do V11"
544
- }
545
- }
546
- },
547
- "resumo_negativo": {
548
- "type": [
549
- "object",
550
- "null"
551
- ],
552
- "properties": {
553
- "sintese_conectora": {
554
- "type": "string",
555
- "maxLength": 80
556
- },
557
- "etiquetas_ativadas": {
558
- "type": "array",
559
- "items": {
560
- "type": "string"
561
- }
562
- },
563
- "texto_completo": {
564
- "type": [
565
- "string",
566
- "null"
567
- ],
568
- "description": "NOVO V13.6: do V11"
569
- }
570
- }
571
- }
572
- }
573
- }
574
- },
575
- "complexidade_caso": {
576
- "type": [
577
- "string",
578
- "null"
579
- ],
580
- "enum": [
581
- "baixa",
582
- "media",
583
- "alta",
584
- "muito_alta",
585
- null
586
- ]
587
- },
588
- "relevancia_jurisprudencial": {
589
- "type": [
590
- "string",
591
- "null"
592
- ],
593
- "enum": [
594
- "baixa",
595
- "media",
596
- "alta",
597
- "leading_case",
598
- null
599
- ]
600
- },
601
- "alertas_qualidade": {
602
- "type": "array",
603
- "items": {
604
- "type": "string",
605
- "enum": [
606
- "texto_incompleto",
607
- "citacoes_imprecisas",
608
- "inconsistencia_logica",
609
- "falta_fundamentacao",
610
- "erro_processual",
611
- "contradicao_interna"
612
- ]
613
- }
614
- }
615
- }
616
- },
617
- "secoes_originais": {
618
- "type": "object",
619
- "description": "NOVO V13.6: Preservação de textos completos originais (para embeddings/RAG)",
620
- "properties": {
621
- "ementa": {
622
- "type": [
623
- "string",
624
- "null"
625
- ]
626
- },
627
- "RELATORIO_texto_completo": {
628
- "type": [
629
- "string",
630
- "null"
631
- ]
632
- },
633
- "FUNDAMENTACAO_texto_completo": {
634
- "type": [
635
- "string",
636
- "null"
637
- ]
638
- },
639
- "DISPOSITIVO_texto_completo": {
640
- "type": [
641
- "string",
642
- "null"
643
- ]
644
- },
645
- "inteiro_teor_bruto": {
646
- "type": [
647
- "string",
648
- "null"
649
- ]
650
- }
651
- }
652
- },
653
- "metadados_processamento": {
654
- "type": "object",
655
- "description": "NOVO V13.6: Metadados sobre o processamento deste registro",
656
- "required": [
657
- "protocolo_origem",
658
- "data_processamento"
659
- ],
660
- "properties": {
661
- "protocolo_origem": {
662
- "type": "string",
663
- "enum": [
664
- "v11",
665
- "v13.5",
666
- "v13.6",
667
- "v11_merged_v13.5"
668
- ]
669
- },
670
- "data_processamento": {
671
- "type": "string",
672
- "format": "date-time"
673
- },
674
- "versao_preprocessador": {
675
- "type": [
676
- "string",
677
- "null"
678
- ]
679
- },
680
- "modelo_llm_utilizado": {
681
- "type": [
682
- "string",
683
- "null"
684
- ]
685
- },
686
- "inteiro_teor_estruturado": {
687
- "type": "boolean"
688
- },
689
- "confianca_estruturacao": {
690
- "type": [
691
- "number",
692
- "null"
693
- ],
694
- "minimum": 0.0,
695
- "maximum": 1.0
696
- },
697
- "campos_enriquecidos": {
698
- "type": "array",
699
- "items": {
700
- "type": "string"
701
- }
702
- },
703
- "tempo_processamento_segundos": {
704
- "type": [
705
- "number",
706
- "null"
707
- ]
708
- },
709
- "custo_tokens": {
710
- "type": [
711
- "object",
712
- "null"
713
- ],
714
- "properties": {
715
- "input_tokens": {
716
- "type": "integer"
717
- },
718
- "output_tokens": {
719
- "type": "integer"
720
- },
721
- "total_tokens": {
722
- "type": "integer"
723
- }
724
- }
725
- }
726
- }
727
- },
728
- "campos_futuros": {
729
- "type": "object",
730
- "description": "Campos reservados para preenchimento em fases posteriores",
731
- "properties": {
732
- "relatorio_transcript_exato": {
733
- "type": [
734
- "string",
735
- "null"
736
- ]
737
- },
738
- "fundamentacao_transcript_exato": {
739
- "type": [
740
- "string",
741
- "null"
742
- ]
743
- },
744
- "dispositivo_transcript_exato": {
745
- "type": [
746
- "string",
747
- "null"
748
- ]
749
- },
750
- "embeddings_metadata": {
751
- "type": [
752
- "object",
753
- "null"
754
- ],
755
- "properties": {
756
- "fragmentos_gerados": {
757
- "type": [
758
- "integer",
759
- "null"
760
- ]
761
- },
762
- "modelo_embedding": {
763
- "type": [
764
- "string",
765
- "null"
766
- ]
767
- },
768
- "data_geracao_embeddings": {
769
- "type": [
770
- "string",
771
- "null"
772
- ],
773
- "format": "date-time"
774
- }
775
- }
776
- },
777
- "tags_embedding_baldes": {
778
- "type": [
779
- "array",
780
- "null"
781
- ],
782
- "description": "Tags para baldes de embeddings (50-120 caracteres)",
783
- "items": {
784
- "type": "object",
785
- "properties": {
786
- "secao": {
787
- "type": "string",
788
- "enum": [
789
- "relatorio",
790
- "fundamentacao",
791
- "dispositivo",
792
- "arquivista",
793
- "ementa"
794
- ]
795
- },
796
- "categoria": {
797
- "type": "string"
798
- },
799
- "fragmento_texto": {
800
- "type": "string",
801
- "minLength": 50,
802
- "maxLength": 120
803
- },
804
- "etiquetas": {
805
- "type": "array",
806
- "items": {
807
- "type": "string"
808
- }
809
- }
810
- }
811
- }
812
- }
813
- }
814
- }
815
- }
816
- }