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

Files changed (32) hide show
  1. bioguider/agents/agent_utils.py +16 -10
  2. bioguider/agents/collection_observe_step.py +7 -2
  3. bioguider/agents/collection_task_utils.py +1 -0
  4. bioguider/agents/consistency_collection_step.py +102 -0
  5. bioguider/agents/consistency_evaluation_task.py +57 -0
  6. bioguider/agents/consistency_evaluation_task_utils.py +14 -0
  7. bioguider/agents/consistency_observe_step.py +109 -0
  8. bioguider/agents/consistency_query_step.py +74 -0
  9. bioguider/agents/evaluation_task.py +0 -110
  10. bioguider/agents/evaluation_tutorial_task.py +156 -0
  11. bioguider/agents/evaluation_tutorial_task_prompts.py +114 -0
  12. bioguider/agents/evaluation_userguide_task.py +13 -43
  13. bioguider/agents/prompt_utils.py +15 -2
  14. bioguider/database/code_structure_db.py +20 -9
  15. bioguider/database/summarized_file_db.py +6 -3
  16. bioguider/managers/evaluation_manager.py +16 -2
  17. bioguider/rag/data_pipeline.py +1 -1
  18. bioguider/utils/code_structure_builder.py +15 -8
  19. bioguider/utils/constants.py +12 -12
  20. bioguider/utils/notebook_utils.py +117 -0
  21. bioguider/utils/{file_handler.py → python_file_handler.py} +1 -1
  22. bioguider/utils/r_file_handler.py +549 -0
  23. bioguider/utils/utils.py +34 -1
  24. {bioguider-0.2.20.dist-info → bioguider-0.2.22.dist-info}/METADATA +1 -1
  25. {bioguider-0.2.20.dist-info → bioguider-0.2.22.dist-info}/RECORD +27 -23
  26. bioguider/agents/consistency_collection_execute_step.py +0 -152
  27. bioguider/agents/consistency_collection_observe_step.py +0 -128
  28. bioguider/agents/consistency_collection_plan_step.py +0 -128
  29. bioguider/agents/consistency_collection_task.py +0 -109
  30. bioguider/agents/consistency_collection_task_utils.py +0 -137
  31. {bioguider-0.2.20.dist-info → bioguider-0.2.22.dist-info}/LICENSE +0 -0
  32. {bioguider-0.2.20.dist-info → bioguider-0.2.22.dist-info}/WHEEL +0 -0
@@ -1,137 +0,0 @@
1
- import os
2
- from pathlib import Path
3
- from typing import Callable, Optional, TypedDict
4
- from langchain_core.prompts import ChatPromptTemplate
5
- from langchain_openai.chat_models.base import BaseChatOpenAI
6
- from langchain_core.messages import AIMessage
7
- from pydantic import BaseModel, Field
8
- import logging
9
-
10
- from bioguider.agents.agent_tools import agent_tool
11
- from bioguider.database.code_structure_db import CodeStructureDb
12
-
13
- logger = logging.getLogger(__name__)
14
-
15
- class ConsistencyCollectionWorkflowState(TypedDict):
16
- user_guide_api_documentation: str
17
- step_output_callback: Optional[Callable]
18
- intermediate_steps: Optional[str]
19
- step_output: Optional[str]
20
- step_analysis: Optional[str]
21
- step_thoughts: Optional[str]
22
- plan_actions: Optional[list[dict]]
23
-
24
- final_answer: Optional[str]
25
- final_assembly_result: Optional[str]
26
- step_count: Optional[int]
27
-
28
- class retrieve_method_definition_and_docstring_tool:
29
- """ Retrieve the method definition and docstring.
30
- If the method is a method of a class, you **must** put the class name as the parent name and better to put the file path as the file path of the class.
31
- Args:
32
- method_name str: the name of the method
33
- class_name str: the name of the class that the method is in.
34
- file_path str: the path of the file that the method is in. If not sure, just put "N/A"
35
- Returns:
36
- str: the method definition and docstring
37
- """
38
- def __init__(self, llm: BaseChatOpenAI, code_structure_db: CodeStructureDb):
39
- self.llm = llm
40
- self.code_structure_db = code_structure_db
41
-
42
- def run(self, method_name: str, class_name: str, file_path: str) -> str:
43
- if file_path != "N/A":
44
- row = self.code_structure_db.select_by_name_and_parent_and_path(method_name, class_name, file_path)
45
- if row is None:
46
- return "Can't retrieve method definition and docstring"
47
- return f"Method: {row['name']}\nDocstring: {row['doc_string']}\nParams: {row['params']}"
48
- else:
49
- rows = self.code_structure_db.select_by_name_and_parent(method_name, class_name)
50
- if rows is None or len(rows) == 0:
51
- return "Can't retrieve method definition and docstring"
52
- return f"Method: {rows[0]['name']}\nDocstring: {rows[0]['doc_string']}\nParams: {rows[0]['params']}"
53
-
54
- class retrieve_function_definition_and_docstring_tool:
55
- """ Retrieve the function definition and docstring
56
- Args:
57
- function_name str: the name of the function
58
- file_path str: the path of the file that the function is in. If not sure, just put "N/A"
59
- Returns:
60
- str: the function definition and docstring
61
- """
62
- def __init__(
63
- self,
64
- llm: BaseChatOpenAI,
65
- code_structure_db: CodeStructureDb,
66
- ):
67
- self.llm = llm
68
- self.code_structure_db = code_structure_db
69
-
70
- def run(self, function_name: str, file_path: str) -> str:
71
- if file_path != "N/A":
72
- row = self.code_structure_db.select_by_name_and_path(function_name, file_path)
73
- if row is None:
74
- return f"No such function {function_name}"
75
- return f"Function: {row['name']}\nDocstring: {row['doc_string']}\nParams: {row['params']}"
76
- else:
77
- rows = self.code_structure_db.select_by_name(function_name)
78
- if rows is None or len(rows) == 0:
79
- return f"No such function {function_name}"
80
- return f"Function: {rows[0]['name']}\nDocstring: {rows[0]['doc_string']}\nParams: {rows[0]['params']}"
81
-
82
- class retrieve_class_definition_and_docstring_tool:
83
- """ Retrieve the class definition and docstring
84
- Args:
85
- class_name str: the name of the class
86
- file_path str: the path of the file that the class is in. If not sure, just put "N/A"
87
- Returns:
88
- str: the class definition and docstring
89
- """
90
- def __init__(self, llm: BaseChatOpenAI, code_structure_db: CodeStructureDb):
91
- self.llm = llm
92
- self.code_structure_db = code_structure_db
93
-
94
- def run(self, class_name: str, file_path: str) -> str:
95
- if file_path != "N/A":
96
- row = self.code_structure_db.select_by_name_and_path(class_name, file_path)
97
- if row is None:
98
- return f"No such class {class_name}"
99
- return f"Class: {row['name']}\nDocstring: {row['doc_string']}\nParams: {row['params']}"
100
- else:
101
- rows = self.code_structure_db.select_by_name(class_name)
102
- if rows is None or len(rows) == 0:
103
- return f"No such class {class_name}"
104
- return f"Class: {rows[0]['name']}\nDocstring: {rows[0]['doc_string']}\nParams: {rows[0]['params']}"
105
-
106
- class retrieve_class_and_method_definition_and_docstring_tool:
107
- """ Retrieve the class and all methods definition and docstring
108
- Args:
109
- class_name str: the name of the class
110
- file_path str: the path of the file that the class is in. If not sure, just put "N/A"
111
- Returns:
112
- str: the class and method definition and docstring
113
- """
114
- def __init__(self, llm: BaseChatOpenAI, code_structure_db: CodeStructureDb):
115
- self.llm = llm
116
- self.code_structure_db = code_structure_db
117
-
118
- def run(self, class_name: str, file_path: str) -> str:
119
- if file_path != "N/A":
120
- row = self.code_structure_db.select_by_name_and_path(class_name, file_path)
121
- if row is None:
122
- return f"No such class {class_name}"
123
- else:
124
- rows = self.code_structure_db.select_by_name(class_name)
125
- if rows is None or len(rows) == 0:
126
- return f"No such class {class_name}"
127
- row = rows[0]
128
-
129
- parent_path = file_path if file_path is not None and file_path.lower() != "n/a" else row["path"]
130
- methods = self.code_structure_db.select_by_parent(
131
- class_name,
132
- parent_path
133
- )
134
- method_definitions = []
135
- for method in methods:
136
- method_definitions.append(f"Method: {method['name']}\nDocstring: {method['doc_string']}\nParams: {method['params']}\n\n")
137
- return f"Class: {row['name']}\nDocstring: {row['doc_string']}\nParams: {row['params']}\nMethods: {method_definitions}"