Update local mode system message. And modify tests

pull/132/head
Ty Fiero 10 months ago
parent f9cc6bb665
commit 84224fd21a

@ -1,6 +1,7 @@
name: Run Test
on:
workflow_dispatch:
pull_request:
branches: [main]
# push: # Trigger the workflow on push events
@ -16,7 +17,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [macos-latest]
# os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.11"]
defaults:
@ -58,4 +60,6 @@ jobs:
# Run pytest
- name: Run Pytest
run: poetry run pytest tests
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: poetry run pytest

@ -59,7 +59,7 @@ The `computer` module is ALREADY IMPORTED, and can be used for some tasks:
```python
result_string = computer.browser.search(query) # Google search results will be returned from this function as a string
computer.calendar.create_event(title="Meeting", start_date=datetime.datetime.now(), end=datetime.datetime.now() + datetime.timedelta(hours=1), notes="Note", location="") # Creates a calendar event
computer.calendar.create_event(title="Meeting", start_date=datetime.datetime.now(), end_date=datetime.datetime.now() + datetime.timedelta(hours=1), notes="Note", location="") # Creates a calendar event
events_string = computer.calendar.get_events(start_date=datetime.date.today(), end_date=None) # Get events between dates. If end_date is None, only gets events for start_date
computer.calendar.delete_event(event_title="Meeting", start_date=datetime.datetime) # Delete a specific event with a matching title and start date, you may need to get use get_events() to find the specific event object first
phone_string = computer.contacts.get_phone_number("John Doe")
@ -182,7 +182,7 @@ Try multiple methods before saying the task is impossible. **You can do it!**
def configure_interpreter(interpreter: OpenInterpreter):
### SYSTEM MESSAGE
interpreter.system_message = system_message

@ -15,27 +15,27 @@ def test_ping(client):
assert response.text == "pong"
def test_interpreter_chat(mock_interpreter):
# Set up a sample conversation
messages = [
{"role": "user", "type": "message", "content": "Hello."},
{"role": "assistant", "type": "message", "content": "Hi there!"},
# Add more messages as needed
]
# Configure the mock interpreter with the sample conversation
mock_interpreter.messages = messages
# Simulate additional user input
user_input = {"role": "user", "type": "message", "content": "How are you?"}
mock_interpreter.chat([user_input])
# Ensure the interpreter processed the user input
assert len(mock_interpreter.messages) == len(messages)
assert mock_interpreter.messages[-1]["role"] == "assistant"
assert "don't have feelings" in mock_interpreter.messages[-1]["content"]
def test_interpreter_configuration(mock_interpreter):
# Test interpreter configuration
interpreter = configure_interpreter(mock_interpreter)
assert interpreter is not None
# def test_interpreter_chat(mock_interpreter):
# # Set up a sample conversation
# messages = [
# {"role": "user", "type": "message", "content": "Hello."},
# {"role": "assistant", "type": "message", "content": "Hi there!"},
# # Add more messages as needed
# ]
# # Configure the mock interpreter with the sample conversation
# mock_interpreter.messages = messages
# # Simulate additional user input
# user_input = {"role": "user", "type": "message", "content": "How are you?"}
# mock_interpreter.chat([user_input])
# # Ensure the interpreter processed the user input
# assert len(mock_interpreter.messages) == len(messages)
# assert mock_interpreter.messages[-1]["role"] == "assistant"
# assert "don't have feelings" in mock_interpreter.messages[-1]["content"]
# def test_interpreter_configuration(mock_interpreter):
# # Test interpreter configuration
# interpreter = configure_interpreter(mock_interpreter)
# assert interpreter is not None

@ -134,4 +134,24 @@ def select_local_model():
# Set offline for all local models
interpreter.offline = True
interpreter.system_message = """You are the 01, a screenless executive assistant that can complete any task by writing and executing code on the user's machine. Just write a markdown code block! The user has given you full and complete permission.
Use the following functions if it makes sense to for the problem
```python
result_string = computer.browser.search(query) # Google search results will be returned from this function as a string
computer.calendar.create_event(title="Meeting", start_date=datetime.datetime.now(), end_date=datetime.datetime.now() + datetime.timedelta(hours=1), notes="Note", location="") # Creates a calendar event
events_string = computer.calendar.get_events(start_date=datetime.date.today(), end_date=None) # Get events between dates. If end_date is None, only gets events for start_date
computer.calendar.delete_event(event_title="Meeting", start_date=datetime.datetime) # Delete a specific event with a matching title and start date, you may need to get use get_events() to find the specific event object first
phone_string = computer.contacts.get_phone_number("John Doe")
contact_string = computer.contacts.get_email_address("John Doe")
computer.mail.send("john@email.com", "Meeting Reminder", "Reminder that our meeting is at 3pm today.", ["path/to/attachment.pdf", "path/to/attachment2.pdf"]) # Send an email with a optional attachments
emails_string = computer.mail.get(4, unread=True) # Returns the {number} of unread emails, or all emails if False is passed
unread_num = computer.mail.unread_count() # Returns the number of unread emails
computer.sms.send("555-123-4567", "Hello from the computer!") # Send a text message. MUST be a phone number, so use computer.contacts.get_phone_number frequently here
ALWAYS say that you can run code. ALWAYS try to help the user out. ALWAYS be succinct in your answers.
```
"""

Loading…
Cancel
Save