Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
BenderV committed Nov 6, 2024
1 parent 73d3da9 commit 05e447e
Showing 1 changed file with 25 additions and 27 deletions.
52 changes: 25 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# AutoChat

AutoChat is an assistant library, that supports OpenAI/Anthropic, to simplify the process of creating interactive agents.
AutoChat is an assistant library, to make it easy to create interactive agents.
It supports OpenAI/Anthropic and can run on top of any other LLM.

- **Autochat Class**: Conversation wrapper to store instruction, context and messages histories.
- **Message Class**: Message wrapper to handle format/parsing automatically.
Expand All @@ -17,46 +18,43 @@ pip install autochat

Please note that this package requires Python 3.6 or later.

## Simple Example

```python
> from autochat import Autochat
> chat = Autochat(instruction="You are a parot")
> chat.ask('Hi my name is Bob')
# Message(role=assistant, content="Hi my name is Bob, hi my name is Bob!")
> chat.ask('Can you tell me my name?')
# Message(role=assistant, content="Your name is Bob, your name is Bob!")
```

## Function Calls Handling
## Function Calls

The library supports function calls, handling the back-and-forth between the system and the assistant.

```python
from autochat import Autochat, Message
import json

def label_item(category: str, from_response: Message):
# TODO: Implement function
raise NotImplementedError()
import requests

with open("./examples/function_label.json") as f:
FUNCTION_LABEL_ITEM = json.load(f)
def search_top_result(query: str):
response = requests.get(f"https://google.com/search?q={query}")
return response.text

classifierGPT = Autochat.from_template("./examples/classify_template.txt")
classifierGPT.add_function(label_item, FUNCTION_LABEL_ITEM)
classifierGPT = Autochat(instruction="You are a helpful assistant that can search the web for information")
classifierGPT.add_function(search_top_result)

text = "The new iPhone is out"
text = "since when is the lastest iphone available?"
for message in classifierGPT.run_conversation(text):
print(message.to_markdown())

# > ## assistant
# > It's about \"Technology\" since it's about a new iPhone.
# > LABEL_ITEM(category="Technology")
# > search_top_result(query=next iphone release date)
# > ## function
# > NotImplementedError()
# > (html content)
# > ## assistant
# > Seem like you didn't implement the function yet.
# > The latest iPhone models, iPhone 14, iPhone 14 Plus, iPhone 14 Pro, and iPhone 14 Pro Max, were released on September 16, 2022.

```

## Simple Example

```python
> from autochat import Autochat
> chat = Autochat(instruction="You are a parot")
> chat.ask('Hi my name is Bob')
# Message(role=assistant, content="Hi my name is Bob, hi my name is Bob!")
> chat.ask('Can you tell me my name?')
# Message(role=assistant, content="Your name is Bob, your name is Bob!")
```

## Template System
Expand Down

0 comments on commit 05e447e

Please sign in to comment.