Skip to content

Commit

Permalink
add initial quick start connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
walterbm-cohere committed Nov 30, 2023
1 parent 29dbe00 commit df91a8b
Show file tree
Hide file tree
Showing 676 changed files with 93,056 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/**/dev.py
/**/dev/
/**/docker-compose.yml/
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Bug in existing connector
description: Raise a bug related to an existing connector
labels:
- bug
body:
- type: textarea
attributes:
label: Which connector is affected?
description: Name of connector.
validations:
required: true

- type: textarea
attributes:
label: What is the issue?
description: |
- Give as much detail as you can to help us understand the bug.
- Include any error messages or error codes.
- Try to add reproduction steps if possible.
validations:
required: true

- type: textarea
attributes:
label: Additional information
description: Any other context, images or comments to add.
validations:
required: false
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Documentation
url: https://docs.cohere.com/docs
about: For detailed information about Cohere's API visit the documentation page.
- name: General Community Help
url: https://discord.com/invite/co-mmunity
about: For any general question not related to connectors please visit Cohere's Community's Discord.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/improvement.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Improve existing connector
description: Make a suggestion to improve the code in an existing connector.
labels:
- improvement
body:
- type: textarea
attributes:
label: Which connector is affected?
description: Name of connector.
validations:
required: true

- type: textarea
attributes:
label: What would you like to see improved?
description: |
- Give as much detail as you can to help us understand the change.
- Why should these changes be made, and what is the expected change in behavior versus the current one?
validations:
required: true

- type: textarea
attributes:
label: Additional information
description: Any other context, images or comments to add.
validations:
required: false
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/suggest-new-connector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Suggest new connector
description: Suggest a new connector to add
labels:
- addition
body:
- type: textarea
attributes:
label: What platform/tool would you like to add as a connector?
description: Name of the platform or tool to add.
validations:
required: true

- type: textarea
attributes:
label: Why do you want to add this connector?
description: Give us details as to why you think this connector would be valuable for your use-case or for the community.
validations:
required: true

- type: textarea
attributes:
label: Additional information
description: |
- Any other information is much appreciated, such as API documentation, Python SDKs, etc.
validations:
required: false
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!--
Thanks for contributing to Cohere's Search Connectors. Please fill out as much information in this template as you can so we can review the changes made. If you are a new contributor, please make sure you've read our CONTRIBUTING file located in the root directory.
-->

### What's being changed:

<!-- Please link to an existing issue here, if exists. -->

### How did you test this change (include any code snippets, API requests, screenshots, or gifs):

<!-- Please include details of your testing here. Such as screenshots of your terminal, copy/paste of a request response, etc. -->
10 changes: 10 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Format

on: [push, pull_request]

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.venv/
.vscode/
**/dev/data/
*.pyc
.DS_Store
milvus/volumes/

# ENV
.env
credentials.json
token.json
.zuliprc

# Python Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Deployment artifacts
fly.toml
56 changes: 56 additions & 0 deletions .openapi/api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
openapi: 3.0.3
info:
title: Search Connector API
version: 0.0.1
paths:
/search:
post:
description: >-
<p>Searches the connected data source for documents related to the query and returns a set of key-value pairs representing the found documents.</p>
operationId: search
summary: Perform a search
security:
- api_key: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- query
properties:
query:
description: >-
A plain-text query string to be used to search for relevant documents.
type: string
minLength: 1
example:
query: embeddings
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: object
properties:
results:
type: array
items:
type: object
additionalProperties:
type: string
"400":
description: Bad request
"401":
description: Unauthorized
default:
description: Error response

components:
securitySchemes:
api_key:
type: http
scheme: bearer
x-bearerInfoFunc: provider.app.apikey_auth
8 changes: 8 additions & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
4 changes: 4 additions & 0 deletions .trunk/configs/.hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Following source doesn't work in most setups
ignored:
- SC1090
- SC1091
2 changes: 2 additions & 0 deletions .trunk/configs/.isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[settings]
profile=black
10 changes: 10 additions & 0 deletions .trunk/configs/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Autoformatter friendly markdownlint config (all formatting rules disabled)
default: true
blank_lines: false
bullet: false
html: false
indentation: false
line_length: false
spaces: false
url: false
whitespace: false
7 changes: 7 additions & 0 deletions .trunk/configs/.shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
enable=all
source-path=SCRIPTDIR
disable=SC2154

# If you're having issues with shellcheck following source, disable the errors via:
# disable=SC1090
# disable=SC1091
10 changes: 10 additions & 0 deletions .trunk/configs/.yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rules:
quoted-strings:
required: only-when-needed
extra-allowed: ["{|}"]
empty-values:
forbid-in-block-mappings: true
forbid-in-flow-mappings: true
key-duplicates: {}
octal-values:
forbid-implicit-octal: true
5 changes: 5 additions & 0 deletions .trunk/configs/ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Generic, formatter-friendly config.
select = ["B", "D3", "E", "F"]

# Never enforce `E501` (line length violations). This should be handled by formatters.
ignore = ["E501"]
38 changes: 38 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.17.2
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
sources:
- id: trunk
ref: v1.3.0
uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
enabled:
- [email protected]
- [email protected]
- [email protected]
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
enabled:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- git-diff-check
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Cohere Quick Start Connectors contributing guide

Thank you for your interest in contributing to Cohere's connector. This guide will explain the contribution workflow from opening an issue, creating a PR, to reviewing and merging the PR.

# Getting Started

Remember that there are many ways to contribute other than writing code: writing tutorials or blog posts, improving [the documentation](https://docs.cohere.com), and submitting bug reports.

## Table of Contents

- [Assumptions](#assumptions)
- [How to Contribute](#how-to-contribute)
- [Development Workflow](#development-workflow)
- [Git Guidelines](#git-guidelines)
- [Release Process (for internal team only)](#release-process-for-internal-team-only)

## Assumptions

1. **You're familiar with [GitHub](https://github.com) and the [Pull Requests (PR)](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests) workflow.**
2. **You've read the Cohere's [documentation](https://docs.cohere.com).**
3. \*\*You know about the [Cohere community on Discord](https://discord.com/invite/co-mmunity).

## How to Contribute

1. Ensure your change has an issue! Find an
existing issue or open a new issue.
- This is where you can get a feel if the change will be accepted or not.
2. Once approved, fork this repository repository in your own GitHub account.
3. [Create a new Git branch](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-and-deleting-branches-within-your-repository)
4. Make your changes on your branch.
5. [Submit the branch as a Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) pointing to the `main` branch this repository. A maintainer should comment and/or review your Pull Request within a few days. Although depending on the circumstances, it may take longer.
48 changes: 48 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# syntax = docker/dockerfile:1.4.0
FROM python:3.11-slim-bookworm as operating-system-deps
WORKDIR /app

# Keeps Python from generating .pyc files in the container
# Turns off buffering for easier container logging
# Force UTF8 encoding for funky character handling
# Needed so imports function properly
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=utf-8
ENV PYTHONPATH=/app
# Keep the venv name and location predictable
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
# Control the number of workers Gunicorn uses
ENV WEB_CONCURRENCY=1

# "Activate" the venv manually for the context of the container
ENV VIRTUAL_ENV=/app/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential=* \
libpq-dev=* && \
rm -rf /var/lib/apt/lists/*

FROM operating-system-deps
ARG app
ARG port=8000

COPY ./${app}/pyproject.toml ./${app}/poetry.lock /app/
RUN pip install --no-cache-dir poetry==1.5.1 && \
poetry install

COPY ./.openapi /app/.openapi
COPY ${app} ./${app}

# use a RUN to create an entrypoint because the ENTRYPOINT directive does not
# support variable substitution
RUN <<EOF cat >> /app/entrypoint.sh && chmod +x /app/entrypoint.sh
#!/usr/bin/env bash
gunicorn -b 0.0.0.0:${port} -t 240 --preload "provider:create_app()"
EOF

WORKDIR /app/${app}
EXPOSE ${port}
ENTRYPOINT ["/app/entrypoint.sh"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Cohere

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit df91a8b

Please sign in to comment.