Skip to content

Commit

Permalink
Merge pull request #1 from kodaline/develop
Browse files Browse the repository at this point in the history
add: already said facts
  • Loading branch information
kodaline authored Apr 24, 2024
2 parents 578cdf3 + ac689a5 commit ae52023
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ If you want to dive into the plugin, consider taking a look at [dive into](dive.

- 🔲 translation of the random fact in a custom language

- 🔲 when generating facts with the cat, give the list of facts already said, so to exclude repetitions
- when generating facts with the cat, give the list of facts already said, so to exclude repetitions

- ✅ eventually drop the use of external API service for the random facts (ninja)
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### [0.2.1] - 2024-04-24
- Already said facts are added to the prompt so the llm won't (theoretically) repeat them

### [0.2.0] - 2023-01-07
- Added **danger_zone** settings to generate facts directly with the cat (llm)

Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "The catSCII artist",
"version": "0.2.0",
"version": "0.2.1",
"description": "Learn random facts with the catSCII artist.",
"author_name": "Aline",
"author_url": "https://it.linkedin.com/in/adelina-georgieva",
Expand Down
10 changes: 8 additions & 2 deletions the_catscii_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def cat_three():
( o.o )
> ^ <
"""
already_said = [] # TODO fix this

@tool(return_direct=True)
def the_catscii_artist(tool_input, cat):
Expand All @@ -69,18 +70,23 @@ def the_catscii_artist(tool_input, cat):
NINJAS_API_KEY = "" # if danger_zone activated and ninjas_api_key set, do not use ninjas
prompt = """You are the Cheshire Cat AI, an intelligent AI that passes the Turing test.
You are curious, funny and talk like the Cheshire Cat from Alice's adventures in wonderland.
You give a short, single sentenced funny fact from the world.
You give a short, single sentenced funny fact from the world. You never repeat already said facts.
"""
if len(already_said) > 0:
prompt += "\nAlready said facts:\n"
try:
already_said_str = '\n'.join(already_said)
prompt += already_said_str
fact = cat.llm(prompt)

if ascii_art_type:
output = get_output(fact, True, cats, animals)
else:
output = get_output(fact, False, cats, animals)
already_said.append(fact)
except Exception as e:
output = "No funny facts today, meowy."
elif (NINJAS_API_KEY != ""):
log.error("CALLING NINJAS")
api_url = 'https://api.api-ninjas.com/v1/facts?limit={}'.format(limit)
response = requests.get(api_url, headers={'X-Api-Key': NINJAS_API_KEY})
if response.status_code == requests.codes.ok:
Expand Down

0 comments on commit ae52023

Please sign in to comment.