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

@@ -154,7 +154,7 @@ class CommonAgentTwoChainSteps(CommonAgentTwoSteps):
154
154
  def _invoke_agent(self, system_prompt, instruction_prompt, schema, post_process = None, **kwargs):
155
155
  # Initialize the callback handler
156
156
  callback_handler = OpenAICallbackHandler()
157
- processed_system_prompt = system_prompt.replace("{", "(").replace("}", ")")
157
+ processed_system_prompt = system_prompt.replace("{", "{{").replace("}", "}}")
158
158
  cot_prompt = self._build_prompt_for_cot_step(
159
159
  system_prompt=processed_system_prompt,
160
160
  instruction_prompt=instruction_prompt
@@ -200,7 +200,7 @@ class EvaluationTask(ABC):
200
200
 
201
201
  class EvaluationREADMEResult(BaseModel):
202
202
  project_level: Optional[bool]=Field(description="A boolean value specifying if the README file is **project-level** README. TRUE: project-level, FALSE, folder-level")
203
- score: Optional[float]=Field(description="An overall score")
203
+ score: Optional[str]=Field(description="An overall score")
204
204
  key_strengths: Optional[str]=Field(description="A string specifying the key strengths of README file.")
205
205
  overall_improvement_suggestions: Optional[list[str]]=Field(description="A list of overall improvement suggestions")
206
206
 
@@ -214,7 +214,7 @@ EvaluationREADMEResultSchema = {
214
214
  "title": "Project Level"
215
215
  },
216
216
  "score": {
217
- "anyOf": [{"type": "number"}, {"type": "null"}],
217
+ "anyOf": [{"type": "string"}, {"type": "null"}],
218
218
  "description": "An overall score",
219
219
  "title": "Score"
220
220
  },
@@ -260,7 +260,7 @@ class EvaluationREADMETask(EvaluationTask):
260
260
  readme_evaluations[readme_file] = {
261
261
  "evaluation": {
262
262
  "project_level": "/" in readme_file,
263
- "score": 0,
263
+ "score": "Poor",
264
264
  "key_strengths": f"{readme_file} is an empty file.",
265
265
  "overall_improvement_suggestions": f"{readme_file} is an empty file.",
266
266
  },
@@ -25,7 +25,8 @@ Carefully review the **Goal**, **Repository File Structure**, and **Intermediate
25
25
  - Then provide your result under **FinalAnswer**
26
26
  ```
27
27
  **Analysis**: your analysis here
28
- **FinalAnswer**: your final answer here, in json format **without** json fence (```json ... ```), like {final_answer_example}
28
+ **FinalAnswer**: your final answer here, in **raw json format**, **including** the surrounding "{{}}" but **without** using code fence (```json ... ```),
29
+ For example, output exactly: {final_answer_example}
29
30
  ```
30
31
  - If the information is **not sufficient** to achieve the goal, simply explain why under **Thoughts**:
31
32
  ```
@@ -25,8 +25,8 @@ class EvaluationManager:
25
25
  self.repo_url = repo_url
26
26
  self.rag = RAG()
27
27
  self.rag.initialize_db_manager()
28
- self.rag.prepare_retriever(repo_url_or_path=repo_url)
29
-
28
+ self.rag.initialize_repo(repo_url_or_path=repo_url)
29
+
30
30
  author, repo_name = parse_repo_url(repo_url)
31
31
  self.summary_file_db = SummarizedFilesDb(author, repo_name)
32
32
 
@@ -504,7 +504,11 @@ class DatabaseManager:
504
504
  self.repo_url_or_path = None
505
505
  self.repo_paths = None
506
506
 
507
- def prepare_database(self, repo_url_or_path: str, access_token: str = None) -> Tuple[List[Document], List[Document]]:
507
+ def reset_database_and_create_repo(self, repo_url_or_path: str, access_token: str = None):
508
+ self._reset_database()
509
+ self._create_repo(repo_url_or_path, access_token)
510
+
511
+ def prepare_database(self) -> Tuple[List[Document], List[Document]]:
508
512
  """
509
513
  Create a new database from the repository.
510
514
 
@@ -515,9 +519,7 @@ class DatabaseManager:
515
519
  Returns:
516
520
  Tuple[List[Document], List[Document]]: Tuple of two Lists of Document objects
517
521
  """
518
- self.reset_database()
519
- self._create_repo(repo_url_or_path, access_token)
520
- return self.prepare_db_index()
522
+ return self._prepare_db_index()
521
523
 
522
524
  def _extract_repo_name_from_url(self, repo_url_or_path: str, repo_type: str) -> str:
523
525
  # Extract owner and repo name to create unique identifier
@@ -534,7 +536,7 @@ class DatabaseManager:
534
536
  repo_name = url_parts[-1].replace(".git", "")
535
537
  return repo_name
536
538
 
537
- def reset_database(self):
539
+ def _reset_database(self):
538
540
  """
539
541
  Reset the database to its initial state.
540
542
  """
@@ -608,7 +610,7 @@ class DatabaseManager:
608
610
  return self.repo_paths["save_repo_dir"]
609
611
  return None
610
612
 
611
- def prepare_db_index(self) -> Tuple[List[Document], List[Document]]:
613
+ def _prepare_db_index(self) -> Tuple[List[Document], List[Document]]:
612
614
  """
613
615
  Prepare the indexed database for the repository.
614
616
  :return: Tuple of two Lists of Document objects
@@ -647,16 +649,3 @@ class DatabaseManager:
647
649
  logger.info(f"Total transformed code documents: {len(transformed_code_documents)}")
648
650
  return transformed_doc_documents, transformed_code_documents
649
651
 
650
- def prepare_retriever(self, repo_url_or_path: str, access_token: str = None):
651
- """
652
- Prepare the retriever for a repository.
653
- This is a compatibility method for the isolated API.
654
-
655
- Args:
656
- repo_url_or_path (str): The URL or local path of the repository
657
- access_token (str, optional): Access token for private repositories
658
-
659
- Returns:
660
- List[Document]: List of Document objects
661
- """
662
- return self.prepare_database(repo_url_or_path, access_token)
bioguider/rag/rag.py CHANGED
@@ -50,22 +50,25 @@ class RAG(adal.Component):
50
50
  def initialize_db_manager(self):
51
51
  """Initialize the database manager with local storage"""
52
52
  self.db_manager = DatabaseManager()
53
- self.transformed_doc_documents = []
54
- self.transformed_code_documents = []
53
+ self.transformed_doc_documents: list | None = None
54
+ self.transformed_code_documents: list | None = None
55
+ self.access_token: str | None = None
55
56
 
56
- def prepare_retriever(self, repo_url_or_path: str, access_token: str = None):
57
+ def initialize_repo(self, repo_url_or_path: str, access_token: str = None):
58
+ self.repo_url_or_path = repo_url_or_path
59
+ self.access_token = access_token
60
+ self.db_manager.reset_database_and_create_repo(repo_url_or_path, access_token)
61
+
62
+ def _prepare_retriever(self):
57
63
  """
58
64
  Prepare the retriever for a repository.
59
65
  Will load database from local storage if available.
60
-
61
- Args:
62
- repo_url_or_path: URL or local path to the repository
63
- access_token: Optional access token for private repositories
64
66
  """
65
- self.initialize_db_manager()
66
- self.repo_url_or_path = repo_url_or_path
67
+ if self.transformed_code_documents is not None and self.transformed_doc_documents is not None:
68
+ # retrievers have been prepared
69
+ return
67
70
  self.transformed_doc_documents, self.transformed_code_documents \
68
- = self.db_manager.prepare_database(repo_url_or_path, access_token)
71
+ = self.db_manager.prepare_database()
69
72
  logger.info(f"Loaded {len(self.transformed_doc_documents)} doc documents for retrieval")
70
73
  logger.info(f"Loaded {len(self.transformed_code_documents)} code documents for retrieval")
71
74
  self.doc_retriever = FAISSRetriever(
@@ -93,6 +96,7 @@ class RAG(adal.Component):
93
96
  Returns:
94
97
  retrieved_documents: List of documents retrieved based on the query
95
98
  """
99
+ self._prepare_retriever()
96
100
  retrieved_documents = self.doc_retriever(query)
97
101
  # Fill in the documents
98
102
  retrieved_documents[0].documents = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bioguider
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: An AI-Powered package to help biomedical developers to generate clear documentation
5
5
  License: MIT
6
6
  Author: Cankun Wang
@@ -9,7 +9,7 @@ bioguider/agents/collection_plan_step.py,sha256=mx-_5Y3pqKDPBaMMyFElKlpq1GWN7g03
9
9
  bioguider/agents/collection_task.py,sha256=blrsS71aR-Du0vtO4MpFI6q0aUJdMvlAAYvHb1pBUfY,7368
10
10
  bioguider/agents/collection_task_utils.py,sha256=WRzzpMV6r8aY0FlX_zroHbLDXyrmvS48OSiBr_fIq2Q,3677
11
11
  bioguider/agents/common_agent.py,sha256=eGs8m8bjO0dmW6lDIen7DQNdWdHD7j8Udf3XhL1k6vI,5242
12
- bioguider/agents/common_agent_2step.py,sha256=IJ5SxqsK26oj8W3U4wnGtbJxHRrHEznaGCYFBXKUHn4,7916
12
+ bioguider/agents/common_agent_2step.py,sha256=Vton0RKtmMyEgIIFhnBk4CFU_hynX0LvwREcZ9kvMxQ,7918
13
13
  bioguider/agents/common_step.py,sha256=GdOCbmj1pwh4etg-futVFYVDQuoUG89DnIrw-B6QbzM,2594
14
14
  bioguider/agents/dockergeneration_execute_step.py,sha256=F92jDlkc6KjAvTkX7q1FsCYP8J15SCaNgmwh3YPqfDo,6500
15
15
  bioguider/agents/dockergeneration_observe_step.py,sha256=93PO_Y4YyUShVTKRt0nErcjb-xYTcwcZCj7TgniS9t4,6098
@@ -17,9 +17,9 @@ bioguider/agents/dockergeneration_plan_step.py,sha256=SB8tQM9PkIKsD2o1DFD7bedcxz
17
17
  bioguider/agents/dockergeneration_task.py,sha256=ezsweVHJsFpOyOI6rYMt1DZ3PE19dcq4J3Lm-d0IA8M,6220
18
18
  bioguider/agents/dockergeneration_task_utils.py,sha256=v7emqrJlVW-A5ZdLmPSdiaMSKCR8uzy9UYzx_1cgzyo,9041
19
19
  bioguider/agents/evaluation_installation_task.py,sha256=G8oFpyiT99bGyHGgqE6eCW6_i5le64i3Hd7hSQkrndE,6498
20
- bioguider/agents/evaluation_task.py,sha256=0kwUkKixljs15VpasMCUdDjQH-xJwXzHV4GyNkGrmPc,17364
20
+ bioguider/agents/evaluation_task.py,sha256=vZxjtj20BSGO5VP4-JdmiJRbg8pEzz664mjFTJioaZQ,17367
21
21
  bioguider/agents/identification_execute_step.py,sha256=w3IjL8f2WiHCyiLjVSoySnIAXpi1-hK1DLKCnXbAN2Y,5587
22
- bioguider/agents/identification_observe_step.py,sha256=OENwf9XyOSIHvJMp7eoyQOYGjjtPnPT2S29xf1rCATk,3667
22
+ bioguider/agents/identification_observe_step.py,sha256=j4Fniv86jljkClTFc-p3pA39_zxhGJLPS9K7jNpxhJ0,3750
23
23
  bioguider/agents/identification_plan_step.py,sha256=p0BKziXdB4ph4D_T9FU5bH8CbHD5Gv0YuszMds_xh-Y,5224
24
24
  bioguider/agents/identification_task.py,sha256=vQxNEkX1Sw-XK391Z2_bi3kjr0tcIU1u6y7JBaEXUFU,8790
25
25
  bioguider/agents/identification_task_utils.py,sha256=5gevknha9hJiiQN5L7Yp9-pyhAlbR_j31aGRK5j0D_w,522
@@ -29,12 +29,12 @@ bioguider/agents/python_ast_repl_tool.py,sha256=o7-4P1h8jS8ikhGSA4CI_OWQ2a0Eg5tE
29
29
  bioguider/agents/rag_collection_task.py,sha256=r_jPAMjQcC7dIydKxX77UuMqjJ3MiVKswNZ-yNw7yx8,5199
30
30
  bioguider/conversation.py,sha256=DIvk_d7pz_guuORByK1eaaF09FAK-8shcNTrbSUHz9Y,1779
31
31
  bioguider/database/summarized_file_db.py,sha256=tDSi2iCvm2-lrx0rBJo0C11gYl9FswsDZTG2-Yhu5cE,4646
32
- bioguider/managers/evaluation_manager.py,sha256=93XOE2Q2a-mRa8DMF3IZC7mhE2CxxqOZZ5MLbWlPsjo,4904
32
+ bioguider/managers/evaluation_manager.py,sha256=oQVcrJXR_ushU4IBT4yR0o6rXFHftfkJywrteGrkISY,4910
33
33
  bioguider/rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  bioguider/rag/config.py,sha256=5g4IqTzgyfZfax9Af9CTkXShgItPOt4_9TEMSekCPik,4602
35
- bioguider/rag/data_pipeline.py,sha256=OXnsqETVytHBMXHerg9gACtNhwpWSODYWvzxVDTP_So,27767
35
+ bioguider/rag/data_pipeline.py,sha256=bkJ2IUCgPx_OL2uZtPd6cIBor2VFZEIfGd5kVlmiPjw,27292
36
36
  bioguider/rag/embedder.py,sha256=jofR8hOj3Aj2IyBQ9y6FeAc84tgq5agbIfCGyFxYpJ8,650
37
- bioguider/rag/rag.py,sha256=2G2b7JIDsjrR74lnkIFyEuMPF14kn6B-WhphZkUxd3c,4481
37
+ bioguider/rag/rag.py,sha256=JFPwrJlKDSyd3U3Gce_NSxI5343eNUbqPG9Fs5Pfoq0,4696
38
38
  bioguider/settings.py,sha256=BD_iz9aYarxmWUl0XaKl4-D4oTXMhFzljsXLNn2phis,3143
39
39
  bioguider/utils/constants.py,sha256=_xMAhwE3py2RR0pIimnb2qfucXdnTj4ZNeKGACouh2w,932
40
40
  bioguider/utils/default.gitignore,sha256=XjPdyO2KV8z8iyuqluaNR_70tBQftMpyKL8HboVNyeI,1605
@@ -42,7 +42,7 @@ bioguider/utils/file_utils.py,sha256=9VfAHsz1UkFPtzAmvWZvPl1TMaKIYNjNlLgsfB8tNjg
42
42
  bioguider/utils/gitignore_checker.py,sha256=pOYUwsS9D5014LxcZb0cj3s2CAYaD2uF_pYJpaNKcho,6532
43
43
  bioguider/utils/pyphen_utils.py,sha256=cdZc3qphkvMDeL5NiZ8Xou13M_uVNP7ifJ-FwxO-0BE,2680
44
44
  bioguider/utils/utils.py,sha256=YP3HXgU_rvYDWkEcTzWGiYZw-mlfVrqGhUGSc0_4Pms,900
45
- bioguider-0.2.9.dist-info/LICENSE,sha256=qzkvZcKwwA5DuSuhXMOm2LcO6BdEr4V7jwFZVL2-jL4,1065
46
- bioguider-0.2.9.dist-info/METADATA,sha256=kctbCb5iK21lTibqx01l7hnLYUz10Be66afv61LwuJA,1867
47
- bioguider-0.2.9.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
48
- bioguider-0.2.9.dist-info/RECORD,,
45
+ bioguider-0.2.10.dist-info/LICENSE,sha256=qzkvZcKwwA5DuSuhXMOm2LcO6BdEr4V7jwFZVL2-jL4,1065
46
+ bioguider-0.2.10.dist-info/METADATA,sha256=OGjtW0XGNonKac0PuNjF4o_iNDuLk07t_4_0EVgfMtc,1868
47
+ bioguider-0.2.10.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
48
+ bioguider-0.2.10.dist-info/RECORD,,