ofermend commited on
Commit
b0faf1a
·
1 Parent(s): 5faad16
Files changed (3) hide show
  1. Dockerfile +3 -1
  2. agent.py +45 -1
  3. requirements.txt +1 -1
Dockerfile CHANGED
@@ -4,7 +4,9 @@ WORKDIR /app
4
 
5
  COPY ./requirements.txt /app/requirements.txt
6
 
7
- RUN pip3 install --no-cache-dir -r /app/requirements.txt
 
 
8
 
9
  # User
10
  RUN useradd -m -u 1000 user
 
4
 
5
  COPY ./requirements.txt /app/requirements.txt
6
 
7
+ RUN pip3 install --no-cache-dir --upgrade pip
8
+ RUN pip3 install --no-cache-dir wheel setuptools build
9
+ RUN pip3 install --no-cache-dir --use-pep517 -r /app/requirements.txt
10
 
11
  # User
12
  RUN useradd -m -u 1000 user
agent.py CHANGED
@@ -73,6 +73,50 @@ prompt = """
73
  ]
74
  """
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  def create_assistant_tools(cfg):
77
 
78
  class QueryPublicationsArgs(BaseModel):
@@ -96,7 +140,7 @@ def create_assistant_tools(cfg):
96
  reranker = "slingshot", rerank_k = 100, rerank_cutoff = 0.1,
97
  n_sentences_before = 1, n_sentences_after = 1, lambda_val = 0.1,
98
  summary_num_results = 15,
99
- max_response_chars = 8192, max_tokens = 4096,
100
  vectara_summarizer = summarizer,
101
  include_citations = True,
102
  vectara_prompt_text = prompt,
 
73
  ]
74
  """
75
 
76
+
77
+ prompt_new = """
78
+ [
79
+ {"role": "system",
80
+ "content": "You are an AI assistant that forms a detailed and comprehensive answer to a user query based on search results that are provided to you." },
81
+ {"role": "user", "content": "
82
+ [INSTRUCTIONS]
83
+ You are an expert in clinical trial and statistical data analysis with extensive experience in analyzing and interpreting clinical research data.
84
+ If the search results are irrelevant to the question respond with *** I do not have enough information to answer this question.***
85
+ Do not mention or list the search results or references in your response. Never explicitly mention a specific search result.
86
+ Search results may include tables in a markdown format. When answering a question using a table be careful about which rows and columns contain the answer and include all relevant information from the relevant rows and columns that the query is asking about.
87
+ Do not cobble facts together from multiple search results, instead summarize the main facts into a consistent and easy to understand response.
88
+ Do not base your response on information or knowledge that is not in the search results.
89
+ Make sure your response is answering the query asked. If the query is related to an entity (such as a person or place), make sure you use search results related to that entity.
90
+ For queries where only a short answer is required, you can give a brief response.
91
+ Consider that each search result is a partial segment from a bigger text, and may be incomplete.
92
+ Never refer to the search results in your response.
93
+ Ignore any search results that do not contain information relevant to answering the query.
94
+ Your output should always be in a single language - the $vectaraLangName language. Check spelling and grammar for the $vectaraLangName language.
95
+ Search results for the query *** $vectaraQuery***, are listed below, some are text, some MAY be tables in the format described above.
96
+ #foreach ($qResult in $vectaraQueryResultsDeduped)
97
+ [$esc.java($foreach.index + 1)]
98
+ #if($qResult.hasTable())
99
+ Table Title: $qResult.getTable().title() || Table Description: $qResult.getTable().description() || Table Data:
100
+ $qResult.getTable().markdown()
101
+ #else
102
+ $qResult.getText()
103
+ #end
104
+ #end
105
+ Generate a coherent response (but no more than $vectaraOutChars characters) to the query *** $vectaraQuery *** by summarizing the search results provided.
106
+ Give a slight preference to search results that appear earlier in the list.
107
+ Include statistical and numerical evidence to support and contextualize your response.
108
+ Your response should include all relevant information and values from the search results. Do not omit anything relevant.
109
+ Prioritize a long, detailed, thorough and comprehensive response over a short one.
110
+ When asked about baseline characteristics, include as many such characteristics as possible in your response. Be detailed and comprehensive.
111
+ For example, always include in baseline characteristics the sample size (number of patients), population demographics (male/female), age, race, and BMI.
112
+ Include statistical and numerical evidence to support and contextualize your response.
113
+ If the question is vague or ambiguous, ask for clarification.
114
+ Your response should include all relevant information and values from the search results. Do not omit anything relevant.
115
+ Only cite relevant search results in your answer following these specific instructions: $vectaraCitationInstructions
116
+ If the search results are irrelevant to the query, respond with ***I do not have enough information to answer this question.***. Respond always in the $vectaraLangName language, and only in that language."}
117
+ ]
118
+ """
119
+
120
  def create_assistant_tools(cfg):
121
 
122
  class QueryPublicationsArgs(BaseModel):
 
140
  reranker = "slingshot", rerank_k = 100, rerank_cutoff = 0.1,
141
  n_sentences_before = 1, n_sentences_after = 1, lambda_val = 0.1,
142
  summary_num_results = 15,
143
+ max_tokens = 8192,
144
  vectara_summarizer = summarizer,
145
  include_citations = True,
146
  vectara_prompt_text = prompt,
requirements.txt CHANGED
@@ -5,5 +5,5 @@ streamlit_feedback==0.1.3
5
  uuid==1.30
6
  langdetect==1.0.9
7
  langcodes==3.4.0
8
- vectara-agentic==0.2.8
9
  torch==2.6.0
 
5
  uuid==1.30
6
  langdetect==1.0.9
7
  langcodes==3.4.0
8
+ vectara-agentic==0.2.11
9
  torch==2.6.0