From 1e4255d860b021c14c97a4a0121907ac777da65c Mon Sep 17 00:00:00 2001 From: Vysakh Sreenivasan Date: Thu, 18 Jul 2024 01:09:24 +0530 Subject: [PATCH] bump version with increased context --- pyproject.toml | 2 +- src/drd/api/claude_api.py | 3 ++- src/drd/api/main.py | 40 +++++++++++++++++++-------------------- src/drd/cli/commands.py | 2 +- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c73f95c..fcdd2a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dravid" -version = "0.10.0" +version = "0.11.0" description = "A CLI coding super-framework using AI" authors = ["Vysakh Sreenivasan "] license = "MIT" diff --git a/src/drd/api/claude_api.py b/src/drd/api/claude_api.py index b932ab8..3f358a1 100644 --- a/src/drd/api/claude_api.py +++ b/src/drd/api/claude_api.py @@ -11,7 +11,7 @@ API_URL = 'https://api.anthropic.com/v1/messages' MODEL = 'claude-3-5-sonnet-20240620' -MAX_TOKENS = 4000 +MAX_TOKENS = 8000 def get_api_key() -> str: @@ -25,6 +25,7 @@ def get_headers(api_key: str) -> Dict[str, str]: return { 'x-api-key': api_key, 'Content-Type': 'application/json', + "Anthropic-Beta": "max-tokens-3-5-sonnet-2024-07-15", 'Anthropic-Version': '2023-06-01' } diff --git a/src/drd/api/main.py b/src/drd/api/main.py index 141aa11..c42e12e 100644 --- a/src/drd/api/main.py +++ b/src/drd/api/main.py @@ -8,30 +8,28 @@ def stream_dravid_api(query, include_context=False, instruction_prompt=None, print_chunk=False): - xml_buffer = "" - loader = Loader("Gathering responses from Claude API...") - loader.start() - state = { - 'buffer': '', - 'in_step': False, - } if print_chunk: - loader.stop() - print_info("CLAUDE: ") - try: + print_info("DRAVID: ") for chunk in stream_claude_response(query, instruction_prompt): - if print_chunk: - click.echo(chunk, nl=False) - else: - pretty_print_xml_stream(chunk, state) - xml_buffer += chunk - finally: - loader.stop() - - if not print_chunk: - return xml_buffer - else: + click.echo(chunk, nl=False) return None + else: + xml_buffer = "" + loader = Loader("Gathering responses from Claude API...") + state = { + 'buffer': '', + 'in_step': False, + } + try: + for chunk in stream_claude_response(query, instruction_prompt): + if print_chunk: + click.echo(chunk, nl=False) + else: + pretty_print_xml_stream(chunk, state) + xml_buffer += chunk + finally: + loader.stop() + return xml_buffer def call_dravid_api(query, include_context=False, instruction_prompt=None): diff --git a/src/drd/cli/commands.py b/src/drd/cli/commands.py index 11b2ff2..9272e5f 100644 --- a/src/drd/cli/commands.py +++ b/src/drd/cli/commands.py @@ -11,7 +11,7 @@ from ..utils.utils import print_error from .ask_handler import handle_ask_command -VERSION = "0.10.0" # Update this as you release new versions +VERSION = "0.11.0" # Update this as you release new versions def handle_query_command(query, image, debug):