Skip to content

Commit

Permalink
Merge branch 'main' into gcalendar-connector
Browse files Browse the repository at this point in the history
# Conflicts:
#	gcalendar/provider/app.py
  • Loading branch information
EugeneP committed Dec 5, 2023
2 parents ca4472e + 5c0ae4f commit 1f3d4ca
Show file tree
Hide file tree
Showing 169 changed files with 1,516 additions and 99 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@

# Overview

Cohere's Build-Your-Own-Connector framework allows you to integrate Cohere's Command LLM via the [co.chat api endpoint](https://docs.cohere.com/reference/chat) to any datastore/software that holds text information and has a corresponding search endpoint exposed in its API. This allows the Commanad model to generated responses to user queries that are grounded in proprietary information.
Cohere's Build-Your-Own-Connector framework allows you to integrate Cohere's Command LLM via the [co.chat api endpoint](https://docs.cohere.com/reference/chat) to any datastore/software that holds text information and has a corresponding search endpoint exposed in its API. This allows the Command model to generated responses to user queries that are grounded in proprietary information.

Some examples of the use-cases you can enable with this framework:

* Generic question/answering around broad internal company docs
* Knowledge working with specific sub-set of internal knowledge
* Internal comms summary and search
* Research using external providers of information, allowing researchers and writers to explore to information from 3rd parties
- Generic question/answering around broad internal company docs
- Knowledge working with specific sub-set of internal knowledge
- Internal comms summary and search
- Research using external providers of information, allowing researchers and writers to explore to information from 3rd parties

This open-source repository contains code that will allow you to get started integrating with some of the most popular datastores. There is also an [empty template connector](https://github.com/cohere-ai/quick-start-connectors/tree/main/template) which you can expand to use any datasource. Note that different datastores may have different requirements or limitations that need to be addressed in order to to get good quality responses. While some of the quickstart code has been enhanced to address some of these limitations, others only provide the basics of the integration, and you will need to develop them further to fit your specific use-case and the underlying datastore limitations.
This open-source repository contains code that will allow you to get started integrating with some of the most popular datastores. There is also an [empty template connector](https://github.com/cohere-ai/quick-start-connectors/tree/main/_template_) which you can expand to use any datasource. Note that different datastores may have different requirements or limitations that need to be addressed in order to to get good quality responses. While some of the quickstart code has been enhanced to address some of these limitations, others only provide the basics of the integration, and you will need to develop them further to fit your specific use-case and the underlying datastore limitations.

Please read more about our connectors framework here: LINK TO DOCS
Please read more about our connectors framework here: https://docs.cohere.com/docs/connectors

# Getting Started

Expand All @@ -53,14 +53,14 @@ For example, a connector that returns documents about company expensing policy m
{
"title": "Company Travel Policy",
"text": "Flights, Hotels and Meals can be expensed using this new tool...",
"url": "https://drive.google.com/file/d/id1"
"created_at": "2023-11-25T20:09:31Z",
"url": "https://drive.google.com/file/d/id1",
"created_at": "2023-11-25T20:09:31Z"
},
{
"title": "2023 Expenses Policy",
"text": "The list of recommended hotels are",
"url": "https://drive.google.com/file/d/id2"
"created_at": "2022-11-22T20:09:31Z",
"title": "2024 Expenses Policy",
"text": "The list of recommended hotels are...",
"url": "https://drive.google.com/file/d/id2",
"created_at": "2023-12-04T16:52:12Z"
}
]
```
Expand Down
1 change: 1 addition & 0 deletions _template_/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
# load environment variables prefixed with the name of the current directory
config_prefix = os.path.split(os.getcwd())[1].upper().replace("_", "")
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion _template_/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def search(body):
},
]

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


# This function is run for all endpoints to ensure requests are using a valid API key
Expand Down
1 change: 1 addition & 0 deletions agilitycms/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion agilitycms/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def search(body):
logger.error(f"AgilityCMS config error: {error}")
abort(502, f"AgilityCMS config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions agora/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion agora/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def search(body):
logger.error(f"Agora config error: {error}")
abort(502, f"Agora config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions aha/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion aha/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def search(body):
logger.error(f"Aha config error: {error}")
abort(502, f"Aha config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions algolia/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
flask_app.config.from_mapping(dotenv_values())
return flask_app
2 changes: 1 addition & 1 deletion algolia/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions asana/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion asana/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions atera/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion atera/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions backstage/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion backstage/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def search(body):
except AssertionError as error:
logger.error(f"Solr config error: {error}")
abort(502, f"Solr config error: {error}")
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions basecamp/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion basecamp/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def search(body):
logger.error(f"Basecamp config error: {error}")
abort(502, f"Basecamp config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions bigquery/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion bigquery/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions blogger/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ def create_app():
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix

return flask_app
2 changes: 1 addition & 1 deletion blogger/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def search(body):
logger.error(f"Blogger config error: {error}")
abort(502, f"Blogger config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions box/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion box/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def search(body):
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions cockroach/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion cockroach/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def search(body):
except AssertionError as error:
logger.error(f"Cockroach config error: {error}")
abort(502, f"Cockroach config error: {error}")
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions coda/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion coda/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions confluence/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion confluence/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def search(body):
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions contentful/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion contentful/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def search(body):
logger.error(f"Contentful config error: {error}")
abort(502, f"Contentful config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions copper/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion copper/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def search(body):
logger.error(f"Copper provider error: {error}")
abort(502, f"Copper config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions couchbase/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion couchbase/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def search(body):
logger.error(f"Couchbase config error: {error}")
abort(502, f"Couchbase config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions courier/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion courier/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions discourse/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ def create_app() -> connexion.FlaskApp:
flask_app = app.app
config_prefix = os.path.split(os.getcwd())[1].upper()
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion discourse/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def search(body):
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions docusign/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion docusign/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def search(body):
logger.error(f"Docusign config error: {error}")
abort(502, f"Docusign config error: {error}")

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions egnyte/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion egnyte/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search(body):
except UpstreamProviderError as error:
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)
return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions elastic/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
2 changes: 1 addition & 1 deletion elastic/provider/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def search(body):
logger.error(f"Upstream search error: {error.message}")
abort(502, error.message)

return {"results": data}
return {"results": data}, 200, {"X-Connector-Id": app.config.get("APP_ID")}


def apikey_auth(token):
Expand Down
1 change: 1 addition & 0 deletions fifteenfive/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def create_app() -> connexion.FlaskApp:
1
].upper() # Current directory name, upper-cased
flask_app.config.from_prefixed_env(config_prefix)
flask_app.config["APP_ID"] = config_prefix
return flask_app
Loading

0 comments on commit 1f3d4ca

Please sign in to comment.