Skip to content

Commit

Permalink
merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
MingruiZhang committed Aug 26, 2024
2 parents 8b344aa + 5811595 commit 8cf97fa
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "vision-agent"
version = "0.2.109"
version = "0.2.110"
description = "Toolset for Vision Agent"
authors = ["Landing AI <[email protected]>"]
readme = "README.md"
Expand Down
5 changes: 0 additions & 5 deletions vision_agent/agent/vision_agent_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def write_plans(
tool_desc=tool_desc,
feedback=working_memory,
)
print(prompt)
chat[-1]["content"] = prompt
return extract_json(model(chat, stream=False)) # type: ignore

Expand Down Expand Up @@ -615,8 +614,6 @@ def __init__(
also None, the local python runtime environment will be used.
"""

print("testing1")

self.planner = (
OpenAILMM(temperature=0.0, json_mode=True) if planner is None else planner
)
Expand Down Expand Up @@ -692,8 +689,6 @@ def chat_with_workflow(
and working memory of the agent.
"""

print("chat with workflow - start")

if not chat:
raise ValueError("Chat cannot be empty.")

Expand Down
6 changes: 4 additions & 2 deletions vision_agent/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
TOOL_DOCSTRING,
TOOLS,
TOOLS_DF,
TOOLS_INFO,
UTIL_TOOLS,
UTILITIES_DOCSTRING,
blip_image_caption,
Expand Down Expand Up @@ -55,15 +56,16 @@ def register_tool(imports: Optional[List] = None) -> Callable:
def decorator(tool: Callable) -> Callable:
import inspect

from .tools import get_tool_descriptions, get_tools_df
from .tools import get_tool_descriptions, get_tools_df, get_tools_info

global TOOLS, TOOLS_DF, TOOL_DESCRIPTIONS, TOOL_DOCSTRING
global TOOLS, TOOLS_DF, TOOL_DESCRIPTIONS, TOOL_DOCSTRING, TOOLS_INFO

if tool not in TOOLS:
TOOLS.append(tool)
TOOLS_DF = get_tools_df(TOOLS) # type: ignore
TOOL_DESCRIPTIONS = get_tool_descriptions(TOOLS) # type: ignore
TOOL_DOCSTRING = get_tool_documentation(TOOLS) # type: ignore
TOOLS_INFO = get_tools_info(TOOLS) # type: ignore

globals()[tool.__name__] = tool
if imports is not None:
Expand Down
13 changes: 13 additions & 0 deletions vision_agent/tools/tool_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,16 @@ def get_tools_df(funcs: List[Callable[..., Any]]) -> pd.DataFrame:
data["doc"].append(doc)

return pd.DataFrame(data) # type: ignore


def get_tools_info(funcs: List[Callable[..., Any]]) -> Dict[str, str]:
data: Dict[str, str] = {}

for func in funcs:
desc = func.__doc__
if desc is None:
desc = ""

data[func.__name__] = f"{func.__name__}{inspect.signature(func)}:\n{desc}"

return data
5 changes: 5 additions & 0 deletions vision_agent/tools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
get_tool_descriptions_by_names,
get_tool_documentation,
get_tools_df,
<<<<<<< HEAD
send_inference_request,
=======
get_tools_info,
>>>>>>> 58115951f8a050c9f9f7be2012efe97ec00498ed
)
from vision_agent.utils import extract_frames_from_video
from vision_agent.utils.execute import FileSerializer, MimeType
Expand Down Expand Up @@ -1324,6 +1328,7 @@ def overlay_heat_map(
TOOLS_DF = get_tools_df(TOOLS) # type: ignore
TOOL_DESCRIPTIONS = get_tool_descriptions(TOOLS) # type: ignore
TOOL_DOCSTRING = get_tool_documentation(TOOLS) # type: ignore
TOOLS_INFO = get_tools_info(TOOLS) # type: ignore
UTILITIES_DOCSTRING = get_tool_documentation(
[
save_json,
Expand Down

0 comments on commit 8cf97fa

Please sign in to comment.