MCPcopy
hub / github.com/OpenPipe/OpenPipe

github.com/OpenPipe/OpenPipe @main sqlite

repository ↗ · DeepWiki ↗
1,581 symbols 5,862 edges 664 files 95 documented · 6%
README

Note: we’ve temporarily stopped development on the open-source version of OpenPipe to integrate some proprietary third-party code. We hope to make the non-proprietary parts of the repository open again under an open core model once we have the bandwidth to do so!

logo

OpenPipe

Open-source fine-tuning and model-hosting platform.

License Apache-2.0 PRs Welcome GitHub commit activity GitHub closed issues Y Combinator S23

Demo - Running Locally - Docs

Use powerful but expensive LLMs to fine-tune smaller and cheaper models suited to your exact needs. Query your past requests and evaluate models against one another. Switch between OpenAI and fine-tuned models with one line of code.

Features

  • Easy integration with OpenAI's SDK in both Python and TypeScript.
  • Python SDK
  • TypeScript SDK
  • OpenAI-compatible chat completions endpoint.
  • Fine-tune GPT 3.5, Mistral, and Llama 2 models. Host on-platform or download the weights.
  • Model output is OpenAI-compatible.
  • Switching from GPT 4 to a fine-tuned Mistral model only requires changing the model name.
  • Query logs using powerful built-in filters.
  • Import datasets in OpenAI-compatible JSONL files.
  • Prune large chunks of duplicate text like system prompts.
  • Compare output accuracy against base models like gpt-3.5-turbo.

Supported Base Models

Documentation

Running Locally

  1. Install Postgresql.
  2. Install NodeJS 20 (earlier versions will very likely work but aren't tested).
  3. Install pnpm: npm i -g pnpm
  4. Clone this repository: git clone https://github.com/openpipe/openpipe
  5. Install the dependencies: cd openpipe && pnpm install
  6. Create a .env file (cd app && cp .env.example .env) and enter your OPENAI_API_KEY.
  7. If you just installed postgres and wish to use the default DATABASE_URL run the following commands:
psql postgres
CREATE ROLE postgres WITH LOGIN PASSWORD 'postgres';
ALTER ROLE postgres SUPERUSER;
  1. Update DATABASE_URL if necessary to point to your Postgres instance and run pnpm prisma migrate dev in the app directory to create the database.
  2. Create a GitHub OAuth App, set the callback URL to <your local instance>/api/auth/callback/github, e.g. http://localhost:3000/api/auth/callback/github.
  3. Update the GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET values from the Github OAuth app (Note: a PR to make auth optional when running locally would be a great contribution!).
  4. To start the app run pnpm dev in the app directory.
  5. Navigate to http://localhost:3000

Using Locally

import os
from openpipe import OpenAI

client = OpenAI(
    api_key="Your API Key",
    openpipe={
        "api_key": "Your OpenPipe API Key",
        "base_url": "http://localhost:3000/api/v1", # Local OpenPipe instance
    }
)

completion = client.chat.completions.create(
    model="gpt-3.5-turbo",
    messages=[{"role": "system", "content": "count to 10"}],
    openpipe={
        "tags": {"prompt_id": "counting"},
        "log_request": True
    },
)

Testing Locally

  1. Copy your .env file to .env.test.
  2. Update the DATABASE_URL to have a different database name than your development one
  3. Run DATABASE_URL=[your new datatase url] pnpm prisma migrate dev --skip-seed --skip-generate
  4. Run pnpm test

Extension points exported contracts — how you extend this code

_PrismaMigrations (Interface)
(no doc)
app/src/types/kysely-codegen.types.ts
StaticRoute (Interface)
(no doc)
app/@types/nextjs-routes.d.ts
CommandLineOptions (Interface)
(no doc)
app/prisma/seed-synthetic-dataset.ts
OnCancel (Interface)
(no doc)
client-libs/typescript/src/codegen/core/CancelablePromise.ts
Account (Interface)
(no doc)
app/src/types/kysely-codegen.types.ts
DynamicRoute (Interface)
(no doc)
app/@types/nextjs-routes.d.ts
ApiKey (Interface)
(no doc)
app/src/types/kysely-codegen.types.ts
Query (Interface)
(no doc)
app/@types/nextjs-routes.d.ts

Core symbols most depended-on inside this repo

create
called by 115
client-libs/typescript/src/openai.ts
useSelectedProject
called by 57
app/src/utils/hooks.ts
json
called by 52
client-libs/python/openpipe/api_client/types/report_response.py
useHandledAsyncCallback
called by 51
app/src/utils/hooks.ts
error
called by 49
app/src/utils/errorHandling/standardResponses.ts
nm
called by 48
infra/src/helpers.ts
then
called by 41
app/src/server/modal-rpc/trainerV1/core/CancelablePromise.ts
report
called by 41
client-libs/python/openpipe/client.py

Shape

Function 844
Method 340
Class 299
Interface 74
Enum 15
Route 9

Languages

TypeScript58%
Python42%

Modules by API surface

app/src/types/kysely-codegen.types.ts44 symbols
app/src/utils/hooks.ts35 symbols
trainer/src/api_client/client.py24 symbols
client-libs/python/openpipe/api_client/client.py23 symbols
client-libs/typescript/src/codegen/core/request.ts19 symbols
app/src/server/modal-rpc/trainerV1/core/request.ts19 symbols
app/src/server/modal-rpc/loraInferenceV1/core/request.ts19 symbols
client-libs/python/openpipe/test_async_client.py18 symbols
client-libs/typescript/src/codegen/core/CancelablePromise.ts17 symbols
app/src/server/modal-rpc/trainerV1/core/CancelablePromise.ts17 symbols
app/src/server/modal-rpc/loraInferenceV1/core/CancelablePromise.ts17 symbols
client-libs/python/openpipe/test_sync_client.py16 symbols

Dependencies from manifests, versioned

@apidevtools/json-schema-ref-parser10.1.0 · 1×
@azure/identity3.3.0 · 1×
@azure/storage-blob12.15.0 · 1×
@chakra-ui/anatomy2.2.0 · 1×
@chakra-ui/next-js2.1.4 · 1×
@chakra-ui/react2.7.1 · 1×
@emotion/react11.11.1 · 1×
@emotion/server11.11.0 · 1×
@emotion/styled11.11.0 · 1×
@fontsource/inconsolata5.0.5 · 1×
@monaco-editor/loader1.3.3 · 1×

For agents

$ claude mcp add OpenPipe \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact