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.

Installation

  • From PYPI

    pip install ceo-py
    
  • From Github

    Download .whl first then run

    pip install ./ceo_py-x.x.x-py3-none-any.whl
    

Demo

# demo.py
import logging
import os

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

logging.getLogger('ceo').setLevel(logging.DEBUG)

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()
        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)
    return True


model = get_openai_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'

Agent([open_file, write_file], model).just_do_it(task)
[DEBUG] 2024-10-29 21:59:13,415 ceo : Schedule: ['write_file', 'open_file', 'write_file']. Query: "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".
[DEBUG] 2024-10-29 21:59:15,196 ceo : Action 1/3: I chose to use the tool "write_file" with the parameters {'filename': 'test_file.txt', 'content': 'hello world'}. I successfully wrote the content "hello world" to a file named "test_file.txt".
[DEBUG] 2024-10-29 21:59:17,130 ceo : Action 2/3: I chose to use the tool "open_file" with the parameter {'filename': 'test_file.txt'}. 
I opened and read the file "test_file.txt" and the content of the file is "hello world".
[DEBUG] 2024-10-29 21:59:19,602 ceo : Action 3/3: I chose to use the tool "write_file" with the parameters {'filename': 'test_file.txt', 'content': 'world hello'}. 
I have successfully written the content "world hello" to a file named "test_file.txt".
[DEBUG] 2024-10-29 21:59:21,811 ceo : Conclusion: Your intention was to create a file called "test_file.txt", write "hello world" into it, then read it and write "world hello" into it. 
Based on the actions I have performed, I have successfully achieved your query. 
I created the file "test_file.txt" and wrote "hello world" into it, then read it to confirm the content, and finally wrote "world hello" into the same file. Your query has been successfully completed.

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.1.0b0.tar.gz (44.7 kB view details)

Uploaded Source

Built Distribution

ceo_py-0.1.0b0-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ceo_py-0.1.0b0.tar.gz
  • Upload date:
  • Size: 44.7 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.1.0b0.tar.gz
Algorithm Hash digest
SHA256 2c5d2f0b328dc5a6dc87bf6e24d83ecdcca2532fb8d3c71e6753c47acb23ea0d
MD5 a63f6406e505954b6ce817cd210f38e5
BLAKE2b-256 43d24411f4bba4580e6c2c5451397978cffebe1243e22bf97a6effc08d12f64a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ceo_py-0.1.0b0-py3-none-any.whl
  • Upload date:
  • Size: 34.6 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.1.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a54e80dcbbba25d659d21f2f87edb0f76cfbc4b6d0d909685d3f961d3c003d7
MD5 3e575aebd6e8d3d88a26c8d0dc1ba10c
BLAKE2b-256 4819040de515bc3398c73e9a9ba2ad413706cd724e203dd62b759a2c99cac9ac

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