index
int64
0
0
repo_id
stringclasses
596 values
file_path
stringlengths
31
168
content
stringlengths
1
6.2M
0
lc_public_repos
lc_public_repos/langchain-extract/docker-compose.yml
name: langchain-extract services: postgres: # Careful if bumping postgres version. # Make sure to keep in sync with CI # version if being tested on CI. image: postgres:16 expose: - "5432" ports: - "5432:5432" environment: POSTGRES_DB: langchain POSTGRES_USER: langc...
0
lc_public_repos
lc_public_repos/langchain-extract/Dockerfile
# All directory paths for COPY commands are relative to the build context # Ensure this python version stays in sync with CI FROM python:3.11-slim as base WORKDIR /backend # set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 ENV POETRY_HOME="/opt/poetry" ENV MYPYPATH="/app/src/stubs" # Us...
0
lc_public_repos
lc_public_repos/langchain-extract/LICENSE
MIT License Copyright (c) 2024-Present Langchain AI 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, publi...
0
lc_public_repos
lc_public_repos/langchain-extract/README.md
🚧 Under Active Development 🚧 This repo is under active developments. Do not use code from `main`. Instead please checkout code from [releases](https://github.com/langchain-ai/langchain-extract/releases) This repository is not a library, but a jumping point for your own application -- so do not be surprised to find ...
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/frontend/Dockerfile
FROM node:18-alpine AS base FROM base AS base-deps WORKDIR /app COPY --link ./yarn.lock ./package.json ./.yarnrc.yml ./ FROM base AS installer WORKDIR /app COPY --link --from=base-deps /app/package.json ./package.json COPY --link --from=base-deps /app/yarn.lock ./yarn.lock COPY --link .yarnrc.yml . RUN yarn install...
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/frontend/tsconfig.json
{ "compilerOptions": { "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "node", "resol...
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/frontend/yarn.lock
# This file is generated by running "yarn install" inside your project. # Manual changes might be lost - proceed with caution! __metadata: version: 6 cacheKey: 8 "@aashutoshrathi/word-wrap@npm:^1.2.3": version: 1.2.6 resolution: "@aashutoshrathi/word-wrap@npm:1.2.6" checksum: ada901b9e7c680d190f1d012c84217c...
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/frontend/.eslintrc.json
{ "plugins": ["react", "@typescript-eslint", "eslint-plugin-import"], "env": { "es2021": true, "commonjs": true, "es6": true, "node": true, "browser": true }, "globals": { "window": true, "process": true }, "extends": [ "plugin:react/recommended", "plugin:react/jsx-runtim...
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/frontend/.yarnrc.yml
nodeLinker: node-modules
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/frontend/.env.example
# Only set for non development builds. # Development builds default to `http://localhost:8000` NEXT_PUBLIC_BASE_API_URL=https://example.com
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/frontend/package.json
{ "name": "langchain-extract-frontend", "version": "0.1.0", "private": true, "packageManager": "yarn@1.22.19", "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "format": "prettier --write .", "format:check": "prettier --config .prettierrc --check \"app\"", ...
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/frontend/tailwind.config.ts
import type { Config } from "tailwindcss"; const config: Config = { content: [ "./pages/**/*.{js,ts,jsx,tsx,mdx}", "./components/**/*.{js,ts,jsx,tsx,mdx}", "./app/**/*.{js,ts,jsx,tsx,mdx}", ], theme: { extend: { backgroundImage: { "gradient-radial": "radial-gradient(var(--tw-gradien...
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/frontend/postcss.config.js
module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, }, };
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/frontend/.prettierrc
{ "endOfLine": "lf" }
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/frontend/next.config.js
/** @type {import('next').NextConfig} */ const nextConfig = {}; module.exports = nextConfig;
0
lc_public_repos/langchain-extract/frontend
lc_public_repos/langchain-extract/frontend/app/globals.css
@tailwind base; @tailwind components; @tailwind utilities;
0
lc_public_repos/langchain-extract/frontend
lc_public_repos/langchain-extract/frontend/app/layout.tsx
import "./globals.css"; import { ReactNode } from "react"; import type { Metadata } from "next"; import { Inter } from "next/font/google"; import { Sidebar } from "./components/Sidebar"; import { Providers } from "./providers"; const inter = Inter({ subsets: ["latin"] }); export const metadata: Metadata = { title: ...
0
lc_public_repos/langchain-extract/frontend
lc_public_repos/langchain-extract/frontend/app/page.tsx
"use client"; import CreateExtractor from "./components/CreateExtractor"; export default CreateExtractor;
0
lc_public_repos/langchain-extract/frontend
lc_public_repos/langchain-extract/frontend/app/providers.tsx
"use client"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { ChakraProvider } from "@chakra-ui/react"; const queryClient = new QueryClient(); export function Providers({ children }: { children: React.ReactNode }) { return ( <QueryClientProvider client={queryClient}> <C...
0
lc_public_repos/langchain-extract/frontend/app/e
lc_public_repos/langchain-extract/frontend/app/e/[extractorId]/page.tsx
"use client"; import { Playground } from "../../components/Playground"; interface ExtractorPageProps { params: { extractorId: string; }; } export default function Page({ params }: ExtractorPageProps) { return <Playground extractorId={params.extractorId} isShared={false} />; }
0
lc_public_repos/langchain-extract/frontend/app
lc_public_repos/langchain-extract/frontend/app/utils/api.tsx
"use client"; /* Expose API hooks for use in components */ import axios from "axios"; import { useQuery, useQueryClient, useMutation, MutationFunction, QueryFunctionContext, } from "@tanstack/react-query"; import { v4 as uuidv4 } from "uuid"; import { getBaseApiUrl } from "./api_url"; type ExtractorData = { ...
0
lc_public_repos/langchain-extract/frontend/app
lc_public_repos/langchain-extract/frontend/app/utils/api_url.ts
export const getBaseApiUrl = () => { if (process.env.NODE_ENV === "development") { return "http://localhost:8000"; } if (!process.env.NEXT_PUBLIC_BASE_API_URL) { throw new Error( "NEXT_PUBLIC_BASE_API_URL must be set if not in development.", ); } return process.env.NEXT_PUBLIC_BASE_API_URL; ...
0
lc_public_repos/langchain-extract/frontend/app
lc_public_repos/langchain-extract/frontend/app/components/CreateExtractor.tsx
"use client"; import { AbsoluteCenter, Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, Badge, Box, Button, Card, CardBody, CircularProgress, Divider, FormControl, Heading, Icon, IconButton, Input, Text, } from "@chakra-ui/react"; import { json } from "@co...
0
lc_public_repos/langchain-extract/frontend/app
lc_public_repos/langchain-extract/frontend/app/components/Sidebar.tsx
"use client"; import { Button, Link as ChakraLink, Divider, Flex, Icon, IconButton, Menu, MenuButton, MenuItem, MenuList, Spacer, Text, VStack, useDisclosure, } from "@chakra-ui/react"; import React from "react"; import { ArrowTopRightOnSquareIcon, EllipsisVerticalIcon, PencilSquareIc...
0
lc_public_repos/langchain-extract/frontend/app
lc_public_repos/langchain-extract/frontend/app/components/Playground.tsx
"use client"; import { Button, Heading, Tab, Box, Divider, AbsoluteCenter, TabList, TabPanel, TabPanels, Tabs, Text, Textarea, FormControl, FormLabel, HStack, Radio, RadioGroup, } from "@chakra-ui/react"; import { useMutation } from "@tanstack/react-query"; import React from "react"; i...
0
lc_public_repos/langchain-extract/frontend/app
lc_public_repos/langchain-extract/frontend/app/components/ShareModal.tsx
import { Modal, ModalContent, ModalHeader, ModalFooter, ModalBody, ModalOverlay, Text, Input, ModalCloseButton, useClipboard, Flex, Button, } from "@chakra-ui/react"; interface ShareModalProps { shareUUID: string; isOpen: boolean; onClose: () => void; } export function ShareModal(props: ...
0
lc_public_repos/langchain-extract/frontend/app
lc_public_repos/langchain-extract/frontend/app/components/ResultsTable.tsx
import { Spinner, Table, TableCaption, TableContainer, Tbody, Td, Th, Thead, Tr, } from "@chakra-ui/react"; import { ExtractionResponse } from "../utils/api"; function isRecord(value: unknown): value is Record<string, unknown> { return typeof value === "object" && value !== null; } function getCo...
0
lc_public_repos/langchain-extract/frontend/app
lc_public_repos/langchain-extract/frontend/app/components/Extractor.tsx
"use client"; import { Tab, TabList, TabPanel, TabPanels, Tabs, Text, } from "@chakra-ui/react"; import Form from "@rjsf/chakra-ui"; import validator from "@rjsf/validator-ajv8"; import { docco } from "react-syntax-highlighter/dist/esm/styles/hljs"; import SyntaxHighlighter from "react-syntax-highlighter"...
0
lc_public_repos/langchain-extract/frontend/app/s
lc_public_repos/langchain-extract/frontend/app/s/[sharedExtractorId]/page.tsx
"use client"; import { Playground } from "../../components/Playground"; interface ExtractorPageProps { params: { sharedExtractorId: string; }; } export default function Page({ params }: ExtractorPageProps) { return <Playground extractorId={params.sharedExtractorId} isShared={true} />; }
0
lc_public_repos/langchain-extract/frontend/app
lc_public_repos/langchain-extract/frontend/app/new/page.tsx
import CreateExtractor from "../components/CreateExtractor"; export default CreateExtractor;
0
lc_public_repos/langchain-extract/frontend/public
lc_public_repos/langchain-extract/frontend/public/images/github-mark.svg
<svg width="98" height="96" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.01...
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/docs/Makefile
# Minimal makefile for Sphinx documentation # # You can set these variables from the command line, and also # from the environment for the first two. SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build SOURCEDIR = source BUILDDIR = build # Put it first so that "make" without argument is like "make help". help: @...
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/docs/make.bat
@ECHO OFF pushd %~dp0 REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set SOURCEDIR=source set BUILDDIR=build %SPHINXBUILD% >NUL 2>NUL if errorlevel 9009 ( echo. echo.The 'sphinx-build' command was not found. Make sure you have Sphinx echo.installed, then set ...
0
lc_public_repos/langchain-extract/docs
lc_public_repos/langchain-extract/docs/source/conf.py
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
0
lc_public_repos/langchain-extract/docs
lc_public_repos/langchain-extract/docs/source/toc.segment
```{toctree} :maxdepth: 2 :caption: Introduction ./notebooks/getting_started ```
0
lc_public_repos/langchain-extract/docs/source
lc_public_repos/langchain-extract/docs/source/notebooks/quick_start.ipynb
from langserve import RemoteRunnablefrom typing import Optional, List from pydantic import BaseModel, Field class Person(BaseModel): age: Optional[int] = Field(None, description="The age of the person in years.") name: Optional[str] = Field(None, description="The name of the person.")runnable = RemoteRunnable(...
0
lc_public_repos/langchain-extract/docs/source
lc_public_repos/langchain-extract/docs/source/notebooks/earnings_call_example.ipynb
import requests url = "http://localhost:8000"# Uber transcripts from earnings calls and other events at https://investor.uber.com/news-events/default.aspx pdf_url = "https://s23.q4cdn.com/407969754/files/doc_earnings/2023/q4/transcript/Uber-Q4-23-Prepared-Remarks.pdf"# Get PDF bytes pdf_response = requests.get(pdf_u...
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/backend/Dockerfile
# All directory paths for COPY commands are relative to the build context # Ensure this python version stays in sync with CI FROM python:3.11-slim as base WORKDIR /backend # set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 ENV POETRY_HOME="/opt/poetry" ENV MYPYPATH="/app/src/stubs" # Us...
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/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: poetry run pytest --disable-socket --allow-unix-socket $(T...
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/backend/poetry.lock
# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "accessible-pygments" version = "0.0.4" description = "A collection of accessible pygments styles" optional = false python-versions = "*" files = [ {file = "accessible-pygments-0.0.4.tar.gz", hash = "sha25...
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/backend/README.md
See readme at repo root.
0
lc_public_repos/langchain-extract
lc_public_repos/langchain-extract/backend/pyproject.toml
[tool.poetry] name = "langchain-extract" version = "0.0.1" description = "Sample extraction backend." authors = ["LangChain AI"] license = "MIT" readme = "README.md" [tool.poetry.dependencies] python = "^3.8.1" langchain = "~0.1" langsmith = ">=0.0.66" fastapi = "^0.109.2" langserve = "^0.0.45" uvicorn = "^0.27.1" pyd...
0
lc_public_repos/langchain-extract/backend
lc_public_repos/langchain-extract/backend/db/models.py
import uuid from datetime import datetime from typing import Generator from sqlalchemy import ( Column, DateTime, ForeignKey, String, Text, UniqueConstraint, create_engine, ) from sqlalchemy.dialects.postgresql import JSONB, UUID from sqlalchemy.ext.declarative import declarative_base from ...
0
lc_public_repos/langchain-extract/backend
lc_public_repos/langchain-extract/backend/extraction/parsing.py
"""Convert binary input to blobs and parse them using the appropriate parser.""" from __future__ import annotations from typing import BinaryIO, List from fastapi import HTTPException from langchain.document_loaders.parsers import BS4HTMLParser, PDFMinerParser from langchain.document_loaders.parsers.generic import Mi...
0
lc_public_repos/langchain-extract/backend
lc_public_repos/langchain-extract/backend/extraction/utils.py
"""Adapters to convert between different formats.""" from __future__ import annotations from langchain_core.utils.json_schema import dereference_refs def _rm_titles(kv: dict) -> dict: """Remove titles from a dictionary.""" new_kv = {} for k, v in kv.items(): if k == "title": continue ...
0
lc_public_repos/langchain-extract/backend
lc_public_repos/langchain-extract/backend/tests/db.py
"""Utility code that sets up a test database and client for tests.""" from contextlib import asynccontextmanager from typing import Generator from httpx import AsyncClient from sqlalchemy import URL, create_engine from sqlalchemy.orm import sessionmaker from db.models import Base, get_session from server.main import ...
0
lc_public_repos/langchain-extract/backend/tests
lc_public_repos/langchain-extract/backend/tests/integration_tests/test_extraction.py
"""Makes it easy to run an integration tests using a real chat model.""" from contextlib import asynccontextmanager from typing import Optional import httpx from fastapi import FastAPI from httpx import AsyncClient from langchain_core.pydantic_v1 import BaseModel from server.main import app @asynccontextmanager asy...
0
lc_public_repos/langchain-extract/backend/tests
lc_public_repos/langchain-extract/backend/tests/unit_tests/test_validators.py
import pytest from server.validators import validate_json_schema def test_validate_json_schema() -> None: """Test validate_json_schema.""" # TODO: Validate more extensively to make sure that it actually validates # the schema as expected. with pytest.raises(Exception): validate_json_schema({"...
0
lc_public_repos/langchain-extract/backend/tests
lc_public_repos/langchain-extract/backend/tests/unit_tests/test_parsing.py
"""Test parsing logic.""" import mimetypes from langchain.document_loaders import Blob from extraction.parsing import ( MIMETYPE_BASED_PARSER, SUPPORTED_MIMETYPES, ) from tests.unit_tests.fixtures import get_sample_paths def test_list_of_accepted_mimetypes() -> None: """This list should generally grow! ...
0
lc_public_repos/langchain-extract/backend/tests
lc_public_repos/langchain-extract/backend/tests/unit_tests/test_deduplication.py
from server.extraction_runnable import ExtractResponse, deduplicate async def test_deduplication_different_results() -> None: """Test deduplication of extraction results.""" result = deduplicate( [ {"data": [{"name": "Chester", "age": 42}]}, {"data": [{"name": "Jane", "age": 42...
0
lc_public_repos/langchain-extract/backend/tests
lc_public_repos/langchain-extract/backend/tests/unit_tests/utils.py
from contextlib import asynccontextmanager from typing import Optional import httpx from fastapi import FastAPI from httpx import AsyncClient @asynccontextmanager async def get_async_test_client( server: FastAPI, *, path: Optional[str] = None, raise_app_exceptions: bool = True ) -> AsyncClient: """Get an asy...
0
lc_public_repos/langchain-extract/backend/tests
lc_public_repos/langchain-extract/backend/tests/unit_tests/conftest.py
import os os.environ["OPENAI_API_KEY"] = "placeholder" os.environ["FIREWORKS_API_KEY"] = "placeholder" os.environ["TOGETHER_API_KEY"] = "placeholder"
0
lc_public_repos/langchain-extract/backend/tests
lc_public_repos/langchain-extract/backend/tests/unit_tests/test_upload.py
from extraction.parsing import _guess_mimetype from tests.unit_tests.fixtures import get_sample_paths async def test_mimetype_guessing() -> None: """Verify mimetype guessing for all fixtures.""" name_to_mime = {} for file in sorted(get_sample_paths()): data = file.read_bytes() name_to_mime...
0
lc_public_repos/langchain-extract/backend/tests
lc_public_repos/langchain-extract/backend/tests/unit_tests/test_utils.py
from langchain.pydantic_v1 import BaseModel, Field from langchain_core.messages import AIMessage from extraction.utils import update_json_schema from server.extraction_runnable import ExtractionExample, _make_prompt_template def test_update_json_schema() -> None: """Test updating JSON schema.""" class Perso...
0
lc_public_repos/langchain-extract/backend/tests/unit_tests
lc_public_repos/langchain-extract/backend/tests/unit_tests/api/test_api_extract.py
"""Code to test API endpoints.""" import tempfile from unittest.mock import patch from uuid import UUID, uuid4 from langchain.text_splitter import CharacterTextSplitter from langchain_community.embeddings import FakeEmbeddings from langchain_core.runnables import RunnableLambda from tests.db import get_async_client ...
0
lc_public_repos/langchain-extract/backend/tests/unit_tests
lc_public_repos/langchain-extract/backend/tests/unit_tests/api/test_api_configuration.py
from tests.db import get_async_client async def test_configuration_api() -> None: """Test the configuration API.""" async with get_async_client() as client: response = await client.get("/configuration") assert response.status_code == 200 result = response.json() assert isinstan...
0
lc_public_repos/langchain-extract/backend/tests/unit_tests
lc_public_repos/langchain-extract/backend/tests/unit_tests/api/test_api_defining_extractors.py
"""Code to test API endpoints.""" import uuid from tests.db import get_async_client async def test_extractors_api() -> None: """This will test a few of the extractors API endpoints.""" # First verify that the database is empty async with get_async_client() as client: user_id = str(uuid.uuid4()) ...
0
lc_public_repos/langchain-extract/backend/tests/unit_tests
lc_public_repos/langchain-extract/backend/tests/unit_tests/api/test_api_examples.py
"""Code to test API endpoints.""" import uuid from tests.db import get_async_client async def _list_extractors() -> list: async with get_async_client() as client: response = await client.get("/extractors") assert response.status_code == 200 return response.json() async def test_examples...
0
lc_public_repos/langchain-extract/backend/tests/unit_tests
lc_public_repos/langchain-extract/backend/tests/unit_tests/fake/chat_model.py
"""Fake Chat Model wrapper for testing purposes.""" from typing import Any, Iterator, List, Optional from langchain_core.callbacks.manager import ( CallbackManagerForLLMRun, ) from langchain_core.language_models.chat_models import BaseChatModel from langchain_core.messages import ( AIMessage, BaseMessage, ...
0
lc_public_repos/langchain-extract/backend/tests/unit_tests
lc_public_repos/langchain-extract/backend/tests/unit_tests/fake/test_fake_chat_model.py
"""Tests for verifying that testing utility code works as expected.""" from itertools import cycle from langchain_core.messages import AIMessage from tests.unit_tests.fake.chat_model import GenericFakeChatModel class AnyStr(str): def __init__(self) -> None: super().__init__() def __eq__(self, other...
0
lc_public_repos/langchain-extract/backend/tests/unit_tests
lc_public_repos/langchain-extract/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
lc_public_repos/langchain-extract/backend/tests/unit_tests
lc_public_repos/langchain-extract/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
lc_public_repos/langchain-extract/backend/tests/unit_tests
lc_public_repos/langchain-extract/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
lc_public_repos/langchain-extract/backend/tests/unit_tests
lc_public_repos/langchain-extract/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
lc_public_repos/langchain-extract/backend
lc_public_repos/langchain-extract/backend/server/models.py
import os from typing import Optional from langchain_anthropic import ChatAnthropic from langchain_core.language_models.chat_models import BaseChatModel from langchain_fireworks import ChatFireworks from langchain_groq import ChatGroq from langchain_openai import ChatOpenAI def get_supported_models(): """Get mod...
0
lc_public_repos/langchain-extract/backend
lc_public_repos/langchain-extract/backend/server/main.py
"""Entry point into the server.""" import logging import os from pathlib import Path from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from fastapi.staticfiles import StaticFiles from langserve import add_routes from server.api import configurables, examples, extract, extractors, shared, ...
0
lc_public_repos/langchain-extract/backend
lc_public_repos/langchain-extract/backend/server/validators.py
from typing import Any, Dict from fastapi import HTTPException from jsonschema import exceptions from jsonschema.validators import Draft202012Validator def validate_json_schema(schema: Dict[str, Any]) -> None: """Validate a JSON schema.""" try: Draft202012Validator.check_schema(schema) except exc...
0
lc_public_repos/langchain-extract/backend
lc_public_repos/langchain-extract/backend/server/settings.py
from __future__ import annotations import os from sqlalchemy.engine import URL def get_postgres_url() -> URL: if "INSTANCE_UNIX_SOCKET" in os.environ: return URL.create( drivername="postgresql+psycopg2", username=os.environ.get("PG_USER", "langchain"), password=os.env...
0
lc_public_repos/langchain-extract/backend
lc_public_repos/langchain-extract/backend/server/extraction_runnable.py
from __future__ import annotations import json import uuid from typing import Any, Dict, List, Optional, Sequence from fastapi import HTTPException from jsonschema import Draft202012Validator, exceptions from langchain.text_splitter import TokenTextSplitter from langchain_core.messages import AIMessage, HumanMessage,...
0
lc_public_repos/langchain-extract/backend
lc_public_repos/langchain-extract/backend/server/retrieval.py
from operator import itemgetter from typing import Any, Dict, List, Optional from langchain.text_splitter import CharacterTextSplitter from langchain_community.vectorstores import FAISS from langchain_core.runnables import RunnableLambda from langchain_openai import OpenAIEmbeddings from db.models import Extractor fr...
0
lc_public_repos/langchain-extract/backend/server
lc_public_repos/langchain-extract/backend/server/api/suggest.py
"""Module to handle the suggest API endpoint. This is logic that leverages LLMs to suggest an extractor for a given task. """ from typing import Optional from fastapi import APIRouter from langchain_core.prompts import ChatPromptTemplate from pydantic import BaseModel, Field from server.models import get_model rout...
0
lc_public_repos/langchain-extract/backend/server
lc_public_repos/langchain-extract/backend/server/api/extract.py
from typing import Literal, Optional from uuid import UUID from fastapi import APIRouter, Depends, File, Form, HTTPException, UploadFile from sqlalchemy.orm import Session from typing_extensions import Annotated from db.models import Extractor, SharedExtractors, get_session from extraction.parsing import parse_binary...
0
lc_public_repos/langchain-extract/backend/server
lc_public_repos/langchain-extract/backend/server/api/shared.py
"""Endpoints for working with shared resources.""" from typing import Any, Dict from uuid import UUID from fastapi import APIRouter, Depends, HTTPException from pydantic import BaseModel, Field from sqlalchemy.orm import Session from db.models import Extractor, SharedExtractors, get_session router = APIRouter( p...
0
lc_public_repos/langchain-extract/backend/server
lc_public_repos/langchain-extract/backend/server/api/configurables.py
"""Endpoint for listing available chat models for extraction.""" from typing import List from fastapi import APIRouter from typing_extensions import TypedDict from extraction.parsing import MAX_FILE_SIZE_MB, SUPPORTED_MIMETYPES from server.models import SUPPORTED_MODELS from server.settings import MAX_CHUNKS, MAX_CON...
0
lc_public_repos/langchain-extract/backend/server
lc_public_repos/langchain-extract/backend/server/api/extractors.py
"""Endpoints for managing definition of extractors.""" from typing import Any, Dict, List from uuid import UUID, uuid4 from fastapi import APIRouter, Depends, HTTPException from pydantic import BaseModel, Field, validator from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import Session from db.models impo...
0
lc_public_repos/langchain-extract/backend/server
lc_public_repos/langchain-extract/backend/server/api/examples.py
"""Endpoints for managing definition of examples..""" from typing import Any, List from uuid import UUID from fastapi import APIRouter, Depends, HTTPException from sqlalchemy.orm import Session from typing_extensions import Annotated, TypedDict from db.models import Example, get_session, validate_extractor_owner from...
0
lc_public_repos/langchain-extract/backend/server
lc_public_repos/langchain-extract/backend/server/api/api_key.py
from fastapi.security import APIKeyHeader # For actual auth, you'd need to check the key against a database or some other # data store. Here, we don't need actual auth, just a key that matches # a UUID UserToken = APIKeyHeader(name="x-key")
0
lc_public_repos/langchain-extract/backend
lc_public_repos/langchain-extract/backend/scripts/run_migrations.py
#!/usr/bin/env python """Run migrations.""" import click from db.models import ENGINE, Base @click.group() def cli(): """Database migration commands.""" pass @cli.command() def create(): """Create all tables.""" Base.metadata.create_all(ENGINE) click.echo("All tables created successfully.") @...
0
lc_public_repos/langchain-extract/backend
lc_public_repos/langchain-extract/backend/scripts/local_entry_point.sh
# -e: fail on any nonzero exit status # -u: fail if any referenced variables are not set # -x: print commands before running them # -o pipefail: fail if a command in a pipe has a nonzero exit code set -euxo pipefail # For now just create the db if it doesn't exist python -m scripts.run_migrations create uvicorn serve...
0
lc_public_repos/langchain-extract/backend
lc_public_repos/langchain-extract/backend/scripts/prod_entry_point.sh
# -e: fail on any nonzero exit status # -u: fail if any referenced variables are not set # -x: print commands before running them # -o pipefail: fail if a command in a pipe has a nonzero exit code set -euxo pipefail # For now just create the db if it doesn't exist python -m scripts.run_migrations create uvicorn serve...
0
lc_public_repos
lc_public_repos/langgraph-studio/README.md
![LangGraph Studio](./cover.svg) # LangGraph Studio (Beta) LangGraph Studio offers a new way to develop LLM applications by providing a specialized agent IDE that enables visualization, interaction, and debugging of complex agentic applications With visual graphs and the ability to edit state, you can better underst...
0
lc_public_repos
lc_public_repos/langgraph-studio/cover.svg
<svg width="1280" height="250" viewBox="0 0 1280 250" fill="none" xmlns="http://www.w3.org/2000/svg"> <g clip-path="url(#clip0_22_133)"> <rect width="1280" height="250" fill="white" /> <g clip-path="url(#clip1_22_133)"> <rect width="1728" height="1117" transform="translate(-224 -433)" fill="#004F49" /> ...
0
lc_public_repos
lc_public_repos/langchainjs/.vercelignore
node_modules/ **/node_modules/ .next/ **/.next/
0
lc_public_repos
lc_public_repos/langchainjs/release_workspace.js
const { execSync } = require("child_process"); const { Command } = require("commander"); const fs = require("fs"); const path = require("path"); const { spawn } = require("child_process"); const readline = require("readline"); const semver = require("semver"); const RELEASE_BRANCH = "release"; const MAIN_BRANCH = "mai...
0
lc_public_repos
lc_public_repos/langchainjs/deno.json
{ "imports": { "langchain/": "npm:/langchain@0.3.2/", "@langchain/anthropic": "npm:@langchain/anthropic@0.3.0", "@langchain/cloudflare": "npm:@langchain/cloudflare@0.1.0", "@langchain/community/": "npm:/@langchain/community@0.3.0/", "@langchain/openai": "npm:@langchain/openai@0.3.0", "@langcha...
0
lc_public_repos
lc_public_repos/langchainjs/.codecov.yml
coverage: status: project: default: informational: true patch: default: informational: true # When modifying this file, please validate using # curl -X POST --data-binary @codecov.yml https://codecov.io/validate
0
lc_public_repos
lc_public_repos/langchainjs/tsconfig.json
{ "extends": "@tsconfig/recommended", "compilerOptions": { "target": "ES2021", "lib": [ "ES2021", "ES2022.Object", "DOM" ], "module": "ES2020", "moduleResolution": "nodenext", "esModuleInterop": true, "declaration": true, "noImplicitReturns": true, "noFallthroug...
0
lc_public_repos
lc_public_repos/langchainjs/LICENSE
The MIT License Copyright (c) Harrison Chase 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, dis...
0
lc_public_repos
lc_public_repos/langchainjs/.editorconfig
# top-most EditorConfig file root = true # Unix-style newlines with a newline ending every file [*] end_of_line = lf
0
lc_public_repos
lc_public_repos/langchainjs/yarn.lock
# This file is generated by running "yarn install" inside your project. # Manual changes might be lost - proceed with caution! __metadata: version: 6 cacheKey: 8 "@aashutoshrathi/word-wrap@npm:^1.2.3": version: 1.2.6 resolution: "@aashutoshrathi/word-wrap@npm:1.2.6" checksum: ada901b9e7c680d190f1d012c84217c...
0
lc_public_repos
lc_public_repos/langchainjs/.nvmrc
20
0
lc_public_repos
lc_public_repos/langchainjs/CONTRIBUTING.md
# Contributing to LangChain πŸ‘‹ Hi there! Thank you for being interested in contributing to LangChain. As an open source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infra, or better documentation. To contribute to this project, ple...
0
lc_public_repos
lc_public_repos/langchainjs/README.md
# πŸ¦œοΈπŸ”— LangChain.js ⚑ Building applications with LLMs through composability ⚑ [![CI](https://github.com/langchain-ai/langchainjs/actions/workflows/ci.yml/badge.svg)](https://github.com/langchain-ai/langchainjs/actions/workflows/ci.yml) ![npm](https://img.shields.io/npm/dm/langchain) [![License: MIT](https://img.shie...
0
lc_public_repos
lc_public_repos/langchainjs/.yarnrc.yml
nodeLinker: node-modules plugins: - path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs spec: "@yarnpkg/plugin-typescript" - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs spec: "@yarnpkg/plugin-workspace-tools" supportedArchitectures: cpu: - x64 - arm64 libc: - glibc - musl ...
0
lc_public_repos
lc_public_repos/langchainjs/.watchmanconfig
{ "ignore_dirs": [ "langchain/dist", "langchain/dist-cjs", "docs/build", "node_modules", "langchain/.turbo", "docs/.turbo", "test-exports/.turbo", "test-exports-cjs/.turbo" ] }
0
lc_public_repos
lc_public_repos/langchainjs/SECURITY.md
# Security Policy ## Reporting a Vulnerability Please report security vulnerabilities by email to `security@langchain.dev`. This email is an alias to a subset of our maintainers, and will ensure the issue is promptly triaged and acted upon as needed.
0
lc_public_repos
lc_public_repos/langchainjs/.prettierignore
babel.config.js jest.config.js .eslintrc.js
0
lc_public_repos
lc_public_repos/langchainjs/test-int-deps-docker-compose.yml
version: '3.8' services: redis: image: redis:6.2-alpine restart: always ports: - '6379:6379' command: redis-server --save 20 1 --loglevel warning redis-vectorsearch: image: redis/redis-stack-server:latest restart: always ports: - '6378:6379' command: redis-stack-server ...
0
lc_public_repos
lc_public_repos/langchainjs/package.json
{ "name": "langchainjs", "private": true, "engines": { "node": ">=18" }, "homepage": "https://github.com/langchain-ai/langchainjs/tree/main/", "workspaces": [ "langchain", "langchain-core", "libs/*", "examples", "docs/*" ], "repository": { "type": "git", "url": "https://g...
0
lc_public_repos
lc_public_repos/langchainjs/turbo.json
{ "$schema": "https://turbo.build/schema.json", "globalDependencies": ["**/.env"], "pipeline": { "build": { "dependsOn": ["^build"], "outputs": ["dist/**", ".next/**", "!.next/cache/**"] }, "lint": { "dependsOn": ["^lint"] }, "lint:fix": { "dependsOn": ["^lint:fix"] ...