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

@@ -1,9 +1,11 @@
1
1
  import os
2
2
  from typing import Callable
3
+ from markdownify import markdownify as md
3
4
  from langchain_openai.chat_models.base import BaseChatOpenAI
4
5
  from bioguider.database.summarized_file_db import SummarizedFilesDb
5
6
  from bioguider.utils.file_utils import get_file_type
6
7
  from bioguider.agents.agent_utils import read_directory, read_file, summarize_file
8
+ from bioguider.rag.data_pipeline import count_tokens
7
9
 
8
10
  class agent_tool:
9
11
  def __init__(
@@ -39,7 +41,14 @@ Returns:
39
41
  file_path = os.path.join(self.repo_path, file_path)
40
42
  if not os.path.isfile(file_path):
41
43
  return None
42
- return read_file(file_path)
44
+ content = read_file(file_path)
45
+ if file_path.endswith(".html") or file_path.endswith(".htm"):
46
+ content = md(content, escape_underscores=False)
47
+ tokens = count_tokens(content)
48
+ MAX_TOKENS = os.environ.get('OPENAI_MAX_INPUT_TOKENS', 102400)
49
+ if tokens > int(MAX_TOKENS):
50
+ content = content[:100000]
51
+ return content
43
52
 
44
53
  class summarize_file_tool(agent_tool):
45
54
  """ read and summarize the file
@@ -6,9 +6,11 @@ from abc import ABC, abstractmethod
6
6
  from langchain.prompts import ChatPromptTemplate
7
7
  from langchain_openai.chat_models.base import BaseChatOpenAI
8
8
  from pydantic import BaseModel, Field
9
+ from markdownify import markdownify as md
9
10
 
10
11
  from bioguider.agents.agent_utils import read_file
11
12
  from bioguider.utils.constants import DEFAULT_TOKEN_USAGE, ProjectMetadata
13
+ from bioguider.rag.data_pipeline import count_tokens
12
14
  from .common_agent_2step import CommonAgentTwoSteps, CommonAgentTwoChainSteps
13
15
  from .common_agent import CommonConversation
14
16
  from ..utils.pyphen_utils import PyphenReadability
@@ -122,8 +124,15 @@ class EvaluationInstallationTask(EvaluationTask):
122
124
  return None
123
125
 
124
126
  files_content = ""
127
+ MAX_TOKENS = os.environ.get("OPENAI_MAX_INPUT_TOKENS", 102400)
125
128
  for f in files:
126
- content = read_file(os.path.join(self.repo_path, f))
129
+ if f.endswith(".html") or f.endswith(".htm"):
130
+ html = read_file(os.path.join(self.repo_path, f))
131
+ content = md(html, escape_underscores=False)
132
+ else:
133
+ content = read_file(os.path.join(self.repo_path, f))
134
+ if count_tokens(content) > int(MAX_TOKENS):
135
+ content = content[:100000]
127
136
  files_content += f"""
128
137
  {f} content:
129
138
  {content}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bioguider
3
- Version: 0.2.6
3
+ Version: 0.2.7
4
4
  Summary: An AI-Powered package to help biomedical developers to generate clear documentation
5
5
  License: MIT
6
6
  Author: Cankun Wang
@@ -28,6 +28,7 @@ Requires-Dist: langchain-experimental (>=0.3.4,<0.4.0)
28
28
  Requires-Dist: langchain-google-genai (>=2.1.4,<3.0.0)
29
29
  Requires-Dist: langchain-openai (>=0.3.8,<0.4.0)
30
30
  Requires-Dist: langgraph (>=0.3.11,<0.4.0)
31
+ Requires-Dist: markdownify (>=1.1.0,<2.0.0)
31
32
  Requires-Dist: nanoid (>=2.0.0,<3.0.0)
32
33
  Requires-Dist: pydantic (>=2.10.6,<3.0.0)
33
34
  Requires-Dist: pydantic-settings (>=2.8.1,<3.0.0)
@@ -1,7 +1,7 @@
1
1
  bioguider/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  bioguider/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  bioguider/agents/agent_task.py,sha256=SX4iLdGqQttT39qvr-RtXiSpQEzm7Z3ECVw8IGQzpDc,2828
4
- bioguider/agents/agent_tools.py,sha256=Q7yciRjMwW4J6V4TGZx_smaBYiV_ZtmKkjBb1ofVgM0,5898
4
+ bioguider/agents/agent_tools.py,sha256=B3vwkly5AC5tFp31HfZ07yt18KK2eIrOVk8NJNzukKg,6335
5
5
  bioguider/agents/agent_utils.py,sha256=qngmkCiTz46PJebzWmdZLo5XWtyUDZddCQv06PDKBrw,12450
6
6
  bioguider/agents/collection_execute_step.py,sha256=6hCCP9LG5goC-EbS6Ye3wKS4vPy7p9NndMYo48Qt3RA,5515
7
7
  bioguider/agents/collection_observe_step.py,sha256=iNeV6f16Emk1LMStSR4FXBPZ6Sc0eTjwxEfmoeegV-U,4554
@@ -16,7 +16,7 @@ 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=ezsweVHJsFpOyOI6rYMt1DZ3PE19dcq4J3Lm-d0IA8M,6220
18
18
  bioguider/agents/dockergeneration_task_utils.py,sha256=v7emqrJlVW-A5ZdLmPSdiaMSKCR8uzy9UYzx_1cgzyo,9041
19
- bioguider/agents/evaluation_installation_task.py,sha256=ULxlw5VvW_w-tH7mVWbvOFjKYzjpUz2dVTCHKqzU_8w,5922
19
+ bioguider/agents/evaluation_installation_task.py,sha256=9fKV7UW3xBHmwY_Q9YVRwoj3xv_ejzbFxojQjwBGIZw,6394
20
20
  bioguider/agents/evaluation_task.py,sha256=8tjRPGsRQ9qDxVgYYDo-GhhEiwW71zSS-iyLZUPRbBA,17178
21
21
  bioguider/agents/identification_execute_step.py,sha256=_9x_KITVtNJjQlgjfq-LazoUl46Tctaj_W_AVxz5q-w,5488
22
22
  bioguider/agents/identification_observe_step.py,sha256=OENwf9XyOSIHvJMp7eoyQOYGjjtPnPT2S29xf1rCATk,3667
@@ -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.6.dist-info/LICENSE,sha256=qzkvZcKwwA5DuSuhXMOm2LcO6BdEr4V7jwFZVL2-jL4,1065
46
- bioguider-0.2.6.dist-info/METADATA,sha256=MBcrwDU4pJKKEkd1jBvtBYd0WDUrbIZjKJuwOk_TQ3Y,1823
47
- bioguider-0.2.6.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
48
- bioguider-0.2.6.dist-info/RECORD,,
45
+ bioguider-0.2.7.dist-info/LICENSE,sha256=qzkvZcKwwA5DuSuhXMOm2LcO6BdEr4V7jwFZVL2-jL4,1065
46
+ bioguider-0.2.7.dist-info/METADATA,sha256=3SOK0oKDIdeV58nePd69cpwYcxTAcB_juAN034nmjLk,1867
47
+ bioguider-0.2.7.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
48
+ bioguider-0.2.7.dist-info/RECORD,,