Skip to content

Commit

Permalink
bump version with increased context
Browse files Browse the repository at this point in the history
  • Loading branch information
vysakh0 committed Jul 17, 2024
1 parent 296fad1 commit 1e4255d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "MIT"
Expand Down
3 changes: 2 additions & 1 deletion src/drd/api/claude_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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'
}

Expand Down
40 changes: 19 additions & 21 deletions src/drd/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/drd/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 1e4255d

Please sign in to comment.