Skip to main content

CEO is an easy-to-use AI agent framework. Now, you have taken on the role of the chairman of the board, instruct your CEO to carry out the task for you.

Project description

CEO

CEO is an easy-to-use AI agent framework. Now, you have taken on the role of the chairman of the board, instruct your CEO to carry out the task for you.

Demo

# demo.py
import os

from ceo.brain.agent import Agent
from ceo.brain.lm import get_openai_model

os.environ['OPENAI_API_KEY'] = 'sk-...'


def open_file(filename: str) -> str:
    """
    open and read a file
    :param filename:
    :return file content:
    """
    with open(filename, 'r', encoding='utf-8') as f:
        content = f.read()
        print('file content:', content)
        return content


def write_file(filename: str, content: str) -> bool:
    """
    write a file, if file not exists, will create it
    :param filename:
    :param content:
    :return success or not:
    """
    with open(filename, 'w', encoding='utf-8') as f:
        f.write(content)
        print('new content:', content)
    return True


model = get_openai_model()

agent = Agent([open_file, write_file], model)

task = 'create a file in work dir called "test_file.txt" and write "hello world" into it, then read it and write "world hello" into it'

result = agent.just_do_it(task)

print(f'Agent: {result}')
new content: hello world
file content: hello world
new content: world hello

Agent: Your intention is to create a file named "test_file.txt", write "hello world" into it, 
then read it and write "world hello" into it. Based on the actions performed, 
I have successfully created the file "test_file.txt" with the content "hello world" and then overwritten it with the content "world hello". 
Therefore, I have achieved your query.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ceo_py-0.0.1b0.tar.gz (43.3 kB view details)

Uploaded Source

Built Distribution

ceo_py-0.0.1b0-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

Details for the file ceo_py-0.0.1b0.tar.gz.

File metadata

  • Download URL: ceo_py-0.0.1b0.tar.gz
  • Upload date:
  • Size: 43.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for ceo_py-0.0.1b0.tar.gz
Algorithm Hash digest
SHA256 392b4959563adaf35c4b9874dbb5d3357e04c1cdb2d08595da612140e183d3f6
MD5 c011bd39703756b7a401addc87f51da4
BLAKE2b-256 ab9ccc5324368f4aafe56bc49bfcd7a567287fa3eaea4c3c4b729175317953c5

See more details on using hashes here.

File details

Details for the file ceo_py-0.0.1b0-py3-none-any.whl.

File metadata

  • Download URL: ceo_py-0.0.1b0-py3-none-any.whl
  • Upload date:
  • Size: 33.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for ceo_py-0.0.1b0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb6fc51e672be543842478ac6fa8ed9acacd49aee830d82f8c27b18e1d426d76
MD5 f3ec9465fed14dc9a153a7d1889748ff
BLAKE2b-256 81b4f5fd0680cd92cbfc759eb8e5769a725fadbc6872d4134dc97fa09ebbd2da

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page