https://github.com/dcarpintero/create-cohere-connector
Bootstrap a custom Cohere Connector to enhance Cohere's LLMs with dynamic, up-to-date data.
https://github.com/dcarpintero/create-cohere-connector
cohere-ai cohere-connectors generative-ai large-language-models retrieval-augmented-generation
Last synced: 7 months ago
JSON representation
Bootstrap a custom Cohere Connector to enhance Cohere's LLMs with dynamic, up-to-date data.
- Host: GitHub
- URL: https://github.com/dcarpintero/create-cohere-connector
- Owner: dcarpintero
- License: apache-2.0
- Created: 2024-01-29T16:07:08.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-02T17:58:01.000Z (over 1 year ago)
- Last Synced: 2025-02-23T13:22:45.832Z (7 months ago)
- Topics: cohere-ai, cohere-connectors, generative-ai, large-language-models, retrieval-augmented-generation
- Language: Jinja
- Homepage: https://docs.cohere.com/docs/connectors
- Size: 75.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Create Cohere Connector [](https://github.com/dcarpintero/create-cohere-connector/) [](https://pypi.org/project/create-cohere-connector/)
Generates a custom Cohere Connector with one command. [Cohere Connectors](https://docs.cohere.com/docs/connectors) enable to combine Cohere's large language models (LLMs), which power the [Chat API](https://docs.cohere.com/docs/cochat-beta), with up-to-date factual information. They enhance Cohere's retrieval augmented generation (RAG) offering, and can respond to user questions and prompts with substantive, grounded generations that contain citations to external public or private knowledge bases.
Note that this is an experimental project. If something doesnโt work, please [file an issue](https://github.com/dcarpintero/create-cohere-connector/issues/new).
**You might also refer to the official Cohere repo for Connectors: https://github.com/cohere-ai/quick-start-connectors**
## ๐งฎ What is included?
Your environment will have everything you need to quickly prototype and deploy a custom Cohere Connector:
- ``API service`` implementing the required ``search`` endpoint using [FastAPI](https://fastapi.tiangolo.com/) (support for [Flask](https://flask.palletsprojects.com/) is planned).
- ``Bearer Token Authentication`` using the Authorization header in HTTP requests.
- ``Pydantic models`` for data validation and serialization.
- ``Client class`` to retrieve data from a custom data source.
- ``Deploy script`` to register your connector with Cohere.## ๐ Quickstart
1. Install ``create-cohere-connector`` package:
You might install this package globall:
```sh
poetry self add poetry-scaffold
```or within a virtual environment:
```sh
# Windows
py -m venv .venv
.venv\scripts\activate
``````sh
# macOS/Linux
python3 -m venv .venv
source .venv/bin/activate
``````sh
pip3 install create-cohere-connector
```2. Bootstrap your project:
```sh
poetry run create-cohere-connector
```This will prompt for a project name:
```sh
Project name [myconnector]: hello-connector
Api framework [FastAPI]: FastAPI
Authentication [Bearer]: Bearer
Caching [None]: None
```generate the initial project structure:
```
myconnector
โโโ README.md
โโโ deploy.py
โโโ Dockerfile
โโโ pyproject.toml
โโโ poetry.lock
โโโ .gitignore
โโโ provider
โโโ __init__.py
โโโ app.py
โโโ config.py
โโโ client.py
โโโ provider.py
โโโ exceptions.py
โโโ datamodels.py
```and install dependencies:
```sh
โ Project created successfully!
```
![]()
3. Set environment variables
You might rename ``.env_template`` to ``.env``, and complete it.
4. Span a shell within the virtual environment
```sh
poetry shell
```5. Install dependencies
```sh
poetry config virtualenvs.in-project true
poetry install --no-root
```6. Start API service
```sh
poetry run uvicorn app:app --app-dir provider --port 5000 --reload
```7. Deploy Cohere Connector
```sh
python deploy.py
```
![]()
## ๐ฉโ๐ป Contributions
If you would like to contribute, here are some features that we are planning to add:
- Improve Poetry virtual environment creation
- Flask support
- Semantic caching
- OAuth 2.0
- Data models scaffolding## โ๏ธ License
Create Cohere Connector is open source software licensed as Apache 2.0.