Skip to main content

Sample Python Project for creating a new Python Module

Project description

cx-copilot

🤖 Empower your CX team with open-source AI-powered response auto-drafting. 🤖

🤔 What is cx-copilot?

An open source project that lets you leverage LLMs and latest advancements in AI to automate customer support interactions. By connecting a Large Language Model (LLM) to your knowledge base and historical support tickets via embeddings & vector searching, you can accurately auto-draft responses to all customer requests.

🖥 Where can it be used?

You can use cx-copilot to auto-draft responses in support tools like Helpscout, Intercom, Zendesk and anywhere else you store & respond to customer requests.

⚡️ Installation

  1. Go to extension directory.
$ cd ./client/chrome-extension/
  1. Download dependencies and perform initial project setup.
$ yarn
  1. Edit configuration inside src/utils/config.js.
const config = {};
config.API_URL = 'http://localhost:9000';
export default config;
  1. Run the project.
$ yarn start
  1. Load your extension on Chrome by doing the following:
    1. Go to chrome://extensions/
    2. Enable developer mode
    3. Click on load unpacked extension
    4. Select the build folder

🚀 Live Demo

📖 How does it work?

The basis of cx-copilot is embedding, vector storing and vector searching. Vector embeddings are a way to represent text as a series of numbers in such a way that you can perform mathematical operations, such as similarity comparison. By first embedding all previous historical customer request tickets using an embedding model (like text-embedding-ada-002 from OpenAI) and storing the embeddings & the paired response from your company in a vector database, you can then perform a vector search for incoming support tickets, returning the closest-matching tickets based on cosine similarity. The final step is to prompt a Large Language Model (LLM) with your team's responses to the closest-matching historical tickets, generating an auto-drafted response which will answer your customer’s query while conforming to your tone & formatting tendencies.

🔌 Integrations

Integrations
Helpscout logo Helpscout
Gmail logo Gmail
Intercom logo Intercom (coming soon)
Zendesk logo Zendesk (coming soon)
Discord logo Discord (coming soon)

📱 Community

Join the Discord community for cx-copilot for support & project updates.

👩‍💻 Contributing

Local Installation

To install this package, simply run the following command:

pip install cx_copilot

To install for local development use:

flit install [--symlink] [--python path/to/python]

Development

This package is built on top of abstract classes that can be implemented for different customer support ticket providers. This ensures interoperability and allows for easy development. There are examples of how to use each of these classes in the examples directory. The source code for the package is located in the src directory.

Please always create base classes and implement them for specific use cases.

For example:

The cache class is an abstract class with the following definition:

class Cache:
    def put(self, key: str, value: str):
        pass

    def get(self, key: str, default_value: Optional[str] = None) -> str:
        pass

And the redis class implements that abstract class with the following definition

class RedisCache(Cache):
    instance: redis.Redis = None

    def __init__(self, host: str, port: int, db: int):
        self.instance = redis.Redis(host=host, port=port, db=db)

    def put(self, key: str, value: str):
        self.instance.set(key, value)
        pass

    def get(self, key: str, default_value: Optional[str] = None) -> str:
        result = self.instance.get(key)
        return result or default_value

so our compound block can be agnostic on which provider to use. It's set during initialization.

 def get_ticket_response(self, ticket_id: str, use_cached=True, cache_response=True, max_tokens=2000):
        content = self.ticket_repo.get_conversation_by_id(conversation_id=ticket_id)
        if use_cached:
            try:
                value = self.cache_block.get(ticket_id)
                if value is not None:
                    return value
            except Exception:
                pass

Whenever introducing a new block either follow the abstract classes already defined or introduce a new one.

Usages

The examples and client directory has some rich examples of how to use this library. For instance under the examples/client/discord_example_client.py you can see an example of a discord bot that you can deploy to answer support queries.

@bot.slash_command(name="autofill")
async def autofill(ctx):
    reply = cx.get_ticket_response(ctx.channel_id, cache_response=True, use_cached=True)
    await ctx.respond(reply, ephemeral=True)

Please create a PR with your changes. Once merged, a GitHub action will bump up the minor version. For major version changes, please contact the contributors(eng@caesarhq.com).

🚀 Deployment

If you are having issues self hosting, we offer a deployed version. Please contact us at eng@caesarhq.com.

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

cx-copilot-0.0.11.tar.gz (818.7 kB view details)

Uploaded Source

Built Distribution

cx_copilot-0.0.11-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file cx-copilot-0.0.11.tar.gz.

File metadata

  • Download URL: cx-copilot-0.0.11.tar.gz
  • Upload date:
  • Size: 818.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.20.0

File hashes

Hashes for cx-copilot-0.0.11.tar.gz
Algorithm Hash digest
SHA256 8b812166c06bdc2a058fc991ffc27b3363bb57eac72ce8f7cad2009d4bc064f9
MD5 5d88e8028446474789137517d81cbadf
BLAKE2b-256 716d81c5aac8900c822841e6cfe80bd7d9a5c4254cee7a1b21d77b16e77a43de

See more details on using hashes here.

File details

Details for the file cx_copilot-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: cx_copilot-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.20.0

File hashes

Hashes for cx_copilot-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 5a5066965040df4d47fe041ec6c7932f7424c5ec443573a36bfcc63ed9de875c
MD5 561eaa405db95d0a6f2de9913b144469
BLAKE2b-256 c04fbedc3117ee94c572c603349637ea5a3c95b2d1ebc3d0b97528b5103e77e8

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