Spaces:
Running
Running
Commit
•
dc6ca0d
1
Parent(s):
b7f9ce6
updated pre 5, 7
Browse files- app.py +2 -6
- data/img.png +0 -0
- data/logs.txt +1 -1
- judge.py +32 -34
- perspective.py +39 -19
- prompts/judgement_stage_prompts.py +8 -43
- settlement.py +39 -18
app.py
CHANGED
@@ -14,13 +14,9 @@ import prompt_tracing
|
|
14 |
|
15 |
load_dotenv()
|
16 |
|
17 |
-
tracking = True
|
18 |
-
|
19 |
iteration = 0
|
20 |
iteration_limit = 50
|
21 |
|
22 |
-
|
23 |
-
|
24 |
class Seafoam(Base):
|
25 |
def __init__(
|
26 |
self,
|
@@ -90,7 +86,7 @@ def add_message(history, message):
|
|
90 |
if (judge.stage == 1 and perspective.stage == 1 and settlement.stage == 0.8):
|
91 |
iteration = iteration + 1
|
92 |
for x in message["files"]:
|
93 |
-
if tracking:
|
94 |
prompt_tracing.send_file_over_discord(x)
|
95 |
# print(x)
|
96 |
judge.lawsuit_extracted_text = utils.extract_text_from_pdf(x)
|
@@ -312,7 +308,7 @@ def get_iteration():
|
|
312 |
return chatbot, chat_input, credits_markdown
|
313 |
|
314 |
def restart():
|
315 |
-
if tracking:
|
316 |
prompt_tracing.make_discord_trace_intro()
|
317 |
print("restarted")
|
318 |
judge.reset()
|
|
|
14 |
|
15 |
load_dotenv()
|
16 |
|
|
|
|
|
17 |
iteration = 0
|
18 |
iteration_limit = 50
|
19 |
|
|
|
|
|
20 |
class Seafoam(Base):
|
21 |
def __init__(
|
22 |
self,
|
|
|
86 |
if (judge.stage == 1 and perspective.stage == 1 and settlement.stage == 0.8):
|
87 |
iteration = iteration + 1
|
88 |
for x in message["files"]:
|
89 |
+
if prompt_tracing.tracking:
|
90 |
prompt_tracing.send_file_over_discord(x)
|
91 |
# print(x)
|
92 |
judge.lawsuit_extracted_text = utils.extract_text_from_pdf(x)
|
|
|
308 |
return chatbot, chat_input, credits_markdown
|
309 |
|
310 |
def restart():
|
311 |
+
if prompt_tracing.tracking:
|
312 |
prompt_tracing.make_discord_trace_intro()
|
313 |
print("restarted")
|
314 |
judge.reset()
|
data/img.png
CHANGED
![]() |
![]() |
data/logs.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
I'm sorry, but you haven't provided any specific text or details from a lawsuit for
|
|
|
1 |
+
I'm sorry, but you haven't provided any specific text or details from a lawsuit for me to analyze. Please provide the text or details of the lawsuit you'd like me to analyze.
|
judge.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import os
|
2 |
from openai import OpenAI
|
|
|
3 |
from llama_index.llms.groq import Groq
|
4 |
from mistralai.client import MistralClient
|
5 |
from mistralai.models.chat_completion import ChatMessage
|
@@ -18,8 +19,6 @@ from dotenv import load_dotenv
|
|
18 |
|
19 |
load_dotenv()
|
20 |
|
21 |
-
tracking = True
|
22 |
-
|
23 |
class Judge():
|
24 |
def __init__(self):
|
25 |
self.stage=1
|
@@ -142,22 +141,37 @@ class Judge():
|
|
142 |
|
143 |
def llm_function_call(self, prompt, model):
|
144 |
if "gpt" in model:
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
|
150 |
-
chat_completion = self.client.chat.completions.create(
|
151 |
-
messages=[
|
152 |
-
{
|
153 |
-
"role": "user",
|
154 |
-
"content": prompt,
|
155 |
-
}
|
156 |
-
],
|
157 |
-
model=model,
|
158 |
-
# model = "gpt-4o-2024-05-13",
|
159 |
-
temperature=0
|
160 |
-
)
|
161 |
|
162 |
# print(prompt_tracing.user + ":\n" + prompt)
|
163 |
if prompt_tracing.tracking:
|
@@ -372,23 +386,7 @@ class Judge():
|
|
372 |
stage 4_1 - Optional Stage
|
373 |
'''
|
374 |
# print(input_text)
|
375 |
-
gpt_prompt =
|
376 |
-
Above is facts from lawsuit claim by claimant, facts from defendant response, clarifications from claimant, clarification from defendant and text extracted from response to clarification from claimant.
|
377 |
-
You are a legal assistant assigned to analyse claimant's last response.
|
378 |
-
Proceed with the following steps
|
379 |
-
|
380 |
-
At this stage of the automated legal process, which is strictly optional, the claimant has limited impact. This stage is only activated if the defendant has provided new evidence at stage 4. In this case, the claimant's actions are strictly limited to challenging the fact-evidence connections presented by the defendant in their new evidence.
|
381 |
-
The claimant cannot introduce new evidence into the case. Any attempts to add evidence at this stage will be rejected, as the focus of this stage is strictly on evaluating and analyzing the data already presented by the defendant.
|
382 |
-
The claimant is not allowed to provide additional explanations or new arguments regarding the facts of the case. They are limited to the arguments and evidence already existing in the case materials.
|
383 |
-
The only permissible action for the claimant at this stage is to challenge the correctness and applicability of the fact-evidence connections that the defendant has presented in their new evidence.
|
384 |
-
1. In the case of the Claimant's disagreement with the evidence-fact linkage proposed by the Defendant in the additional explanation submitted at Stage 4, analyze the Defendant's version of the evidence-fact linkage as follows:
|
385 |
-
2. Determine whether it is possible to conceive of evidence that would prove the opposite fact to that proposed by the Defendant in their version of the evidence-fact linkage.
|
386 |
-
3.1. If such hypothetical evidence cannot be assumed, then the evidence-fact linkage proposed by the Defendant is considered valid.
|
387 |
-
3.2. If such hypothetical evidence can be assumed: consider whether the fact indicated by the Defendant in their version can be proven using the evidence used by the Defendant in the linkage, assuming the existence of any additional evidence, but in such a way that both the Defendant’s evidence and the hypothetical evidence have mandatory value for establishing the fact referred to by the Defendant.
|
388 |
-
3.3. Make a final conclusion about whether the evidence is at least indirectly related to the fact or not.
|
389 |
-
4.1. If, as a result of the analysis, the Defendant's evidence does not even indirectly prove the fact referred to, then such evidence should not be considered further in the evaluation of evidence and this point should be mentioned in output.
|
390 |
-
4.2. If, as a result of the analysis, the Defendant's evidence at least indirectly proves the fact referred to, this point should be mentioned in output.
|
391 |
-
"""
|
392 |
|
393 |
prompt = self.claimant_facts_and_evidence + self.defendant_facts_and_evidence + self.claimant_response_to_defendant_facts + self.defendant_response_to_claimant_clarification_facts + "Claimant's response to defendant's clarifications: \n" + input_text + "\n\nPrompt:" + gpt_prompt
|
394 |
|
|
|
1 |
import os
|
2 |
from openai import OpenAI
|
3 |
+
from openai import AzureOpenAI
|
4 |
from llama_index.llms.groq import Groq
|
5 |
from mistralai.client import MistralClient
|
6 |
from mistralai.models.chat_completion import ChatMessage
|
|
|
19 |
|
20 |
load_dotenv()
|
21 |
|
|
|
|
|
22 |
class Judge():
|
23 |
def __init__(self):
|
24 |
self.stage=1
|
|
|
141 |
|
142 |
def llm_function_call(self, prompt, model):
|
143 |
if "gpt" in model:
|
144 |
+
|
145 |
+
# self.client = OpenAI(
|
146 |
+
# # This is the default and can be omitted
|
147 |
+
# api_key=os.environ.get("OPENAI_API_KEY"),
|
148 |
+
# )
|
149 |
+
|
150 |
+
# chat_completion = self.client.chat.completions.create(
|
151 |
+
# messages=[
|
152 |
+
# {
|
153 |
+
# "role": "user",
|
154 |
+
# "content": prompt,
|
155 |
+
# }
|
156 |
+
# ],
|
157 |
+
# model=model,
|
158 |
+
# # model = "gpt-4o-2024-05-13",
|
159 |
+
# temperature=0
|
160 |
+
# )
|
161 |
+
client = AzureOpenAI(
|
162 |
+
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
|
163 |
+
api_version="2024-02-01",
|
164 |
+
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
|
165 |
+
)
|
166 |
+
chat_completion = client.chat.completions.create(
|
167 |
+
model="gpt-4",
|
168 |
+
temperature=0,
|
169 |
+
messages = [
|
170 |
+
{
|
171 |
+
"role":"user",
|
172 |
+
"content":prompt
|
173 |
+
}])
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
# print(prompt_tracing.user + ":\n" + prompt)
|
177 |
if prompt_tracing.tracking:
|
|
|
386 |
stage 4_1 - Optional Stage
|
387 |
'''
|
388 |
# print(input_text)
|
389 |
+
gpt_prompt = judgement_stage_prompts.stage_4_1_prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
|
391 |
prompt = self.claimant_facts_and_evidence + self.defendant_facts_and_evidence + self.claimant_response_to_defendant_facts + self.defendant_response_to_claimant_clarification_facts + "Claimant's response to defendant's clarifications: \n" + input_text + "\n\nPrompt:" + gpt_prompt
|
392 |
|
perspective.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import os
|
2 |
-
from openai import OpenAI
|
3 |
from llama_index.llms.groq import Groq
|
4 |
from mistralai.client import MistralClient
|
5 |
from mistralai.models.chat_completion import ChatMessage
|
@@ -45,28 +45,48 @@ class Perspective():
|
|
45 |
|
46 |
def llm_function_call(self, prompt, model):
|
47 |
if "gpt" in model:
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
)
|
|
|
52 |
|
53 |
-
chat_completion = self.client.chat.completions.create(
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
)
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
comet_llm.log_prompt(
|
66 |
-
prompt=prompt,
|
67 |
output=chat_completion.choices[0].message.content,
|
68 |
)
|
69 |
-
|
|
|
70 |
return chat_completion.choices[0].message.content
|
71 |
|
72 |
elif model == "llama3-70b-8192":
|
|
|
1 |
import os
|
2 |
+
from openai import OpenAI, AzureOpenAI
|
3 |
from llama_index.llms.groq import Groq
|
4 |
from mistralai.client import MistralClient
|
5 |
from mistralai.models.chat_completion import ChatMessage
|
|
|
45 |
|
46 |
def llm_function_call(self, prompt, model):
|
47 |
if "gpt" in model:
|
48 |
+
|
49 |
+
# self.client = OpenAI(
|
50 |
+
# # This is the default and can be omitted
|
51 |
+
# api_key=os.environ.get("OPENAI_API_KEY"),
|
52 |
+
# )
|
53 |
|
54 |
+
# chat_completion = self.client.chat.completions.create(
|
55 |
+
# messages=[
|
56 |
+
# {
|
57 |
+
# "role": "user",
|
58 |
+
# "content": prompt,
|
59 |
+
# }
|
60 |
+
# ],
|
61 |
+
# model=model,
|
62 |
+
# # model = "gpt-4o-2024-05-13",
|
63 |
+
# temperature=0
|
64 |
+
# )
|
65 |
+
client = AzureOpenAI(
|
66 |
+
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
|
67 |
+
api_version="2024-02-01",
|
68 |
+
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
|
69 |
+
)
|
70 |
+
chat_completion = client.chat.completions.create(
|
71 |
+
model="gpt-4",
|
72 |
+
temperature=0,
|
73 |
+
messages = [
|
74 |
+
{
|
75 |
+
"role":"user",
|
76 |
+
"content":prompt
|
77 |
+
}])
|
78 |
+
|
79 |
+
|
80 |
+
# print(prompt_tracing.user + ":\n" + prompt)
|
81 |
+
if prompt_tracing.tracking:
|
82 |
+
# prompt_tracing.send_prompt_over_discord(prompt)
|
83 |
+
# prompt_tracing.send_response_over_discord(chat_completion.choices[0].message.content)
|
84 |
comet_llm.log_prompt(
|
85 |
+
prompt=prompt_tracing.user + ":\n" + prompt,
|
86 |
output=chat_completion.choices[0].message.content,
|
87 |
)
|
88 |
+
|
89 |
+
|
90 |
return chat_completion.choices[0].message.content
|
91 |
|
92 |
elif model == "llama3-70b-8192":
|
prompts/judgement_stage_prompts.py
CHANGED
@@ -381,52 +381,16 @@ Here is the algorithm for analyzing conditionally conflicting links of evidence:
|
|
381 |
A direct fact refers to circumstances or events that are directly and unequivocally confirmed by the presented evidence, meaning a direct fact cannot be refuted by other evidence unless such evidence is falsified. For example, if a party provides evidence of owning a house, within the scope of a direct fact, this evidence confirms that the party owns the property (and this fact cannot be refuted by other evidence).
|
382 |
At the end of this point, it is necessary to establish two facts: one from the Plaintiff's evidence and one from the Defendant's evidence.
|
383 |
1.2. Next, analyze these two facts to determine whether they directly contradict each other. A direct contradiction occurs when the presence of one fact excludes the existence of another fact. For example, one party provides evidence that, within the scope of a direct fact, confirms the completion of construction work, while the other party provides evidence that it (the other party) performed these works; thus, these two facts contradict each other.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
2.1. If the two facts contradict each other, it is necessary to determine the strength of the evidence (strong, medium, weak) supporting them.
|
385 |
For this point:
|
386 |
-
|
387 |
Weak evidence: Documentary evidence prepared exclusively by one party (signed only by the Plaintiff or only by the Defendant).
|
388 |
-
Medium evidence: Documentary evidence signed by multiple independent parties (e.g., by both the Plaintiff and the Defendant, the Plaintiff and another person, the Defendant and another person, or just another person).
|
389 |
-
Strong evidence: Objective evidence (evidence that implies independent recording of facts, e.g., photographs, expert opinions, etc.).
|
390 |
-
2.1.1. If the facts are supported by evidence of different strengths, only the fact supported by the stronger evidence is considered further, and the weaker evidence is completely disregarded.
|
391 |
-
2.1.2. If the facts are supported by evidence of equal strength, a cross-check of these facts should be conducted according to the following algorithm:
|
392 |
-
2.1.2.1. Analyze all of the Plaintiff's evidence to determine what indirect facts in support ofthe Defendant's main fact established in point 1 they can prove. For the purposes of this point, indirect facts refer to circumstances or events whose existence is not directly supported by evidence but can be inferred from it through logical deduction or assumption.
|
393 |
-
An example of an indirect fact might be the act of a creditor withdrawing cash, which can indirectly indicate their intention to enter into a loan agreement (e.g., the creditor's good faith).
|
394 |
-
2.1.2.2. Analyze all of the Defendant's evidence to determine what indirect facts in support of the Plaintiff's main fact established in point 1 they can prove. For the purposes of this point, indirect facts refer to circumstances or events whose existence is not directly supported by evidence but can be inferred from it through logical deduction or assumption.
|
395 |
-
An example of an indirect fact might be the act of a creditor withdrawing cash, which can indirectly indicate their intention to enter into a loan agreement (e.g., the creditor's good faith).
|
396 |
-
2.1.2.2.1. If indirect facts confirmed by the opposing side's evidence support only the Plaintiff's main fact, then the Defendant's main evidence is not considered further in the analysis of evidence.
|
397 |
-
2.1.2.2.2. If indirect facts confirmed by the opposing side's evidence support only the Defendant's main fact, then the Plaintiff's main evidence is not considered further in the analysis of evidence.
|
398 |
-
2.1.2.2.3 If indirect facts confirmed by the opposing side do not support either the Plaintiff's main fact or the Defendant's main fact, request additional evidence from the party to support the main fact; in this case, the initial evidence is not considered at all. New evidence is analyzed starting from point 1.
|
399 |
-
2.1.2.2.4. If such indirect facts confirmed by the opposing side support both the Plaintiff's main fact and the Defendant's main fact, analyze which strength of evidence by the opposing side supports the indirect facts in confirmation of the Plaintiff's main fact and the Defendant's main fact.
|
400 |
-
2.1.2.2.4.1. If stronger evidence by the Defendant confirms indirect facts in support of the Plaintiff's main fact, then the Defendant's main evidence is not considered further.
|
401 |
-
2.1.2.2.4.2. If stronger evidence by the Plaintiff confirms indirect facts in support of the Defendant's main fact, then the Plaintiff's main evidence is not considered further.
|
402 |
-
2.2. If conditionally conflicting evidence does not directly contradict each other, it is necessary to consider the probable purpose of providing such evidence in addition to the direct facts they establish. For example, the Plaintiff provides acts of completed work to prove that he completed the work and should be paid, while the Defendant provides acts of completed work with another person to prove that the work was completed by another person and should not be paid to the Plaintiff.
|
403 |
-
In such a case, the evidence de facto contradicts each other, so it is necessary to choose one of these two pieces of evidence, following the above algorithm.
|
404 |
-
If, even considering the purpose of providing such evidence, the evidence does not directly contradict each other, meaning it is objectively possible to conceive of the simultaneous existence of both facts confirmed by such evidence, then it is necessary to synthesize both facts into a single one. For example, the Plaintiff indicates that he is the owner of a house and provides proof of ownership, while the Defendant indicates that he lived in that house. Accordingly, these two facts do not contradict each other, as the Plaintiff can be the owner of the house and the Defendant can live in it. Accordingly, this will be the synthesized fact.
|
405 |
-
3. As a result, choose one of three options based on the analysis of the conditionally conflicting link: either the Plaintiff's evidence, the Defendant's evidence, or the synthesis of both pieces of evidence to confirm a single fact.
|
406 |
-
|
407 |
-
Output format:
|
408 |
-
Evidence Links and Selected Facts
|
409 |
-
1. Evidence Link 1
|
410 |
-
◦ Plaintiff's Evidence:
|
411 |
-
▪ Description: [Brief description of the evidence]
|
412 |
-
▪ Direct Fact: [Description of the direct fact established by this evidence]
|
413 |
-
◦ Defendant's Evidence:
|
414 |
-
▪ Description: [Brief description of the evidence]
|
415 |
-
▪ Direct Fact: [Description of the direct fact established by this evidence]
|
416 |
-
◦ Selection:
|
417 |
-
▪ [Plaintiff's Evidence/Defendant's Evidence/Synthesized Fact]
|
418 |
-
▪ Reason for Selection: [Detailed explanation of the selection of one piece of evidence or synthesis of facts]
|
419 |
-
2. Evidence Link 2
|
420 |
-
◦ Plaintiff's Evidence:
|
421 |
-
▪ Description: [Brief description of the evidence]
|
422 |
-
▪ Direct Fact: [Description of the direct fact established by this evidence]
|
423 |
-
◦ Defendant's Evidence:
|
424 |
-
▪ Description: [Brief description of the evidence]
|
425 |
-
▪ Direct Fact: [Description of the direct fact established by this evidence]
|
426 |
-
◦ Selection:
|
427 |
-
▪ [Plaintiff's Evidence/Defendant's Evidence/Synthesized Fact]
|
428 |
-
▪ Reason for Selection: [Detailed explanation of the selection of one piece of evidence or synthesis of facts]
|
429 |
-
etc
|
430 |
"""
|
431 |
|
432 |
stage_5_prompt = """
|
@@ -619,6 +583,7 @@ The final decision must contain the exact monetary amount of satisfied claims (o
|
|
619 |
3.3 Check for consistency: ensure that the decision does not contain internal contradictions and fully complies with both the factual circumstances and legal norms.
|
620 |
3.4 Document the logic of the decision: clearly record the logic and rationale of each aspect of the decision, ensuring its transparency and understandability for all parties.
|
621 |
3.5 Thus, you must fully resolve the question of doubling the claim or partially doubling the claim or denying the claim. You can't leave any of the claimant's claims unresolved.
|
|
|
622 |
3.6 Prepare the final full decision according to the following structure.
|
623 |
|
624 |
|
|
|
381 |
A direct fact refers to circumstances or events that are directly and unequivocally confirmed by the presented evidence, meaning a direct fact cannot be refuted by other evidence unless such evidence is falsified. For example, if a party provides evidence of owning a house, within the scope of a direct fact, this evidence confirms that the party owns the property (and this fact cannot be refuted by other evidence).
|
382 |
At the end of this point, it is necessary to establish two facts: one from the Plaintiff's evidence and one from the Defendant's evidence.
|
383 |
1.2. Next, analyze these two facts to determine whether they directly contradict each other. A direct contradiction occurs when the presence of one fact excludes the existence of another fact. For example, one party provides evidence that, within the scope of a direct fact, confirms the completion of construction work, while the other party provides evidence that it (the other party) performed these works; thus, these two facts contradict each other.
|
384 |
+
1.2.1. Study and clearly formulate the conditionally contradictory evidence presented by each party.
|
385 |
+
1.2.2. Check whether the conditionally contradictory evidence conflicts in terms of time. For example, one piece of evidence might indicate that an event occurred on a specific date, while another suggests it happened before or after that date.
|
386 |
+
1.2.3. Evaluate whether the conditionally contradictory evidence is compatible in a spatial context, such as if they are related to the use of the same location or object.
|
387 |
+
1.2.4 .Compare the conditionally contradictory evidence regarding actions taken or not taken. A contradiction occurs if one piece of evidence supports an action was taken, while another supports it was not.
|
388 |
+
1.2.5. Determine whether the conditionally contradictory evidence about individuals who performed certain actions corresponds. A contradiction arises if the pieces of evidence indicate different individuals.
|
389 |
+
1.2.6. Analyze whether the conditionally contradictory evidence conflicts in terms of the volume or quality of the actions or services performed.
|
390 |
+
1.2.7. If a contradiction is identified under any of the criteria, the evidence is considered contradictory. There is no need to further check other criteria.
|
391 |
2.1. If the two facts contradict each other, it is necessary to determine the strength of the evidence (strong, medium, weak) supporting them.
|
392 |
For this point:
|
|
|
393 |
Weak evidence: Documentary evidence prepared exclusively by one party (signed only by the Plaintiff or only by the Defendant).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
"""
|
395 |
|
396 |
stage_5_prompt = """
|
|
|
583 |
3.3 Check for consistency: ensure that the decision does not contain internal contradictions and fully complies with both the factual circumstances and legal norms.
|
584 |
3.4 Document the logic of the decision: clearly record the logic and rationale of each aspect of the decision, ensuring its transparency and understandability for all parties.
|
585 |
3.5 Thus, you must fully resolve the question of doubling the claim or partially doubling the claim or denying the claim. You can't leave any of the claimant's claims unresolved.
|
586 |
+
Please note that if there are grounds for partial doubling of the claim, but it is objectively impossible to determine the exact amount from the available evidence (even approximately), the claim is subject to dismissal. Since the obligation to justify the amount of the claim lies with the claimant.
|
587 |
3.6 Prepare the final full decision according to the following structure.
|
588 |
|
589 |
|
settlement.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import os
|
2 |
-
from openai import OpenAI
|
3 |
from llama_index.llms.groq import Groq
|
4 |
from mistralai.client import MistralClient
|
5 |
from mistralai.models.chat_completion import ChatMessage
|
@@ -49,27 +49,48 @@ class Settlement():
|
|
49 |
|
50 |
def llm_function_call(self, prompt, model):
|
51 |
if "gpt" in model:
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
)
|
|
|
56 |
|
57 |
-
chat_completion = self.client.chat.completions.create(
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
)
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
comet_llm.log_prompt(
|
70 |
-
prompt=prompt,
|
71 |
output=chat_completion.choices[0].message.content,
|
72 |
)
|
|
|
|
|
73 |
return chat_completion.choices[0].message.content
|
74 |
|
75 |
elif model == "llama3-70b-8192":
|
|
|
1 |
import os
|
2 |
+
from openai import OpenAI, AzureOpenAI
|
3 |
from llama_index.llms.groq import Groq
|
4 |
from mistralai.client import MistralClient
|
5 |
from mistralai.models.chat_completion import ChatMessage
|
|
|
49 |
|
50 |
def llm_function_call(self, prompt, model):
|
51 |
if "gpt" in model:
|
52 |
+
|
53 |
+
# self.client = OpenAI(
|
54 |
+
# # This is the default and can be omitted
|
55 |
+
# api_key=os.environ.get("OPENAI_API_KEY"),
|
56 |
+
# )
|
57 |
|
58 |
+
# chat_completion = self.client.chat.completions.create(
|
59 |
+
# messages=[
|
60 |
+
# {
|
61 |
+
# "role": "user",
|
62 |
+
# "content": prompt,
|
63 |
+
# }
|
64 |
+
# ],
|
65 |
+
# model=model,
|
66 |
+
# # model = "gpt-4o-2024-05-13",
|
67 |
+
# temperature=0
|
68 |
+
# )
|
69 |
+
client = AzureOpenAI(
|
70 |
+
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
|
71 |
+
api_version="2024-02-01",
|
72 |
+
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
|
73 |
+
)
|
74 |
+
chat_completion = client.chat.completions.create(
|
75 |
+
model="gpt-4",
|
76 |
+
temperature=0,
|
77 |
+
messages = [
|
78 |
+
{
|
79 |
+
"role":"user",
|
80 |
+
"content":prompt
|
81 |
+
}])
|
82 |
+
|
83 |
+
|
84 |
+
# print(prompt_tracing.user + ":\n" + prompt)
|
85 |
+
if prompt_tracing.tracking:
|
86 |
+
# prompt_tracing.send_prompt_over_discord(prompt)
|
87 |
+
# prompt_tracing.send_response_over_discord(chat_completion.choices[0].message.content)
|
88 |
comet_llm.log_prompt(
|
89 |
+
prompt=prompt_tracing.user + ":\n" + prompt,
|
90 |
output=chat_completion.choices[0].message.content,
|
91 |
)
|
92 |
+
|
93 |
+
|
94 |
return chat_completion.choices[0].message.content
|
95 |
|
96 |
elif model == "llama3-70b-8192":
|