bioguider 0.2.13__py3-none-any.whl → 0.2.15__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.

Potentially problematic release.


This version of bioguider might be problematic. Click here for more details.

@@ -5,7 +5,7 @@ from abc import ABC, abstractmethod
5
5
  from langchain_openai.chat_models.base import BaseChatOpenAI
6
6
  from langgraph.graph.graph import CompiledGraph
7
7
 
8
- from bioguider.utils.constants import DEFAULT_TOKEN_USAGE
8
+ from bioguider.utils.constants import DEFAULT_TOKEN_USAGE, MAX_STEP_COUNT
9
9
  from bioguider.database.summarized_file_db import SummarizedFilesDb
10
10
 
11
11
  class AgentTask(ABC):
@@ -82,7 +82,7 @@ class AgentTask(ABC):
82
82
  for s in self.graph.stream(
83
83
  input=input,
84
84
  stream_mode="values",
85
- config={"recursion_limit": 500},
85
+ config={"recursion_limit": MAX_STEP_COUNT},
86
86
  ):
87
87
  print(s)
88
88
 
@@ -8,6 +8,7 @@ from bioguider.agents.collection_task_utils import CollectionWorkflowState
8
8
  from bioguider.agents.common_agent_2step import CommonAgentTwoChainSteps, CommonAgentTwoSteps
9
9
  from bioguider.agents.peo_common_step import PEOCommonStep
10
10
  from bioguider.agents.prompt_utils import COLLECTION_GOAL, COLLECTION_PROMPTS
11
+ from bioguider.utils.constants import MAX_STEP_COUNT
11
12
 
12
13
 
13
14
  COLLECTION_OBSERVE_SYSTEM_PROMPT = """You are an expert software developer and technical documentation analyst.
@@ -92,11 +93,14 @@ class CollectionObserveStep(PEOCommonStep):
92
93
  important_instructions=important_instructions,
93
94
  )
94
95
  def _execute_directly(self, state: CollectionWorkflowState):
96
+ step_count = state["step_count"]
97
+ instruction = "Now, we have reached max recursion limit, please give me the **final answer** based on the current information" \
98
+ if step_count == MAX_STEP_COUNT - 2 else "Let's begin thinking."
95
99
  system_prompt = self._build_prompt(state)
96
100
  agent = CommonAgentTwoSteps(llm=self.llm)
97
101
  res, _, token_usage, reasoning_process = agent.go(
98
102
  system_prompt=system_prompt,
99
- instruction_prompt="Let's begin thinking.",
103
+ instruction_prompt=instruction,
100
104
  schema=ObservationResult,
101
105
  )
102
106
  state["final_answer"] = res.FinalAnswer
@@ -104,9 +108,10 @@ class CollectionObserveStep(PEOCommonStep):
104
108
  thoughts = res.Thoughts
105
109
  state["step_analysis"] = analysis
106
110
  state["step_thoughts"] = thoughts
111
+ state["step_count"] += 1
107
112
  self._print_step(
108
113
  state,
109
- step_output=f"**Observation Reasoning Process**\n{reasoning_process}"
114
+ step_output=f"**Observation Reasoning Process: {state['step_count']}**\n{reasoning_process}"
110
115
  )
111
116
  self._print_step(
112
117
  state,
@@ -176,7 +176,7 @@ class CollectionTask(AgentTask):
176
176
  self.graph = graph.compile()
177
177
 
178
178
  def collect(self) -> list[str] | None:
179
- s = self._go_graph({"goal_item": self.goal_item})
179
+ s = self._go_graph({"goal_item": self.goal_item, "step_count": 0})
180
180
  if s is None or 'final_answer' not in s:
181
181
  return None
182
182
  if s["final_answer"] is None:
@@ -28,6 +28,7 @@ class CollectionWorkflowState(TypedDict):
28
28
 
29
29
  goal_item: Optional[str]
30
30
  final_answer: Optional[str]
31
+ step_count: Optional[int]
31
32
 
32
33
  RELATED_FILE_GOAL_ITEM = """
33
34
  Your task is to determine whether the file is related to **{goal_item}**.
@@ -211,6 +211,8 @@ class EvaluationInstallationTask(EvaluationTask):
211
211
  instruction_prompt=EVALUATION_INSTRUCTION,
212
212
  schema=StructuredEvaluationInstallationResult,
213
213
  )
214
+ res: StructuredEvaluationInstallationResult = res
215
+ res.dependency_number = 0 if res.dependency_number is None else res.dependency_number
214
216
  self.print_step(step_output=reasoning_process)
215
217
  self.print_step(token_usage=token_usage)
216
218
 
@@ -5,6 +5,7 @@ from bioguider.agents.agent_utils import ObservationResult
5
5
  from bioguider.agents.common_agent_2step import CommonAgentTwoSteps, CommonAgentTwoChainSteps
6
6
  from bioguider.agents.identification_task_utils import IdentificationWorkflowState
7
7
  from bioguider.agents.peo_common_step import PEOWorkflowState, PEOCommonStep
8
+ from bioguider.utils.constants import MAX_STEP_COUNT
8
9
 
9
10
 
10
11
  ## observation system prompt
@@ -76,11 +77,14 @@ class IdentificationObserveStep(PEOCommonStep):
76
77
  )
77
78
 
78
79
  def _execute_directly(self, state: IdentificationWorkflowState):
80
+ step_count = state["step_count"]
81
+ instruction = "Now, we have reached max recursion limit, please give me the **final answer** based on the current information" \
82
+ if step_count == MAX_STEP_COUNT - 2 else "Now, Let's begin."
79
83
  system_prompt = self._prepare_system_prompt(state)
80
84
  agent = CommonAgentTwoSteps(llm=self.llm)
81
85
  res, _, token_usage, reasoning_process = agent.go(
82
86
  system_prompt=system_prompt,
83
- instruction_prompt="Now, let's begin.",
87
+ instruction_prompt=instruction,
84
88
  schema=ObservationResult,
85
89
  )
86
90
  state["final_answer"] = res.FinalAnswer
@@ -88,9 +92,10 @@ class IdentificationObserveStep(PEOCommonStep):
88
92
  thoughts = res.Thoughts
89
93
  state["step_analysis"] = analysis
90
94
  state["step_thoughts"] = thoughts
95
+ state["step_count"] += 1
91
96
  self._print_step(
92
97
  state,
93
- step_output=f"**Observation Reasoning Process**\n{reasoning_process}"
98
+ step_output=f"**Observation Reasoning Process {state['step_count']}**\n{reasoning_process}"
94
99
  )
95
100
  self._print_step(
96
101
  state,
@@ -173,6 +173,7 @@ class IdentificationTask(AgentTask):
173
173
  s = self._go_graph({
174
174
  "goal": IDENTIFICATION_GOAL_PROJECT_TYPE,
175
175
  "final_answer_example": PROJECT_TYPE_FINAL_ANSWER_EXAMPLE,
176
+ "step_count": 0,
176
177
  })
177
178
  proj_type = s["final_answer"] if "final_answer" in s else "unknown type"
178
179
  return self._parse_project_type(proj_type)
@@ -181,6 +182,7 @@ class IdentificationTask(AgentTask):
181
182
  s = self._go_graph({
182
183
  "goal": IDENTIFICATION_GOAL_PRIMARY_LANGUAGE,
183
184
  "final_answer_example": PRIMARY_LANGUAGE_FINAL_ANSWER_EXAMPLE,
185
+ "step_count": 0,
184
186
  })
185
187
  language = s["final_answer"] if "final_answer" in s else "unknown type"
186
188
  return self._parse_primary_language(language)
@@ -189,6 +191,7 @@ class IdentificationTask(AgentTask):
189
191
  s = self._go_graph({
190
192
  "goal": IDENTIFICATION_GOAL_META_DATA,
191
193
  "final_answer_example": META_DATA_FINAL_ANSWER_EXAMPLE,
194
+ "step_count": 0,
192
195
  })
193
196
  meta_data = s["final_answer"] if "final_answer" in s else "unknown type"
194
197
  return self._parse_meta_data(meta_data)
@@ -205,6 +208,7 @@ class IdentificationTask(AgentTask):
205
208
  "final_answer_example": final_answer_example,
206
209
  "plan_instructions": plan_instructions,
207
210
  "observe_instructions": observe_instructions,
211
+ "step_count": 0,
208
212
  })
209
213
  return s["final_answer"] if "final_answer" in s else None
210
214
 
@@ -18,3 +18,5 @@ class IdentificationWorkflowState(TypedDict):
18
18
  step_output: Optional[str]
19
19
  step_analysis: Optional[str]
20
20
  step_thoughts: Optional[str]
21
+
22
+ step_count: Optional[int]
@@ -208,6 +208,7 @@ If **any one** of these is present, the document should be classified as Contrib
208
208
  """,
209
209
  "plan_important_instructions": """ - A comiled standalone software file is non-textual and appears to be in an executable format (e.g., `.exe`, `.dll`, `.so`, `.bin`, `.elf`).
210
210
  - A comiled standalone software file **is not a script or compiled library**, that is, It is not a wrapper script (e.g., shell, Python, Python notebook or Rmd) nor a dynamic/shared library meant for linking.
211
+ So, when you are identifying a binary file, **do not** use any tools (our tools don't work for binary file), you need to figure out if it is compiled standalone software file by the file name and extension on your own.
211
212
  - When identifying source code file, prioritize analyzing the file's **extension** and **file name** and try to avoid reading file, using check_file_related_tool or summarizing file content.
212
213
  - When identifying example data, prioritize analyzing the file's **extension** (like .dat, .csv, .fastq, and so on) and **file name** (like example_data.txt, example.dat, and so on). If extension/name is ambiguous, use summarizing file content to decide.
213
214
  - **Note**: You **only need to detect** whether at least **one** compiled standalone software file, **one** source code file and **one** example data file exist — no need to list all such files.
@@ -114,7 +114,7 @@ class SummarizedFilesDb:
114
114
  file_path: str,
115
115
  instruction: str,
116
116
  summarize_level: int,
117
- summarize_prompt: str,
117
+ summarize_prompt: str = "N/A",
118
118
  ) -> str | None:
119
119
  self._connect_to_db()
120
120
  self._ensure_tables()
@@ -39,4 +39,5 @@ class ProjectMetadata:
39
39
  self.license = license
40
40
 
41
41
  MAX_FILE_LENGTH=10 *1024 # 10K
42
- MAX_SENTENCE_NUM=20
42
+ MAX_SENTENCE_NUM=20
43
+ MAX_STEP_COUNT=30
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bioguider
3
- Version: 0.2.13
3
+ Version: 0.2.15
4
4
  Summary: An AI-Powered package to help biomedical developers to generate clear documentation
5
5
  License: MIT
6
6
  Author: Cankun Wang
@@ -1,13 +1,13 @@
1
1
  bioguider/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  bioguider/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- bioguider/agents/agent_task.py,sha256=B_QGkoA96GdrYSX29TQ_tct_y8z4zS4l5Cn0-eph88k,2863
3
+ bioguider/agents/agent_task.py,sha256=TL0Zx8zOmiAVslmNbfMPQ38qTQ73QospY6Dwrwf8POg,2890
4
4
  bioguider/agents/agent_tools.py,sha256=r21wHV6a-Ic2T0dk4YzA-_d7PodHPM3GzRxJqv-llSw,7286
5
5
  bioguider/agents/agent_utils.py,sha256=FFFhZvL_THvZ2Y7QwFmi3jsUd1i7PYi9tPJNMTVUsgY,14702
6
6
  bioguider/agents/collection_execute_step.py,sha256=Ev4BLjjmBdsc52M1zrq7QK8g7fsffDkSxu-jN2rvedw,5614
7
- bioguider/agents/collection_observe_step.py,sha256=N_P5NadFa0usO0M9cXXJvKJoZofwcDW0cPSfnwvPEO4,4786
7
+ bioguider/agents/collection_observe_step.py,sha256=Y2HzO1tM8q6mr__wi9G52h0vVanwAAB1DOA4RGmiYYI,5138
8
8
  bioguider/agents/collection_plan_step.py,sha256=Nn0f8AOkEDCDtnhaqE7yCQoi7PVpsHmiUcsIqC0T0dQ,5956
9
- bioguider/agents/collection_task.py,sha256=ZLUxDgh8OkY5INMfC283RdxEYCZJTksoLDNEMfKg-3s,7865
10
- bioguider/agents/collection_task_utils.py,sha256=CmOh3HZEocuLj5VZCkLbD6P8O5tzyuyFa8Ykd-1GPGE,5356
9
+ bioguider/agents/collection_task.py,sha256=MjpTYiQQYUpmQf2UOn-dOCZU3kxypc4uOnzd15wb1Ow,7882
10
+ bioguider/agents/collection_task_utils.py,sha256=_e2EebYhl-UYjZ0rHNf2-p32YlstBSffv32suiuT9LI,5386
11
11
  bioguider/agents/common_agent.py,sha256=eGs8m8bjO0dmW6lDIen7DQNdWdHD7j8Udf3XhL1k6vI,5242
12
12
  bioguider/agents/common_agent_2step.py,sha256=Vton0RKtmMyEgIIFhnBk4CFU_hynX0LvwREcZ9kvMxQ,7918
13
13
  bioguider/agents/common_step.py,sha256=GdOCbmj1pwh4etg-futVFYVDQuoUG89DnIrw-B6QbzM,2594
@@ -16,21 +16,21 @@ bioguider/agents/dockergeneration_observe_step.py,sha256=93PO_Y4YyUShVTKRt0nErcj
16
16
  bioguider/agents/dockergeneration_plan_step.py,sha256=SB8tQM9PkIKsD2o1DFD7bedcxz6r6hSy8n_EVK60Fz0,7235
17
17
  bioguider/agents/dockergeneration_task.py,sha256=mYmorLKnJ-Jku3Qq_Y_kcSTsbYIo3RiVdD0puxqXY5Q,6221
18
18
  bioguider/agents/dockergeneration_task_utils.py,sha256=v7emqrJlVW-A5ZdLmPSdiaMSKCR8uzy9UYzx_1cgzyo,9041
19
- bioguider/agents/evaluation_installation_task.py,sha256=9AVE5PJB69aoDX0WMkye0UkYstSU2CsjzVB3eaPrLQo,11128
19
+ bioguider/agents/evaluation_installation_task.py,sha256=BMnxmzOj5hQPDsAzkmWO6ITe8q98B8v-rKvIXFfA9BY,11280
20
20
  bioguider/agents/evaluation_readme_task.py,sha256=_v7ESqMurOg4UXCGqc1zmaVscBx3QbznrUdAKQH9Zws,22597
21
21
  bioguider/agents/evaluation_submission_requirements_task.py,sha256=rFCI6bTl64kRiUkEwbh6Ef1LV-YqrgJhGkHaaqE_Pp8,6647
22
22
  bioguider/agents/evaluation_task.py,sha256=4VZ7l8oqcUsgJ2YY6s6mkcJu25DgA1qLXv2kVUm2SgI,12654
23
23
  bioguider/agents/identification_execute_step.py,sha256=w3IjL8f2WiHCyiLjVSoySnIAXpi1-hK1DLKCnXbAN2Y,5587
24
- bioguider/agents/identification_observe_step.py,sha256=U-iWDR1AZIUpthEswtMbMkPK4YAbAv2SrvBJAqdKyZo,3988
24
+ bioguider/agents/identification_observe_step.py,sha256=EKVXbAvBhvJWiTr5bhW5G2NDVVjUKIpQavU3OXiYRDw,4339
25
25
  bioguider/agents/identification_plan_step.py,sha256=owsTK1NZIuiZL7QPVknJyp9TBRK-mhnuf2RwK4YzaxU,5442
26
- bioguider/agents/identification_task.py,sha256=hVhgExCv1OPMgOYOGRRJyR3-uiG-VR-OgrvWT6vLn9M,10031
27
- bioguider/agents/identification_task_utils.py,sha256=nWRK3kCyiglw7576idiDGXEzUBBInkz_w9OsK6OJv2E,599
26
+ bioguider/agents/identification_task.py,sha256=bTbovxxQVpO1TcdcQAxDxwPISuAcXndO7zsvHpJSb64,10147
27
+ bioguider/agents/identification_task_utils.py,sha256=Lf0Rj0L0KSiyJmPAgeSz0vLUFQr6TSFuzgufimEN4H0,630
28
28
  bioguider/agents/peo_common_step.py,sha256=iw2c1h7X11WJzSE2tSRg0UAoXH0QOlQDxW9CCzSVMOY,2677
29
- bioguider/agents/prompt_utils.py,sha256=M-KUqGPhtOyFlDN1yNNZdOxTOPFjACF5VhBFW7gXgSc,17151
29
+ bioguider/agents/prompt_utils.py,sha256=YosNUT0UniV9IYJB4S-4Or9VFaSI751wB1LPvPeYfgg,17373
30
30
  bioguider/agents/python_ast_repl_tool.py,sha256=o7-4P1h8jS8ikhGSA4CI_OWQ2a0Eg5tEdmuAp_qrO-0,2519
31
31
  bioguider/agents/rag_collection_task.py,sha256=r_jPAMjQcC7dIydKxX77UuMqjJ3MiVKswNZ-yNw7yx8,5199
32
32
  bioguider/conversation.py,sha256=DIvk_d7pz_guuORByK1eaaF09FAK-8shcNTrbSUHz9Y,1779
33
- bioguider/database/summarized_file_db.py,sha256=tDSi2iCvm2-lrx0rBJo0C11gYl9FswsDZTG2-Yhu5cE,4646
33
+ bioguider/database/summarized_file_db.py,sha256=gGubM5vH3SN_1vouKO0LemvE_EfyjinAScRhlvxJsi0,4654
34
34
  bioguider/managers/evaluation_manager.py,sha256=O8mxrAGllDIkcQVsrRrqxH0eyJHwtoSauWrPe_F7qqU,4778
35
35
  bioguider/rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  bioguider/rag/config.py,sha256=5g4IqTzgyfZfax9Af9CTkXShgItPOt4_9TEMSekCPik,4602
@@ -38,13 +38,13 @@ bioguider/rag/data_pipeline.py,sha256=bkJ2IUCgPx_OL2uZtPd6cIBor2VFZEIfGd5kVlmiPj
38
38
  bioguider/rag/embedder.py,sha256=jofR8hOj3Aj2IyBQ9y6FeAc84tgq5agbIfCGyFxYpJ8,650
39
39
  bioguider/rag/rag.py,sha256=JFPwrJlKDSyd3U3Gce_NSxI5343eNUbqPG9Fs5Pfoq0,4696
40
40
  bioguider/settings.py,sha256=BD_iz9aYarxmWUl0XaKl4-D4oTXMhFzljsXLNn2phis,3143
41
- bioguider/utils/constants.py,sha256=4PbzF-s49M0nNtGsLjxQ9-APaJqNAjCQrE0wunSvPqw,982
41
+ bioguider/utils/constants.py,sha256=0JXGA7aPO8W97MlwD7P5TUMONSpmcmiXT47QUvshhMA,1000
42
42
  bioguider/utils/default.gitignore,sha256=XjPdyO2KV8z8iyuqluaNR_70tBQftMpyKL8HboVNyeI,1605
43
43
  bioguider/utils/file_utils.py,sha256=9VfAHsz1UkFPtzAmvWZvPl1TMaKIYNjNlLgsfB8tNjg,3683
44
44
  bioguider/utils/gitignore_checker.py,sha256=pOYUwsS9D5014LxcZb0cj3s2CAYaD2uF_pYJpaNKcho,6532
45
45
  bioguider/utils/pyphen_utils.py,sha256=cdZc3qphkvMDeL5NiZ8Xou13M_uVNP7ifJ-FwxO-0BE,2680
46
46
  bioguider/utils/utils.py,sha256=YP3HXgU_rvYDWkEcTzWGiYZw-mlfVrqGhUGSc0_4Pms,900
47
- bioguider-0.2.13.dist-info/LICENSE,sha256=qzkvZcKwwA5DuSuhXMOm2LcO6BdEr4V7jwFZVL2-jL4,1065
48
- bioguider-0.2.13.dist-info/METADATA,sha256=HpVwAdlrLxjQ5JVIm-prHV33vHyxPHi3IID4x8l-l_c,1868
49
- bioguider-0.2.13.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
50
- bioguider-0.2.13.dist-info/RECORD,,
47
+ bioguider-0.2.15.dist-info/LICENSE,sha256=qzkvZcKwwA5DuSuhXMOm2LcO6BdEr4V7jwFZVL2-jL4,1065
48
+ bioguider-0.2.15.dist-info/METADATA,sha256=6VGnGqkL6Dy1EGLp2iWTnfDFRR5rYH-xVY4VzkMSBQw,1868
49
+ bioguider-0.2.15.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
50
+ bioguider-0.2.15.dist-info/RECORD,,