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
    

These Projects Are Built With ceo-py

Examples

  • Compound Tasks

    1. Find the surface area and volume of a sphere and write the results into a file.

      from ceo import Agent, get_openai_model
      from sympy import simplify
      from dotenv import load_dotenv
      
      from ceo.util import ability
      
      load_dotenv()
      
      
      @ability
      def constant_calculate(expr: str) -> float:
          return simplify(expr)
      
      
      @ability
      def write_file(filename: str, content: str) -> bool:
          with open(filename, 'w', encoding='utf-8') as f:
              f.write(content)
          return True
      
      
      if __name__ == '__main__':
          ceo = Agent(abilities=[constant_calculate, write_file], brain=get_openai_model(), name='test')
          ceo.assign("Here is a sphere with radius of 3.1121 cm and pi here is 3.14159, find the area and volume respectively then write the results into a file called 'result.txt'.")
          result = ceo.just_do_it()
          print(result)
      
      # result.txt
      Surface Area: 121.707287767968 cm²
      Volume: 126.255083420897 cm³
      
      # stdout
      test: Your intention is to calculate the surface area and volume of a sphere with a radius of 3.1121 cm using pi as 3.14159, and to save the results in 'result.txt'. I have successfully achieved your intention. 
      
      The calculations I performed are as follows:
      - Surface Area: 121.707287767968 cm²
      - Volume: 126.255083420897 cm³
      
      I also saved these results in 'result.txt'.
      
  • Multi-agent Task

    1. Ask the suitable agents to find the surface area and volume of a sphere and write the results into a file.

      import sys
      
      import sympy
      from dotenv import load_dotenv
      
      from ceo import Agent, get_openai_model
      from ceo.util import agentic, ability
      
      load_dotenv()
      sys.set_int_max_str_digits(10**8)
      
      model = get_openai_model()
      
      
      @ability
      def calculator(expr: str) -> float | str:
          expr = expr.replace(',', '')
          expr = expr.replace('_', '')
          try:
              try:
                  return sympy.simplify(expr, rational=None)
              except ValueError as ve:
                  return ve.__repr__()
          except sympy.SympifyError as se:
              return se.__repr__()
      
      
      @ability
      def write_file(filename: str, content: str) -> bool:
          with open(filename, 'w', encoding='utf-8') as f:
              f.write(content)
          return True
      
      
      @agentic(Agent(abilities=[calculator], brain=model, name='Jack'))
      def agent1():
          return
      
      
      @agentic(Agent(abilities=[write_file], brain=model, name='Tylor'))
      def agent2():
          return
      
      
      if __name__ == '__main__':
          agent = Agent(abilities=[agent1, agent2], brain=model, name='test')
          result = agent.assign("Here is a sphere with a radius of 9.987 cm and pi here is 3.14159, "
                      "find the area and volume respectively, "
                      "then write the results into a file called 'result.txt'.").just_do_it()
          print(result)
      
      # result.txt
      Calculated Surface Area: 1253.37 cm²
      Calculated Volume: 4172.47 cm³
      
      test: Your intention is to calculate the surface area and volume of a sphere with a radius of 9.987 cm using pi = 3.14159, and to save the results in a file named 'result.txt'. I have successfully achieved your intention. 
      
      The calculations yielded the following results:
      - The surface area of the sphere is approximately 1253.37 cm².
      - The volume of the sphere is approximately 4172.47 cm³.
      
      Additionally, I have written these results into 'result.txt', and the write operation was successful.
      

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.7.1rc0.tar.gz (48.8 kB view details)

Uploaded Source

Built Distribution

ceo_py-0.7.1rc0-py3-none-any.whl (40.4 kB view details)

Uploaded Python 3

File details

Details for the file ceo_py-0.7.1rc0.tar.gz.

File metadata

  • Download URL: ceo_py-0.7.1rc0.tar.gz
  • Upload date:
  • Size: 48.8 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.7.1rc0.tar.gz
Algorithm Hash digest
SHA256 7cf01893e8f55892e00f20ddda418a10cf4ebfbec5cb592cf50d21e9c4f56ede
MD5 80db522dbd6ce76b9c31bb42e108766f
BLAKE2b-256 3475119163fcedb64260d64522bacc66a1c08a60620bca804417b4884d64d34b

See more details on using hashes here.

File details

Details for the file ceo_py-0.7.1rc0-py3-none-any.whl.

File metadata

  • Download URL: ceo_py-0.7.1rc0-py3-none-any.whl
  • Upload date:
  • Size: 40.4 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.7.1rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 85687c6b475c8458735825541f6e7dfb0981430f4a8af2a9dba07777c62a0b4b
MD5 cedc5e56c5ff45797d0fa9baa60a2042
BLAKE2b-256 e422c2d4a5ea15ec01246aceb74db77a915d10a6bcaa1560c7c3a21585c08c27

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