Skip to content

Commit

Permalink
Fixes, prompt improvement, version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
ParthSareen committed Nov 13, 2024
1 parent 78d757a commit d811cc2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# rubber ducky
<p align="center">
<img src="ducky_img.webp" alt="Ducky Image" width="200" height="200">
</p>

## tl;dr
- `pip install rubber-ducky`
Expand Down
13 changes: 9 additions & 4 deletions ducky/ducky.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ async def call_llama(self, code: str = "", prompt: Optional[str] = None, chain:
while True:
# Include previous responses in the prompt for context
context_prompt = "\n".join(responses) + "\n" + prompt
response = await self.client.generate(model=self.model, prompt=context_prompt)
print(response['response'])
responses.append(response['response'])
stream = await self.client.generate(model=self.model, prompt=context_prompt, stream=True)
response_text = ""
async for chunk in stream:
if 'response' in chunk:
print(chunk['response'], end='', flush=True)
response_text += chunk['response']
print() # New line after response completes
responses.append(response_text)
if not chain:
break
prompt = input("\nAny questions? \n")
Expand Down Expand Up @@ -67,7 +72,7 @@ async def ducky() -> None:

# Handle direct question from CLI
if args.question is not None:
question = " ".join(args.question)
question = " ".join(args.question) + " be as concise as possible"
await rubber_ducky.call_llama(prompt=question, chain=args.chain)
return

Expand Down
Binary file added ducky_img.webp
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='rubber-ducky',
version='1.1.2',
version='1.1.3',
description='AI Companion for Pair Programming',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit d811cc2

Please sign in to comment.