Skip to main content

ConCopilot defines standards and common interfaces that would be helpful to make each part of a copilot reusable, replaceable, portable, and flexible.

Project description

ConCopilot

Benefit everyone from AI & LLM

ConCopilot is designed to CONnect all COPILOTs by making "functional parts" reusable, replaceable, portable, and flexible, aiming to leverage all potential tasks by AI & LLM.

ConCopilot defines standards and common interfaces that would be helpful to make each part of a copilot reusable, replaceable, portable, and flexible. Any contributions that can improve these features are welcome.

Other than that, ConCopilot do NOT provide specific implementation nor developing constrains to developers. Instead, ConCopilot fully leave these freedom to developers and users. Every component and configs can be changed during both developing and using, and it is welcome to upload those new components into our repository so that others can be benefited from.

Why ConCopilot

Based on Plugins, Driven by Messages

  1. Everything can be a Plugin, connect everything to AI & LLM by Messages.
  2. General LLM Interface and seamlessly LLM replacement.
  3. Decouple Businesses from Plugins and LLMs.
  4. Decouple Plugins from Copilots, LLMs, and Resources.
  5. Component package management.
  6. Convenient and Easy for Community to contribute.
  7. Free and flexible in application developments.
  8. Friendly to other developing tools.
  9. Simple for end users.

ConCopilot vs. LangChain vs. AutoGPT

In one word, LangChain is a developing tools for LLM applications, AutoGPT is one of those applications, and ConCopilot defines standards and common interfaces to help application developers and end users to deal with components easily, as well as to help products and services connect to LLMs.

As a result, using tools like LangChain, following ConCopilot interface, developing products like AutoGPT, benefit people around the world. 😆

Resources

Website
GitHub
Documents

Please note that ConCopilot do NOT take the responsibility of any malicious and abuse of components.

Example

See example source codes and configs here.

Installation

pip install --upgrade concopilot

For end users

Run a developed Copilot task

  1. Find the Copilot information (group_id, artifact_id, and version) from this website.

  2. Run the Copilot:

    conpack run
            --group-id=<copilot_group_id>
            --artifact-id=<copilot_artifact_id>
            --version=<copilot_version>
            # --config-file=<your_downloaded_file_path>
            # --working-directory=<your_working_directory>
    
Quick examples

You may like to download the config files and modify some parameters first, such as API keys, service ports, etc. Run conpack build first, and then find the corresponding config.yaml file from the ".runtime" folder. The directory path is composed by the components group_id, artifact_id, and version.

  1. Simple Chat:

    conpack run
            --group-id=org.concopilot.example.copilot
            --artifact-id=basic-chat-copilot
            --version=<version>
            # --config-file=<config.yaml|config_glm.yaml|config_rwkv.yaml|config_web.yaml|config_web_glm.yaml|config_web_rwkv.yaml>
            # --working-directory=<your_working_directory>
            # --skip-setup
    

    latest version

    component source

  2. Chat with Tools:

    conpack run
            --group-id=org.concopilot.example.copilot
            --artifact-id=basic-chat-with-tool-copilot
            --version=<version>
            # --config-file=<config.yaml|config_ocr.yaml|config_ocr_glm.yaml>
            # --working-directory=<your_working_directory>
            # --skip-setup
    

    latest version

    component source

  3. Simplified Auto-GPT like:

    conpack run
            --group-id=org.concopilot.example.copilot
            --artifact-id=basic-auto-copilot
            --version=<version>
            # --config-file=<config.yaml|config_web.yaml>
            # --working-directory=<your_working_directory>
            # --skip-setup
    

    latest version

    component source

For developers

Develop a Plugin

  1. Directory structure

    root
    |-- .config
    |    |-- config.yaml
    |    |-- ... (other config files)
    |
    |-- __init__.py (expose a "constructor" method to construct your plugin)
    |-- ...
    
  2. Extend AbstractPlugin for your plugin, and implement

    • the __init__ method which receives only one dict parameter containing its configuration.
    • the command method which receives a command name string and a parameter (recommends in type dict) and returns its response (recommends in type dict, too).
    from concopilot.framework.plugin import AbstractPlugin
    
    
    class YourPlugin(AbstractPlugin):
        def __init__(self, config: Dict):
            super(YourPlugin, self).__init__(config)
            # ...
    
        def command(self, command_name: str, param: Any, **kwargs) -> Any:
            # ...
    
  3. Edit your plugin config.yaml under the .config folder. Don't forget to fill the setup section:

    # in your plugin's config.yaml
    
    group_id: <group_id>
    artifact_id: <artifact_id>
    version: <version>
    
    # ...
    
    setup:
      pip:
        - <your_python_package>
      package: <package_of_the__init__py>
    
    #...
    
  4. Edit the __init__.py in the package to expose a "constructor" method for plugin initialization like below:

    from typing import Dict
    
    from your.plugin.package import YourPlugin
    
    
    def constructor(config: Dict):
        return YourPlugin(config)
    
    
    __all__=[
        'constructor'# Please make sure the method name is exactly "constructor"
    ]
    
  5. Deploy your python package.

  6. Deploy your plugin into our Plugin Repository so that others can use it:

    conpack deploy
            # --src-folder=<your_source_folder>
    

Develop a Copilot

  1. Build the directory structure just the same as if you are developing a Plugin.

  2. Generally there's no need to extend the Copilot interface, extend the Interactor instead.

    from concopilot.framework.interactor import BasicInteractor
    
    
    class YourInteractor(BasicInteractor):
        def __init__(
            self,
            config: Dict,
            resource_manager: ResourceManager,
            cerebrum: Cerebrum,
            plugin_manager: PluginManager,
            message_manager: MessageManager
        ):
            super(BasicInteractor, self).__init__(
                config,
                resource_manager,
                cerebrum,
                plugin_manager,
                message_manager
            )
            # ...
    
  3. Edit your interactor config.yaml under the .config folder. Don't forget to fill the setup section as developing a plugin.

  4. Edit the __init__.py in the package to expose a "constructor" method for plugin initialization like below:

    from typing import Dict
    
    from your.interactor.package import YourInteractor
    
    
    def constructor(config: Dict):
        return YourInteractor(config)
    
    
    __all__=[
        'constructor'# Please make sure the method name is exactly "constructor"
    ]
    
  5. Modify the Copilot config.yaml with your own Interactor and run the Copilot to test

    group_id: org.concopilot.basic.copilot
    artifact_id: basic-copilot
    version: <basic_copilot_version>
    
    type: copilot
    as_plugin: false
    
    # ...
    
    interactor:
      group_id: <your_interactor_group_id>
      artifact_id: <your_interactor_artifact_id>
      version: <your_interactor_version>
      config:
        # ...
    
    # ...
    
  6. Deploy your python package.

  7. Deploy your interactor into our Plugin Repository so that others can use it

    conpack deploy
            # --src-folder=<your_source_folder>
    

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

concopilot-0.0.5.tar.gz (47.1 kB view hashes)

Uploaded Source

Built Distribution

concopilot-0.0.5-py3-none-any.whl (66.9 kB view hashes)

Uploaded Python 3

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