From 94cb7335b82b7e314470eaa280ab4ee3aac381e0 Mon Sep 17 00:00:00 2001 From: Aman Rusia Date: Fri, 24 Jan 2025 00:40:35 +0530 Subject: [PATCH] Fix import --- src/wcgw_cli/anthropic_client.py | 28 ++++++++++++++++------------ src/wcgw_cli/cli.py | 8 ++++---- src/wcgw_cli/openai_client.py | 29 +++++++++++++++++------------ 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/wcgw_cli/anthropic_client.py b/src/wcgw_cli/anthropic_client.py index d2bb22c..2b902d8 100644 --- a/src/wcgw_cli/anthropic_client.py +++ b/src/wcgw_cli/anthropic_client.py @@ -22,7 +22,17 @@ from dotenv import load_dotenv from typer import Typer -from src.wcgw.types_ import ( +from wcgw.client.common import discard_input +from wcgw.client.memory import load_memory +from wcgw.client.tools import ( + DoneFlag, + ImageData, + default_enc, + get_tool_output, + initialize, + which_tool_name, +) +from wcgw.types_ import ( BashCommand, BashInteraction, ContextSave, @@ -36,16 +46,6 @@ ScreenShot, WriteIfEmpty, ) -from src.wcgw.client.common import discard_input -from src.wcgw.client.memory import load_memory -from src.wcgw.client.tools import ( - DoneFlag, - ImageData, - default_enc, - get_tool_output, - initialize, - which_tool_name, -) History = list[MessageParam] @@ -290,7 +290,11 @@ def loop( mode="wcgw", ) - with open(os.path.join(os.path.dirname(__file__), "..", "wcgw", "client", "diff-instructions.txt")) as f: + with open( + os.path.join( + os.path.dirname(__file__), "..", "wcgw", "client", "diff-instructions.txt" + ) + ) as f: system += f.read() if history: diff --git a/src/wcgw_cli/cli.py b/src/wcgw_cli/cli.py index e3bc705..7c18737 100644 --- a/src/wcgw_cli/cli.py +++ b/src/wcgw_cli/cli.py @@ -1,11 +1,11 @@ import importlib from typing import Optional -from typer import Typer -import typer -from src.wcgw_cli.openai_client import loop as openai_loop -from src.wcgw_cli.anthropic_client import loop as claude_loop +import typer +from typer import Typer +from wcgw_cli.anthropic_client import loop as claude_loop +from wcgw_cli.openai_client import loop as openai_loop app = Typer(pretty_exceptions_show_locals=False) diff --git a/src/wcgw_cli/openai_client.py b/src/wcgw_cli/openai_client.py index 62c2972..b756fbf 100644 --- a/src/wcgw_cli/openai_client.py +++ b/src/wcgw_cli/openai_client.py @@ -23,7 +23,17 @@ from pydantic import BaseModel from typer import Typer -from src.wcgw.types_ import ( +from wcgw.client.common import CostData, History, Models, discard_input +from wcgw.client.memory import load_memory +from wcgw.client.tools import ( + DoneFlag, + ImageData, + default_enc, + get_tool_output, + initialize, + which_tool, +) +from wcgw.types_ import ( BashCommand, BashInteraction, ContextSave, @@ -33,17 +43,8 @@ ResetShell, WriteIfEmpty, ) -from src.wcgw.client.common import CostData, History, Models, discard_input -from src.wcgw.client.memory import load_memory + from .openai_utils import get_input_cost, get_output_cost -from src.wcgw.client.tools import ( - DoneFlag, - ImageData, - default_enc, - get_tool_output, - initialize, - which_tool, -) class Config(BaseModel): @@ -235,7 +236,11 @@ def loop( mode="wcgw", ) - with open(os.path.join(os.path.dirname(__file__), "..", "wcgw", "client", "diff-instructions.txt")) as f: + with open( + os.path.join( + os.path.dirname(__file__), "..", "wcgw", "client", "diff-instructions.txt" + ) + ) as f: system += f.read() if not history: