YvesP commited on
Commit
f2681b8
·
1 Parent(s): f53f6c3

changes in the word doc + minor edits

Browse files
data/business_trips_content_until_end_en.docx CHANGED
Binary files a/data/business_trips_content_until_end_en.docx and b/data/business_trips_content_until_end_en.docx differ
 
src/control/control.py CHANGED
@@ -51,8 +51,9 @@ class Controller:
51
  while answer and answer[0] in {"'", '"', " ", "`"}:
52
  answer = answer[1:]
53
  answer = answer.strip('bot:')
54
- if answer and answer[-1] != ".":
55
- answer += "."
 
56
  return answer
57
 
58
  @staticmethod
 
51
  while answer and answer[0] in {"'", '"', " ", "`"}:
52
  answer = answer[1:]
53
  answer = answer.strip('bot:')
54
+ if answer:
55
+ if answer[-1] != ".":
56
+ answer += "."
57
  return answer
58
 
59
  @staticmethod
src/tools/llm.py CHANGED
@@ -10,7 +10,7 @@ class LlmAgent:
10
  f"\\n ``` {query} ```\\n"
11
  f"Your answer is based on the context delimited by triple backticks: "
12
  f"\\n ``` {context} ```\\n"
13
- f"You are consistent and avoid redundancies with the rest of the initial conversation in french"
14
  f"delimited by triple backticks: "
15
  f"\\n ``` {histo} ```\\n"
16
  f"Your response shall be in {language} and shall be concise"
@@ -24,11 +24,10 @@ class LlmAgent:
24
  print(p)
25
  return p
26
 
27
-
28
  def translate(self, text: str, language="en") -> str:
29
  """translates"""
30
 
31
- languages = "french to english" if language == "en" else "english to french"
32
 
33
  template = (f" Your task consists in translating {languages}\\n"
34
  f" the following text delimited by by triple backticks: ```{text}```\n"
@@ -38,24 +37,21 @@ class LlmAgent:
38
  return p
39
 
40
  def generate_answer(self, query: str, answer_en: str, histo_fr: str, context_fr: str) -> str:
41
- """provides the final answer in french based on the initial query and the answer in english"""
42
 
43
  def _cut_unfinished_sentence(s: str):
44
- return '.'.join(p.split('.')[:-1])
45
 
46
- template = (f"Your task consists in translating the answer in french to the query "
47
  f"delimited by triple backticks: ```{query}``` \\n"
48
  f"You are given the answer in english delimited by triple backticks: ```{answer_en}```"
49
- f"\\n You don't add new content to the answer in english but: "
50
- f"\\n 1 You can use some vocabulary from the context in french delimited by triple backticks: "
51
  f"```{context_fr}```"
52
  f"\\n 2 You are consistent and avoid redundancies with the rest of the initial"
53
- f" conversation in french delimited by triple backticks: ```{histo_fr}```"
54
  )
55
 
56
  p = self.llm(template)
57
- p = _cut_unfinished_sentence(p)
58
  return p
59
-
60
-
61
-
 
10
  f"\\n ``` {query} ```\\n"
11
  f"Your answer is based on the context delimited by triple backticks: "
12
  f"\\n ``` {context} ```\\n"
13
+ f"You are consistent and avoid redundancies with the rest of the initial conversation in French"
14
  f"delimited by triple backticks: "
15
  f"\\n ``` {histo} ```\\n"
16
  f"Your response shall be in {language} and shall be concise"
 
24
  print(p)
25
  return p
26
 
 
27
  def translate(self, text: str, language="en") -> str:
28
  """translates"""
29
 
30
+ languages = "`French to English" if language == "en" else "English to French"
31
 
32
  template = (f" Your task consists in translating {languages}\\n"
33
  f" the following text delimited by by triple backticks: ```{text}```\n"
 
37
  return p
38
 
39
  def generate_answer(self, query: str, answer_en: str, histo_fr: str, context_fr: str) -> str:
40
+ """provides the final answer in French based on the initial query and the answer in english"""
41
 
42
  def _cut_unfinished_sentence(s: str):
43
+ return '.'.join(s.split('.')[:-1])
44
 
45
+ template = (f"Your task consists in translating the answer in French to the query "
46
  f"delimited by triple backticks: ```{query}``` \\n"
47
  f"You are given the answer in english delimited by triple backticks: ```{answer_en}```"
48
+ f"\\n You don't add new content to the answer in English but: "
49
+ f"\\n 1 You can use some vocabulary from the context in French delimited by triple backticks: "
50
  f"```{context_fr}```"
51
  f"\\n 2 You are consistent and avoid redundancies with the rest of the initial"
52
+ f" conversation in French delimited by triple backticks: ```{histo_fr}```"
53
  )
54
 
55
  p = self.llm(template)
56
+ # p = _cut_unfinished_sentence(p)
57
  return p