Search is not available for this dataset
repo_id stringlengths 12 110 | file_path stringlengths 24 164 | content stringlengths 3 89.3M | __index_level_0__ int64 0 0 |
|---|---|---|---|
public_repos | public_repos/opengpts/docker-compose.yml | version: '3'
services:
redis:
image: redislabs/redisearch:latest
container_name: redis
# Export the port that the service is listening on.
expose:
- "6379"
ports:
- "6379:6379"
backend:
build:
context: . # Use the current directory as the build context
dockerfile: D... | 0 |
public_repos | public_repos/opengpts/.env.gcp.yaml.example | OPENAI_API_KEY: your_secret_key_here
LANGCHAIN_TRACING_V2: "true"
LANGCHAIN_PROJECT: langserve-launch-example
LANGCHAIN_API_KEY: your_secret_key_here
REDIS_URL: your_secret_here
TAVILY_API_KEY: your_secret_here
FIREWORKS_API_KEY: your_secret_here
YDC_API_KEY: your_secret_here
AWS_ACCESS_KEY_ID: your_secret_here
AWS_SEC... | 0 |
public_repos | public_repos/opengpts/Dockerfile | FROM python:3.11
RUN apt-get install -y libmagic1
WORKDIR /backend
COPY ./backend .
RUN rm poetry.lock
RUN pip install .
COPY ./frontend/dist ./ui
CMD exec uvicorn app.server:app --host 0.0.0.0 --port $PORT
| 0 |
public_repos | public_repos/opengpts/.clabot | {
"contributors": ["eyurtsev", "hwchase17", "nfcampos", "efriis", "jacoblee93", "dqbd", "harris", "baskaryan", "hinthornw", "bracesproul", "jakerachleff"],
"message": "Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem t... | 0 |
public_repos | public_repos/opengpts/CONTRIBUTING.md | # Contributing
## Contributor License Agreement
We are grateful to the contributors who help evolve OpenGPTs and dedicate their time to the project. As the primary sponsor of OpenGPTs, LangChain, Inc. aims to build products in the open that benefit thousands of developers while allowing us to build a sustainable busi... | 0 |
public_repos | public_repos/opengpts/README.md | # OpenGPTs
This is an open source effort to create a similar experience to OpenAI's GPTs.
It builds upon [LangChain](https://github.com/langchain-ai/langchain), [LangServe](https://github.com/langchain-ai/langserve) and [LangSmith](https://smith.langchain.com/).
OpenGPTs gives you more control, allowing you to configu... | 0 |
public_repos | public_repos/opengpts/LICENSE | # OpenGPTs License
By using the software, you agree to all of the terms and conditions below.
## Copyright License
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in e... | 0 |
public_repos/opengpts | public_repos/opengpts/backend/poetry.lock | # This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand.
[[package]]
name = "agent-executor"
version = "0.1.0"
description = ""
optional = false
python-versions = "^3.8.1"
files = []
develop = true
[package.dependencies]
langchain = ">=0.0.333"
python-magic = "^0.4.27"
[package.sour... | 0 |
public_repos/opengpts | public_repos/opengpts/backend/requirements.txt | langchain-cli
-e packages/gizmo-agent
-e packages/agent-executor
langchain>=0.0.331
langserve>=0.0.23
| 0 |
public_repos/opengpts | public_repos/opengpts/backend/Makefile | .PHONY: all lint format test help
# Default target executed when no arguments are given to make.
all: help
######################
# TESTING AND COVERAGE
######################
# Define a variable for the test file path.
TEST_FILE ?= tests/unit_tests/
test:
# We need to update handling of env variables for tests
Y... | 0 |
public_repos/opengpts | public_repos/opengpts/backend/pyproject.toml | [tool.poetry]
name = "lang-gizmo"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
readme = "README.md"
packages = [{include = "app"}]
[tool.poetry.dependencies]
python = "^3.8.1"
sse-starlette = "^1.6.5"
tomli-w = "^1.0.0"
uvicorn = "^0.23.2"
fastapi = "^0.103.2"
langserve = ">=0.0.16"
# U... | 0 |
public_repos/opengpts | public_repos/opengpts/backend/README.md | # backend
| 0 |
public_repos/opengpts/backend | public_repos/opengpts/backend/app/server.py | from pathlib import Path
from typing import Annotated, Optional
import orjson
from fastapi import Cookie, FastAPI, Form, Request, UploadFile
from fastapi.staticfiles import StaticFiles
from gizmo_agent import agent, ingest_runnable
from langchain.schema.runnable import RunnableConfig
from langserve import add_routes
f... | 0 |
public_repos/opengpts/backend | public_repos/opengpts/backend/app/storage.py | import os
from datetime import datetime
import orjson
from langchain.schema.messages import messages_from_dict
from langchain.utilities.redis import get_client
from redis.client import Redis as RedisType
def assistants_list_key(user_id: str):
return f"opengpts:{user_id}:assistants"
def assistant_key(user_id: s... | 0 |
public_repos/opengpts/backend/packages | public_repos/opengpts/backend/packages/agent-executor/poetry.lock | # This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand.
[[package]]
name = "aiohttp"
version = "3.8.6"
description = "Async http client/server framework (asyncio)"
optional = false
python-versions = ">=3.6"
files = [
{file = "aiohttp-3.8.6-cp310-cp310-macosx_10_9_universal2.whl",... | 0 |
public_repos/opengpts/backend/packages | public_repos/opengpts/backend/packages/agent-executor/pyproject.toml | [tool.poetry]
name = "agent-executor"
version = "0.1.0"
description = ""
authors = [
"Lance Martin <lance@langchain.dev>",
]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.8.1"
langchain = ">=0.0.333"
python-magic = "^0.4.27"
[tool.poetry.group.dev.dependencies]
langchain-cli = ">=0.0.15"
[build-sy... | 0 |
public_repos/opengpts/backend/packages | public_repos/opengpts/backend/packages/agent-executor/README.md | # agent-executor
| 0 |
public_repos/opengpts/backend/packages/agent-executor | public_repos/opengpts/backend/packages/agent-executor/agent_executor/parsing.py | """Module contains logic for parsing binary blobs into text."""
from langchain.document_loaders.parsers import BS4HTMLParser, PDFMinerParser
from langchain.document_loaders.parsers.generic import MimeTypeBasedParser
from langchain.document_loaders.parsers.msword import MsWordParser
from langchain.document_loaders.parse... | 0 |
public_repos/opengpts/backend/packages/agent-executor | public_repos/opengpts/backend/packages/agent-executor/agent_executor/runnables.py | """Temporary code for RunnableBinding.
This is temporary code for Runnable Binding while it isn't available on released
LangChain.
"""
from __future__ import annotations
from typing import (
Any,
AsyncIterator,
Callable,
Iterator,
List,
Mapping,
Optional,
Sequence,
Type,
TypeVa... | 0 |
public_repos/opengpts/backend/packages/agent-executor | public_repos/opengpts/backend/packages/agent-executor/agent_executor/upload.py | """API to deal with file uploads via a runnable.
For now this code assumes that the content is a base64 encoded string.
The details here might change in the future.
For the time being, upload and ingestion are coupled
"""
from __future__ import annotations
from typing import Any, BinaryIO, List, Optional
from lang... | 0 |
public_repos/opengpts/backend/packages/agent-executor | public_repos/opengpts/backend/packages/agent-executor/agent_executor/history.py | from __future__ import annotations
import asyncio
from typing import Any, Callable, Dict, List, Optional, Sequence, Type
from langchain.callbacks.tracers.schemas import Run
from langchain.pydantic_v1 import BaseModel, create_model
from langchain.schema.chat_history import BaseChatMessageHistory
from langchain.schema.... | 0 |
public_repos/opengpts/backend/packages/agent-executor | public_repos/opengpts/backend/packages/agent-executor/agent_executor/__init__.py | from __future__ import annotations
import asyncio
import json
import logging
import time
from typing import (
Any,
AsyncIterator,
Callable,
Dict,
List,
Optional,
Sequence,
Tuple,
Union,
)
from langchain.agents.agent import ExceptionTool
from langchain.agents.tools import InvalidToo... | 0 |
public_repos/opengpts/backend/packages/agent-executor | public_repos/opengpts/backend/packages/agent-executor/agent_executor/ingest.py | """Code to ingest blob into a vectorstore.
Code is responsible for taking binary data, parsing it and then indexing it
into a vector store.
This code should be agnostic to how the blob got generated; i.e., it does not
know about server/uploading etc.
"""
from typing import List
from langchain.document_loaders import... | 0 |
public_repos/opengpts/backend/packages | public_repos/opengpts/backend/packages/gizmo-agent/poetry.lock | # This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand.
[[package]]
name = "aiofiles"
version = "23.2.1"
description = "File support for asyncio."
optional = false
python-versions = ">=3.7"
files = [
{file = "aiofiles-23.2.1-py3-none-any.whl", hash = "sha256:19297512c647d4b27a2cf... | 0 |
public_repos/opengpts/backend/packages | public_repos/opengpts/backend/packages/gizmo-agent/pyproject.toml | [tool.poetry]
name = "gizmo-agent"
version = "0.1.0"
description = ""
authors = [
"Lance Martin <lance@langchain.dev>",
]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.8.1"
langchain = ">=0.0.333"
openai = ">=0.5.0,<1.0"
anthropic = "^0.3.11"
langchain-experimental = "^0.0.37"
duckduckgo-search = "^... | 0 |
public_repos/opengpts/backend/packages | public_repos/opengpts/backend/packages/gizmo-agent/README.md | # gizmo-agent
| 0 |
public_repos/opengpts/backend/packages/gizmo-agent | public_repos/opengpts/backend/packages/gizmo-agent/gizmo_agent/main.py | import os
from functools import partial
from typing import Any, Mapping, Optional, Sequence
from agent_executor import AgentExecutor
from agent_executor.history import RunnableWithMessageHistory
from langchain.memory import RedisChatMessageHistory
from langchain.pydantic_v1 import BaseModel, Field
from langchain.schem... | 0 |
public_repos/opengpts/backend/packages/gizmo-agent | public_repos/opengpts/backend/packages/gizmo-agent/gizmo_agent/__init__.py | from gizmo_agent.ingest import ingest_runnable
from gizmo_agent.main import agent
__all__ = ["agent", "ingest_runnable"]
| 0 |
public_repos/opengpts/backend/packages/gizmo-agent | public_repos/opengpts/backend/packages/gizmo-agent/gizmo_agent/tools.py | from enum import Enum
from langchain.pydantic_v1 import BaseModel, Field
from langchain.retrievers import KayAiRetriever, PubMedRetriever, WikipediaRetriever
from langchain.retrievers.you import YouRetriever
from langchain.tools import ArxivQueryRun, DuckDuckGoSearchRun
from langchain.tools.retriever import create_ret... | 0 |
public_repos/opengpts/backend/packages/gizmo-agent | public_repos/opengpts/backend/packages/gizmo-agent/gizmo_agent/ingest.py | import os
from agent_executor.upload import IngestRunnable
from langchain.embeddings import OpenAIEmbeddings
from langchain.schema.runnable import ConfigurableField
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.vectorstores.redis import Redis
index_schema = {
"tag": [{"name": "... | 0 |
public_repos/opengpts/backend/packages/gizmo-agent/gizmo_agent | public_repos/opengpts/backend/packages/gizmo-agent/gizmo_agent/agent_types/openai.py | import os
from langchain.agents.format_scratchpad import format_to_openai_functions
from langchain.agents.output_parsers import OpenAIFunctionsAgentOutputParser
from langchain.chat_models import AzureChatOpenAI, ChatOpenAI
from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain.tools.rende... | 0 |
public_repos/opengpts/backend/packages/gizmo-agent/gizmo_agent | public_repos/opengpts/backend/packages/gizmo-agent/gizmo_agent/agent_types/__init__.py | from enum import Enum
from .openai import get_openai_function_agent
from .xml.agent import get_xml_agent
class GizmoAgentType(str, Enum):
GPT_35_TURBO = "GPT 3.5 Turbo"
# GPT_4 = "GPT 4"
AZURE_OPENAI = "GPT 4 (Azure OpenAI)"
CLAUDE2 = "Claude 2"
BEDROCK_CLAUDE2 = "Claude 2 (Amazon Bedrock)"
__a... | 0 |
public_repos/opengpts/backend/packages/gizmo-agent/gizmo_agent/agent_types | public_repos/opengpts/backend/packages/gizmo-agent/gizmo_agent/agent_types/xml/agent.py | import os
import boto3
from langchain.agents.format_scratchpad import format_xml
from langchain.chat_models import BedrockChat, ChatAnthropic
from langchain.schema.messages import AIMessage, HumanMessage
from langchain.tools.render import render_text_description
from .prompts import conversational_prompt, parse_outpu... | 0 |
public_repos/opengpts/backend/packages/gizmo-agent/gizmo_agent/agent_types | public_repos/opengpts/backend/packages/gizmo-agent/gizmo_agent/agent_types/xml/prompts.py | from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain.schema import AgentAction, AgentFinish
template = """{system_message}
You have access to the following tools:
{tools}
In order to use a tool, you can use <tool></tool> and <tool_input></tool_input> tags. You will then get back a re... | 0 |
public_repos/opengpts/backend/tests | public_repos/opengpts/backend/tests/unit_tests/conftest.py | import os
# Temporary handling of environment variables for testing
os.environ["REDIS_URL"] = "redis://localhost:6379/3"
os.environ["OPENAI_API_KEY"] = "test"
os.environ["YDC_API_KEY"] = "test"
| 0 |
public_repos/opengpts/backend/tests | public_repos/opengpts/backend/tests/unit_tests/utils.py | """Test ingestion utilities."""
from typing import Any, Dict, Iterable, List, Optional, Sequence, Type
from langchain.schema import Document
from langchain.schema.embeddings import Embeddings
from langchain.schema.vectorstore import VST, VectorStore
class InMemoryVectorStore(VectorStore):
"""In-memory implementa... | 0 |
public_repos/opengpts/backend/tests | public_repos/opengpts/backend/tests/unit_tests/test_imports.py | """Shallow tests that make sure we can at least import the code."""
import os
from pytest import MonkeyPatch
def test_redis_url_set() -> None:
"""Verify that the redis URL is set."""
if "REDIS_URL" not in os.environ:
raise AssertionError(
"REDIS_URL not set in environment. "
... | 0 |
public_repos/opengpts/backend/tests/unit_tests | public_repos/opengpts/backend/tests/unit_tests/app/test_app.py | """Test the server and client together."""
import os
from contextlib import asynccontextmanager
from typing import Optional, Sequence
import pytest
from httpx import AsyncClient
from langchain.utilities.redis import get_client as _get_redis_client
from redis.client import Redis as RedisType
from typing_extensions imp... | 0 |
public_repos/opengpts/backend/tests/unit_tests | public_repos/opengpts/backend/tests/unit_tests/agent_executor/test_upload.py | from io import BytesIO
from agent_executor.upload import IngestRunnable, _guess_mimetype
from langchain.text_splitter import RecursiveCharacterTextSplitter
from tests.unit_tests.fixtures import get_sample_paths
from tests.unit_tests.utils import InMemoryVectorStore
def test_ingestion_runnable() -> None:
"""Test... | 0 |
public_repos/opengpts/backend/tests/unit_tests | public_repos/opengpts/backend/tests/unit_tests/agent_executor/test_parsing.py | """Test parsing logic."""
import mimetypes
from agent_executor.parsing import MIMETYPE_BASED_PARSER, SUPPORTED_MIMETYPES
from langchain.document_loaders import Blob
from tests.unit_tests.fixtures import get_sample_paths
def test_list_of_supported_mimetypes() -> None:
"""This list should generally grow! Protecti... | 0 |
public_repos/opengpts/backend/tests/unit_tests | public_repos/opengpts/backend/tests/unit_tests/fixtures/sample.html | <html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><style type="text/css">.lst-kix_n6n0tzfwn8i8-5>li:before{content:"\0025a0 "}.lst-kix_n6n0tzfwn8i8-6>li:before{content:"\0025cf "}ul.lst-kix_n6n0tzfwn8i8-8{list-style-type:none}ul.lst-kix_n6n0tzfwn8i8-7{list-style-type:none}.lst-kix_n6n0t... | 0 |
public_repos/opengpts/backend/tests/unit_tests | public_repos/opengpts/backend/tests/unit_tests/fixtures/sample.txt | 🦜️ LangChain
Underline
Bold
Italics
Col 1
Col 2
Row 1
1
2
Row 2
3
4
Link: https://www.langchain.com/
* Item 1
* Item 2
* Item 3
* We also love cats 🐱
Image | 0 |
public_repos/opengpts/backend/tests/unit_tests | public_repos/opengpts/backend/tests/unit_tests/fixtures/sample.rtf | {\rtf1\ansi\ansicpg1252\uc0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deff0\adeff0{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f2\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}}{\colortbl;\red0\gr... | 0 |
public_repos/opengpts/backend/tests/unit_tests | public_repos/opengpts/backend/tests/unit_tests/fixtures/__init__.py | from pathlib import Path
from typing import List
HERE = Path(__file__).parent
# PUBLIC API
def get_sample_paths() -> List[Path]:
"""List all fixtures."""
return list(HERE.glob("sample.*"))
| 0 |
public_repos/opengpts/backend | public_repos/opengpts/backend/ui/index.html | <!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OpenGPTs</title>
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
<script typ... | 0 |
public_repos/opengpts/backend/ui | public_repos/opengpts/backend/ui/assets/index-2a70d776.js | var yx=Object.defineProperty;var wx=(e,t,n)=>t in e?yx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var bt=(e,t,n)=>(wx(e,typeof t!="symbol"?t+"":t,n),n),_x=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var Lf=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than ... | 0 |
public_repos/opengpts/backend/ui | public_repos/opengpts/backend/ui/assets/index-0a533f7b.css | *,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter var,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helveti... | 0 |
public_repos/opengpts | public_repos/opengpts/frontend/tailwind.config.js | /* eslint-disable no-undef */
/** @type {import('tailwindcss').Config} */
import defaultTheme from "tailwindcss/defaultTheme";
export default {
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {
fontFamily: {
sans: ["Inter var", ...defaultTheme.fontFamily.sans],
},
... | 0 |
public_repos/opengpts | public_repos/opengpts/frontend/yarn.lock | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@aashutoshrathi/word-wrap@^1.2.3":
version "1.2.6"
resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf"
integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A... | 0 |
public_repos/opengpts | public_repos/opengpts/frontend/tsconfig.json | {
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"iso... | 0 |
public_repos/opengpts | public_repos/opengpts/frontend/postcss.config.js | export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
| 0 |
public_repos/opengpts | public_repos/opengpts/frontend/index.html | <!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OpenGPTs</title>
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
</head>
<bo... | 0 |
public_repos/opengpts | public_repos/opengpts/frontend/README.md | # React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.i... | 0 |
public_repos/opengpts | public_repos/opengpts/frontend/.eslintrc.cjs | module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rule... | 0 |
public_repos/opengpts | public_repos/opengpts/frontend/vite.config.ts | import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
server: {
proxy: {
"^/(config_schema|input_schema|stream|assistants|threads|ingest|feedback)":
{
target: "http://127.0.0.1:8100"... | 0 |
public_repos/opengpts | public_repos/opengpts/frontend/tsconfig.node.json | {
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
| 0 |
public_repos/opengpts | public_repos/opengpts/frontend/package.json | {
"name": "frontend",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@headlessui/react"... | 0 |
public_repos/opengpts/frontend | public_repos/opengpts/frontend/src/vite-env.d.ts | /// <reference types="vite/client" />
| 0 |
public_repos/opengpts/frontend | public_repos/opengpts/frontend/src/App.tsx | import { useCallback, useMemo, useState } from "react";
import { InformationCircleIcon } from "@heroicons/react/24/outline";
import { Chat } from "./components/Chat";
import { ChatList } from "./components/ChatList";
import { Layout } from "./components/Layout";
import { NewChat } from "./components/NewChat";
import { ... | 0 |
public_repos/opengpts/frontend | public_repos/opengpts/frontend/src/main.tsx | import ReactDOM from "react-dom/client";
import App from "./App.tsx";
import "./index.css";
if (document.cookie.indexOf("user_id") === -1) {
document.cookie = `opengpts_user_id=${crypto.randomUUID()}`;
}
ReactDOM.createRoot(document.getElementById("root")!).render(<App />);
| 0 |
public_repos/opengpts/frontend | public_repos/opengpts/frontend/src/index.css | @tailwind base;
@tailwind components;
@tailwind utilities;
html, body, #root {
height: 100%;
}
body {
background: #f5f5f5;
}
| 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/utils/cn.ts | import clsx from "clsx";
import { ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
| 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/utils/simplifySchema.ts | /* eslint-disable @typescript-eslint/no-explicit-any */
import { JsonRefs } from "./json-refs";
// jsonforms doesn't support schemas with root $ref
// so we resolve root $ref and replace it with the actual schema
export function simplifySchema(schema: any) {
return JsonRefs.resolveRefs(schema).then((r: any) => r.res... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/utils/json-refs.d.ts | /* eslint-disable @typescript-eslint/no-explicit-any */
export const JsonRefs: {
resolveRefs(schema: any): Promise<{ resolved: any }>;
};
| 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/utils/str.ts | export function str(o: unknown): React.ReactNode {
return typeof o === "object"
? JSON.stringify(o, null, 2)
: (o as React.ReactNode);
}
| 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/utils/defaults.ts | // (c) 2015 Chute Corporation. Released under the terms of the MIT License.
// Modified to use TypeScript and handle edge cases with tuples
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable no-prototype-builtins */
"use strict";
/**
* check whether item is plain object
* @param {*} item
* ... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/utils/json-refs.js | // Original source: https://github.com/whitlockjc/json-refs/blob/master/dist/json-refs-min.js
export const JsonRefs = (function (t) {
var n = {};
function r(e) {
if (n[e]) return n[e].exports;
var o = (n[e] = { i: e, l: !1, exports: {} });
return t[e].call(o.exports, o, o.exports, r), (o.l = !0), o.exp... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/components/Chat.tsx | import { useEffect } from "react";
import { Chat as ChatType } from "../hooks/useChatList";
import { StreamStateProps } from "../hooks/useStreamState";
import { useChatMessages } from "../hooks/useChatMessages";
import TypingBox from "./TypingBox";
import { Message } from "./Message";
interface ChatProps extends Pick<... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/components/NewChat.tsx | import { ConfigList } from "./ConfigList";
import { Schemas } from "../hooks/useSchemas";
import TypingBox from "./TypingBox";
import { Config } from "./Config";
import { ConfigListProps } from "../hooks/useConfigList";
interface NewChatProps extends ConfigListProps {
configSchema: Schemas["configSchema"];
configD... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/components/FileUpload.tsx | import { useMemo } from "react";
import { DropzoneState } from "react-dropzone";
import { XCircleIcon } from "@heroicons/react/24/outline";
const baseStyle = {
flex: 1,
display: "flex",
flexDirection: "column",
alignItems: "center",
padding: "20px",
borderWidth: 2,
borderRadius: 2,
borderColor: "#eeeee... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/components/ConfigList.tsx | import { PlusIcon } from "@heroicons/react/24/outline";
import { Config, ConfigListProps } from "../hooks/useConfigList";
import { cn } from "../utils/cn";
function ConfigItem(props: {
config: Config;
currentConfig: ConfigListProps["currentConfig"];
enterConfig: ConfigListProps["enterConfig"];
}) {
return (
... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/components/LangSmithActions.tsx | import {
HandThumbDownIcon,
HandThumbUpIcon,
EllipsisHorizontalIcon,
CheckIcon,
} from "@heroicons/react/24/outline";
import { useState } from "react";
export function LangSmithActions(props: { runId: string }) {
const [state, setState] = useState<{
score: number;
inflight: boolean;
} | null>(null)... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/components/Message.tsx | import { useState } from "react";
import { Message as MessageType } from "../hooks/useChatList";
import { str } from "../utils/str";
import { cn } from "../utils/cn";
import { marked } from "marked";
import DOMPurify from "dompurify";
import { ChevronDownIcon } from "@heroicons/react/24/outline";
import { LangSmithActi... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/components/Config.tsx | import { useEffect, useState } from "react";
import { marked } from "marked";
import { ShareIcon } from "@heroicons/react/24/outline";
import { useDropzone } from "react-dropzone";
import { ConfigListProps } from "../hooks/useConfigList";
import { SchemaField, Schemas } from "../hooks/useSchemas";
import { cn } from "... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/components/TypingBox.tsx | import {
PaperAirplaneIcon,
ChatBubbleLeftIcon,
} from "@heroicons/react/20/solid";
import { cn } from "../utils/cn";
import { useState } from "react";
export default function TypingBox(props: {
onSubmit: (message: string) => Promise<void>;
disabled?: boolean;
}) {
const [inflight, setInflight] = useState(fa... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/components/Layout.tsx | import { Fragment } from "react";
import { Dialog, Transition } from "@headlessui/react";
import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/outline";
export function Layout(props: {
sidebarOpen: boolean;
setSidebarOpen: (open: boolean) => void;
sidebar: React.ReactNode;
children: React.ReactNode;
sub... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/components/ChatList.tsx | import { PlusIcon } from "@heroicons/react/24/outline";
import { ChatListProps } from "../hooks/useChatList";
import { cn } from "../utils/cn";
export function ChatList(props: {
chats: ChatListProps["chats"];
currentChat: ChatListProps["currentChat"];
enterChat: ChatListProps["enterChat"];
}) {
return (
<... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/hooks/useChatList.ts | import { useCallback, useEffect, useReducer, useState } from "react";
import orderBy from "lodash/orderBy";
export interface Message {
type: string;
content: string;
name?: string;
additional_kwargs?: {
function_call?: {
name?: string;
arguments?: string;
};
};
example: boolean;
}
expo... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/hooks/useStreamState.tsx | import { useCallback, useState } from "react";
import { fetchEventSource } from "@microsoft/fetch-event-source";
import { Message } from "./useChatList";
export interface StreamState {
status: "inflight" | "error" | "done";
messages: Message[];
run_id?: string;
}
export interface StreamStateProps {
stream: St... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/hooks/useStatePersist.tsx | import React, { useEffect, useState } from "react";
const PREFIX = "langgizmo-";
export function useStatePersist<T>(
defaultValue: T,
key: string
): [T, React.Dispatch<React.SetStateAction<T>>] {
const [state, setState] = useState<T>(() => {
const storageValue = localStorage.getItem(PREFIX + key);
if (... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/hooks/useSchemas.ts | import { useEffect, useState } from "react";
import { simplifySchema } from "../utils/simplifySchema";
import { getDefaults } from "../utils/defaults";
export interface SchemaField {
type: string;
title: string;
description: string;
enum?: string[];
items?: SchemaField;
allOf?: SchemaField[];
}
export int... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/hooks/useChatMessages.ts | import { useEffect, useMemo, useState } from "react";
import { Message } from "./useChatList";
import { StreamState } from "./useStreamState";
// const MESSAGES_SEEN = new WeakSet<Message>();
async function getMessages(threadId: string) {
const { messages } = await fetch(`/threads/${threadId}/messages`, {
heade... | 0 |
public_repos/opengpts/frontend/src | public_repos/opengpts/frontend/src/hooks/useConfigList.ts | import { useCallback, useEffect, useReducer, useState } from "react";
import orderBy from "lodash/orderBy";
export interface Config {
assistant_id: string;
name: string;
updated_at: string;
config: {
configurable?: {
[key: string]: unknown;
};
};
public: boolean;
mine?: boolean;
}
export i... | 0 |
public_repos | public_repos/langsmith-cookbook/README.md | # LangSmith Cookbook
Welcome to the LangSmith Cookbook — your practical guide to mastering [LangSmith](https://smith.langchain.com/). While our [standard documentation](https://docs.smith.langchain.com/) covers the basics, this repository delves into common patterns and some real-world use-cases, empowering you to opt... | 0 |
public_repos/langsmith-cookbook | public_repos/langsmith-cookbook/typescript-testing-examples/README.md | ---
sidebar_label: TS Evaluation
sidebar_position: 5
---
# JavaScript Testing & Evaluation Examples
Incorporate LangSmith into your TS/JS testing and evaluation workflow:
- [Evaluating JS Chains in Python](./eval-in-python/): evaluate JS chains using custom python evaluators, adapting methods from the "[Evaluating Ex... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples | public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python/requirements.txt | langchain
langsmith
rapidfuzz | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples | public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python/tsconfig.json | {
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable co... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples | public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python/jest.config.js | // jest.config.js
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
| 0 |
public_repos/langsmith-cookbook/typescript-testing-examples | public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python/package-lock.json | {
"name": "eval-in-python",
"version": "0.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "eval-in-python",
"version": "0.0.1",
"license": "MIT",
"dependencies": {
"langchain": "^0.0.146",
"langsmith": "^0.0.35"
},
"devDependenc... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples | public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python/README.md | # Evaluating JS Chains in Python
[](https://github.com/langchain-ai/langsmith-cookbook/tree/main/./typescript-testing-examples/eval-in-python/README.md)
This walkthrough is directed towards anyone using the LangChainJS package who wants to... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples | public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python/package.json | {
"name": "eval-in-python",
"version": "0.0.1",
"description": "An example running a js chain on a dataset and then running evals in python.",
"main": "index.js",
"scripts": {
"test": "jest && python py/evaluate_project.py"
},
"keywords": [
"LangSmith",
"Jest",
"Feedback",
"Test"
],
... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python | public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python/src/index.ts | import {
ChatPromptTemplate,
HumanMessagePromptTemplate,
SystemMessagePromptTemplate,
} from "langchain/prompts";
import { ChatOpenAI } from "langchain/chat_models/openai";
import { StringOutputParser } from "langchain/schema/output_parser";
/**
* Returns a chain that prompts the user to write a rap battle res... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python | public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python/py/evaluate_project.py | """An example script to evaluate an existing test project."""
import json
import os
from typing import Optional
from langchain import evaluation
from langchain.schema import runnable
from langsmith import Client
from langsmith.evaluation import EvaluationResult, RunEvaluator
from langsmith.schemas import Example, Run... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python | public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python/py/upload_dataset.py | """Upload the dataset to the server."""
from langsmith import Client
if __name__ == "__main__":
dataset_name = "Structured Output Example"
examples = [
{
"input": "I am a person named John.",
"output": {
"name": "John",
"type": "person",
... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python | public_repos/langsmith-cookbook/typescript-testing-examples/eval-in-python/tests/index.test.ts | import { Client } from "langsmith";
import { Example } from "langsmith/schemas";
import { LangChainTracer } from "langchain/callbacks";
import { getChain } from "../src/index";
function getConfigs(examples: Example[], projectName?: string) {
return examples.map((example) => {
return {
callbacks: [new LangC... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples | public_repos/langsmith-cookbook/typescript-testing-examples/simple-test/tsconfig.json | {
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable co... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples | public_repos/langsmith-cookbook/typescript-testing-examples/simple-test/jest.config.js | // jest.config.js
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
| 0 |
public_repos/langsmith-cookbook/typescript-testing-examples | public_repos/langsmith-cookbook/typescript-testing-examples/simple-test/package-lock.json | {
"name": "simple-test",
"version": "0.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "simple-test",
"version": "0.0.1",
"license": "MIT",
"dependencies": {
"langchain": "^0.0.146",
"langsmith": "^0.0.35"
},
"devDependencies": ... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples | public_repos/langsmith-cookbook/typescript-testing-examples/simple-test/README.md | # Logging Assertions as Feedback
[](https://github.com/langchain-ai/langsmith-cookbook/tree/main/./typescript-testing-examples/simple-test/README.md)
This walkthrough shows a lightweight way to begin using LangSmith feedback in TypeScript,... | 0 |
public_repos/langsmith-cookbook/typescript-testing-examples | public_repos/langsmith-cookbook/typescript-testing-examples/simple-test/package.json | {
"name": "simple-test",
"version": "0.0.1",
"description": "A simple example adding langsmith feedback to an existing Jest test.",
"main": "index.js",
"scripts": {
"test": "jest"
},
"keywords": [
"LangSmith",
"Jest",
"Feedback",
"Evaluate"
],
"author": "William Fu-Hinthorn <suppor... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.