text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
import { OpenAI } from "@langchain/openai"; const llm = new OpenAI({ modelName: "gpt-3.5-turbo-instruct", callbacks: [ { handleLLMEnd(output) { console.log(JSON.stringify(output, null, 2)); }, }, ], }); await llm.invoke("Tell me a joke."); /* { "generations": [ [ ...
langchainjs/examples/src/models/llm/token_usage_tracking.ts/0
{ "file_path": "langchainjs/examples/src/models/llm/token_usage_tracking.ts", "repo_id": "langchainjs", "token_count": 354 }
833
kind: Namespace apiVersion: v1 metadata: name: chroma --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: memberlist-reader rules: - apiGroups: - chroma.cluster resources: - memberlists verbs: - get - list - watch - create - update - patch - delete --- apiVersion: rb...
chroma/k8s/dev/setup.yaml/0
{ "file_path": "chroma/k8s/dev/setup.yaml", "repo_id": "chroma", "token_count": 883 }
54
<jupyter_start><jupyter_text>Banana[Banana](https://www.banana.dev/about-us) is focused on building the machine learning infrastructure.This example goes over how to use LangChain to interact with Banana models<jupyter_code># Install the package https://docs.banana.dev/banana-docs/core-concepts/sdks/python %pip instal...
langchain/docs/docs/integrations/llms/banana.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/banana.ipynb", "repo_id": "langchain", "token_count": 417 }
119
# Building Performant RAG Applications for Production Prototyping a RAG application is easy, but making it performant, robust, and scalable to a large knowledge corpus is hard. This guide contains a variety of tips and tricks to improve the performance of your RAG pipeline. We first outline some general techniques - ...
llama_index/docs/optimizing/production_rag.md/0
{ "file_path": "llama_index/docs/optimizing/production_rag.md", "repo_id": "llama_index", "token_count": 1943 }
1,164
import { applyPatch } from "@langchain/core/utils/json_patch"; import { RemoteRunnable } from "../remote.js"; test("streamLog hosted langserve", async () => { const remote = new RemoteRunnable({ url: `https://chat-langchain-backend.langchain.dev/chat`, }); const result = await remote.streamLog({ question...
langchainjs/langchain/src/runnables/tests/runnable_remote.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/runnables/tests/runnable_remote.int.test.ts", "repo_id": "langchainjs", "token_count": 267 }
921
python_tests( interpreter_constraints=["==3.9.*", "==3.10.*"], )
llama_index/llama-index-integrations/readers/llama-index-readers-agent-search/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-agent-search/tests/BUILD", "repo_id": "llama_index", "token_count": 29 }
1,325
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.vector_db import VectorDBToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in VectorDBToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-vector-db/tests/test_tools_vector_db.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-vector-db/tests/test_tools_vector_db.py", "repo_id": "llama_index", "token_count": 95 }
1,505
import random import time import random import string from faker import Faker import numpy as np from sklearn import preprocessing import requests from loguru import logger import datetime fake = Faker() def random_string(length=8): letters = string.ascii_letters return ''.join(random.choice(letters) for _ i...
milvus/tests/restful_client/utils/utils.py/0
{ "file_path": "milvus/tests/restful_client/utils/utils.py", "repo_id": "milvus", "token_count": 2053 }
1,906
from llama_index.readers.reddit.base import RedditReader __all__ = ["RedditReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-reddit/llama_index/readers/reddit/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-reddit/llama_index/readers/reddit/__init__.py", "repo_id": "llama_index", "token_count": 26 }
1,545
<jupyter_start><jupyter_text>Recursive Retriever + Node References + BraintrustThis guide shows how you can use recursive retrieval to traverse node relationships and fetch nodes based on "references".Node references are a powerful concept. When you first perform retrieval, you may want to retrieve the reference as opp...
llama_index/docs/examples/retrievers/recurisve_retriever_nodes_braintrust.ipynb/0
{ "file_path": "llama_index/docs/examples/retrievers/recurisve_retriever_nodes_braintrust.ipynb", "repo_id": "llama_index", "token_count": 4676 }
1,131
"""Azblob file and directory reader. A loader that fetches a file or iterates through a directory on Azblob or. """ from typing import Dict, List, Optional, Union from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document from llama_index.readers.opendal.base import OpendalRea...
llama_index/llama-index-integrations/readers/llama-index-readers-opendal/llama_index/readers/opendal/azblob/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-opendal/llama_index/readers/opendal/azblob/base.py", "repo_id": "llama_index", "token_count": 884 }
1,397
package etcdkv import ( "testing" "github.com/stretchr/testify/suite" "github.com/milvus-io/milvus/internal/kv/predicates" ) type EtcdKVUtilSuite struct { suite.Suite } func (s *EtcdKVUtilSuite) TestParsePredicateType() { type testCase struct { tag string pt predicates.PredicateType ...
milvus/internal/kv/etcd/util_test.go/0
{ "file_path": "milvus/internal/kv/etcd/util_test.go", "repo_id": "milvus", "token_count": 729 }
1,806
from llama_index.core.readers.base import BaseReader from llama_index.readers.linear import LinearReader def test_class(): names_of_base_classes = [b.__name__ for b in LinearReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-linear/tests/test_readers_linear.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-linear/tests/test_readers_linear.py", "repo_id": "llama_index", "token_count": 85 }
1,329
from __future__ import annotations import contextlib import enum import logging import uuid from typing import ( Any, Callable, Dict, Generator, Iterable, List, Optional, Tuple, Type, Union, ) import numpy as np import sqlalchemy from sqlalchemy import delete, func from sqlalch...
langchain/libs/community/langchain_community/vectorstores/lantern.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/lantern.py", "repo_id": "langchain", "token_count": 17112 }
326
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, ...
candle/candle-core/LICENSE/0
{ "file_path": "candle/candle-core/LICENSE", "repo_id": "candle", "token_count": 3168 }
35
from typing import Dict, List from uuid import UUID from langchain.callbacks.tracers.base import BaseTracer from langsmith.schemas import Run class FakeTracer(BaseTracer): """Fake tracer that records LangChain execution. It replaces run ids with deterministic UUIDs.""" def __init__(self) -> None: ...
langserve/tests/unit_tests/utils/tracer.py/0
{ "file_path": "langserve/tests/unit_tests/utils/tracer.py", "repo_id": "langserve", "token_count": 702 }
1,054
from llama_index.callbacks.argilla.base import argilla_callback_handler __all__ = ["argilla_callback_handler"]
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-argilla/llama_index/callbacks/argilla/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-argilla/llama_index/callbacks/argilla/__init__.py", "repo_id": "llama_index", "token_count": 35 }
1,208
# coding=utf-8 # Copyright 2019 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
transformers/tests/test_configuration_utils.py/0
{ "file_path": "transformers/tests/test_configuration_utils.py", "repo_id": "transformers", "token_count": 5459 }
845
document.addEventListener("DOMContentLoaded", () => { // Load the external dependencies function loadScript(src, onLoadCallback) { const script = document.createElement("script"); script.src = src; script.onload = onLoadCallback; document.head.appendChild(script); } function createRootElement()...
llama_index/docs/_static/js/mendablesearch.js/0
{ "file_path": "llama_index/docs/_static/js/mendablesearch.js", "repo_id": "llama_index", "token_count": 795 }
1,078
# Validates training data and estimates token usage # Copied from https://platform.openai.com/docs/guides/fine-tuning/preparing-your-dataset # Usage: # python validate_json.py <path_to_jsonl_file> # We start by importing the required packages import json import os import sys from collections import defaultdict from...
llama_index/llama-index-legacy/llama_index/legacy/finetuning/openai/validate_json.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/finetuning/openai/validate_json.py", "repo_id": "llama_index", "token_count": 2760 }
1,594
<jupyter_start><jupyter_text>Unit 5: An Introduction to ML-Agents In this notebook, you'll learn about ML-Agents and train two agents.- The first one will learn to **shoot snowballs onto spawning targets**.- The second need to press a button to spawn a pyramid, then navigate to the pyramid, knock it over, **and move to...
deep-rl-class/notebooks/unit5/unit5.ipynb/0
{ "file_path": "deep-rl-class/notebooks/unit5/unit5.ipynb", "repo_id": "deep-rl-class", "token_count": 4123 }
148
use tokenizers::models::bpe::{BpeTrainerBuilder, BPE}; use tokenizers::normalizers::{Sequence, Strip, NFC}; use tokenizers::pre_tokenizers::byte_level::ByteLevel; use tokenizers::{AddedToken, TokenizerBuilder}; use tokenizers::{DecoderWrapper, NormalizerWrapper, PostProcessorWrapper, PreTokenizerWrapper}; use tokenizer...
tokenizers/tokenizers/tests/documentation.rs/0
{ "file_path": "tokenizers/tokenizers/tests/documentation.rs", "repo_id": "tokenizers", "token_count": 7402 }
483
from ._builder import * from ._helpers import * from ._manipulate import * from ._prune import * import warnings warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.models", DeprecationWarning)
pytorch-image-models/timm/models/helpers.py/0
{ "file_path": "pytorch-image-models/timm/models/helpers.py", "repo_id": "pytorch-image-models", "token_count": 64 }
373
<jupyter_start><jupyter_text>Fine Tuning Llama2 for Better Structured Outputs With Gradient and LlamaIndexIn this notebook we show you how to fine-tune llama2-7b to be better at outputting structured outputs.We do this by using [gradient.ai](https://gradient.ai)This is similar in format to our [OpenAI Functions Fine-tu...
llama_index/docs/examples/finetuning/gradient/gradient_structured.ipynb/0
{ "file_path": "llama_index/docs/examples/finetuning/gradient/gradient_structured.ipynb", "repo_id": "llama_index", "token_count": 5479 }
1,186
from langchain_community.graphs.neo4j_graph import Neo4jGraph SCHEMA_QUERY = """ CALL llm_util.schema("raw") YIELD * RETURN * """ class MemgraphGraph(Neo4jGraph): """Memgraph wrapper for graph operations. *Security note*: Make sure that the database connection uses credentials that are narrowly-scop...
langchain/libs/community/langchain_community/graphs/memgraph_graph.py/0
{ "file_path": "langchain/libs/community/langchain_community/graphs/memgraph_graph.py", "repo_id": "langchain", "token_count": 1055 }
275
--- sidebar_position: 1 sidebar_class_name: hidden --- # Retrieval Many LLM applications require user-specific data that is not part of the model's training set. The primary way of accomplishing this is through Retrieval Augmented Generation (RAG). In this process, external data is *retrieved* and then passed to the ...
langchain/docs/docs/modules/data_connection/index.mdx/0
{ "file_path": "langchain/docs/docs/modules/data_connection/index.mdx", "repo_id": "langchain", "token_count": 1051 }
186
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/main_classes/deepspeed.md/0
{ "file_path": "transformers/docs/source/ja/main_classes/deepspeed.md", "repo_id": "transformers", "token_count": 49392 }
511
from llama_index.vector_stores.lancedb.base import LanceDBVectorStore __all__ = ["LanceDBVectorStore"]
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-lancedb/llama_index/vector_stores/lancedb/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-lancedb/llama_index/vector_stores/lancedb/__init__.py", "repo_id": "llama_index", "token_count": 34 }
1,659
import { PromptTemplate } from "@langchain/core/prompts"; import { RunnableMap } from "@langchain/core/runnables"; import { ChatAnthropic } from "@langchain/anthropic"; const model = new ChatAnthropic({}); const jokeChain = PromptTemplate.fromTemplate( "Tell me a joke about {topic}" ).pipe(model); const poemChain = ...
langchainjs/examples/src/guides/expression_language/runnable_maps_basic.ts/0
{ "file_path": "langchainjs/examples/src/guides/expression_language/runnable_maps_basic.ts", "repo_id": "langchainjs", "token_count": 390 }
868
# 🦜️🏓 LangServe [![Release Notes](https://img.shields.io/github/release/langchain-ai/langserve)](https://github.com/langchain-ai/langserve/releases) [![Downloads](https://static.pepy.tech/badge/langserve/month)](https://pepy.tech/project/langserve) [![Open Issues](https://img.shields.io/github/issues-raw/langchain-a...
langserve/README.md/0
{ "file_path": "langserve/README.md", "repo_id": "langserve", "token_count": 14915 }
1,007
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 563, "logprob": null, "text": "def" }, { "id": 942, "logprob": -5.1367188, "text": " print...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_santacoder/test_flash_santacoder_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_santacoder/test_flash_santacoder_load.json", "repo_id": "text-generation-inference", "token_count": 5188 }
407
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-upstash/llama_index/vector_stores/upstash/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-upstash/llama_index/vector_stores/upstash/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,540
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a cop...
transformers/src/transformers/data/processors/xnli.py/0
{ "file_path": "transformers/src/transformers/data/processors/xnli.py", "repo_id": "transformers", "token_count": 1505 }
620
from typing import Any, Dict from llama_index.legacy.embeddings import ( HuggingFaceEmbedding, OpenAIEmbedding, ) from llama_index.legacy.embeddings.utils import resolve_embed_model from llama_index.legacy.token_counter.mock_embed_model import MockEmbedding from pytest import MonkeyPatch def mock_hf_embeddin...
llama_index/llama-index-legacy/tests/embeddings/test_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/embeddings/test_utils.py", "repo_id": "llama_index", "token_count": 529 }
1,731
import json import hashlib class Hardware: """ { "_version": "0.1", "_type": "hardware", "name": string, "cpus": float } """ def __init__(self, name=None, cpus=0.0): self._version = '0.1' self._type = 'hardware' self.name = name sel...
milvus/tests/benchmark/milvus_benchmark/metrics/models/hardware.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/metrics/models/hardware.py", "repo_id": "milvus", "token_count": 243 }
2,078
/* eslint-disable @typescript-eslint/no-explicit-any */ import weaviate, { ApiKey } from "weaviate-ts-client"; import { WeaviateStore } from "@langchain/weaviate"; import { OpenAIEmbeddings } from "@langchain/openai"; export async function run() { // Something wrong with the weaviate-ts-client types, so we need to d...
langchainjs/examples/src/indexes/vector_stores/weaviate_search.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/weaviate_search.ts", "repo_id": "langchainjs", "token_count": 502 }
825
from llama_index.core.base.response.schema import Response __all__ = ["Response"]
llama_index/llama-index-core/llama_index/core/response/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/response/__init__.py", "repo_id": "llama_index", "token_count": 26 }
1,215
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "llms/cloudflare_workersai", newEntrypointName: "", newPackageName: "@langchain/cloudflare", }); export * from "@langchain/community/llms/cloudflare_workersai";
langchainjs/langchain/src/llms/cloudflare_workersai.ts/0
{ "file_path": "langchainjs/langchain/src/llms/cloudflare_workersai.ts", "repo_id": "langchainjs", "token_count": 103 }
929
<jupyter_start><jupyter_text>Données massives ? 🤗 Datasets à la rescousse ! Installez les bibliothèques 🤗 Transformers et 🤗 Datasets pour exécuter ce *notebook*.<jupyter_code>!pip install datasets evaluate transformers[sentencepiece] !pip install zstandard from datasets import load_dataset # Cela prend quelques min...
notebooks/course/fr/chapter5/section4.ipynb/0
{ "file_path": "notebooks/course/fr/chapter5/section4.ipynb", "repo_id": "notebooks", "token_count": 1168 }
312
from langchain import embeddings from tests.unit_tests import assert_all_importable EXPECTED_ALL = [ "OpenAIEmbeddings", "AzureOpenAIEmbeddings", "CacheBackedEmbeddings", "ClarifaiEmbeddings", "CohereEmbeddings", "DatabricksEmbeddings", "ElasticsearchEmbeddings", "FastEmbedEmbeddings", ...
langchain/libs/langchain/tests/unit_tests/embeddings/test_imports.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/embeddings/test_imports.py", "repo_id": "langchain", "token_count": 759 }
623
import logging from .helm import HelmEnv from .docker import DockerEnv from .local import LocalEnv logger = logging.getLogger("milvus_benchmark.env") def get_env(env_mode, deploy_mode=None): return { "helm": HelmEnv(deploy_mode), "docker": DockerEnv(None), "local": LocalEnv(None), }.g...
milvus/tests/benchmark/milvus_benchmark/env/__init__.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/env/__init__.py", "repo_id": "milvus", "token_count": 136 }
1,957
from llama_index.core.data_structs.data_structs import IndexGraph from llama_index.core.storage.index_store.simple_index_store import ( SimpleIndexStore, ) def test_simple_index_store_dict() -> None: index_struct = IndexGraph() index_store = SimpleIndexStore() index_store.add_index_struct(index_struct...
llama_index/llama-index-core/tests/storage/index_store/test_simple_index_store.py/0
{ "file_path": "llama_index/llama-index-core/tests/storage/index_store/test_simple_index_store.py", "repo_id": "llama_index", "token_count": 195 }
1,170
from threading import Lock from chromadb.segment import ( SegmentImplementation, SegmentManager, MetadataReader, SegmentType, VectorReader, S, ) from chromadb.config import System, get_class from chromadb.db.system import SysDB from overrides import override from chromadb.segment.distributed imp...
chroma/chromadb/segment/impl/manager/distributed.py/0
{ "file_path": "chroma/chromadb/segment/impl/manager/distributed.py", "repo_id": "chroma", "token_count": 3064 }
22
export { calculateMaxTokens, getModelContextSize, getEmbeddingContextSize, } from "@langchain/core/language_models/base";
langchainjs/langchain/src/base_language/count_tokens.ts/0
{ "file_path": "langchainjs/langchain/src/base_language/count_tokens.ts", "repo_id": "langchainjs", "token_count": 40 }
900
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.zapier import ZapierToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in ZapierToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-zapier/tests/test_tools_zapier.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-zapier/tests/test_tools_zapier.py", "repo_id": "llama_index", "token_count": 95 }
1,645
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querycoordv2/job/job_release.go/0
{ "file_path": "milvus/internal/querycoordv2/job/job_release.go", "repo_id": "milvus", "token_count": 2548 }
1,829
import logging import re from typing import TYPE_CHECKING, Any, List, Optional, Pattern import numpy as np _logger = logging.getLogger(__name__) if TYPE_CHECKING: from redis.client import Redis as RedisType from redis.commands.search.query import Query class TokenEscaper: """ Escape punctuation wit...
llama_index/llama-index-legacy/llama_index/legacy/readers/redis/utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/redis/utils.py", "repo_id": "llama_index", "token_count": 1390 }
1,610
from llama_index.tools.playgrounds.subgraph_connector.base import ( PlaygroundsSubgraphConnectorToolSpec, ) from llama_index.tools.playgrounds.subgraph_inspector.base import ( PlaygroundsSubgraphInspectorToolSpec, ) __all__ = [ "PlaygroundsSubgraphConnectorToolSpec", "PlaygroundsSubgraphInspectorToolSp...
llama_index/llama-index-integrations/tools/llama-index-tools-playgrounds/llama_index/tools/playgrounds/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-playgrounds/llama_index/tools/playgrounds/__init__.py", "repo_id": "llama_index", "token_count": 110 }
1,522
import os import logging import pdb import time import random from multiprocessing import Process import numpy as np from client import MilvusClient import utils import parser from runner import Runner logger = logging.getLogger("milvus_benchmark.docker") class DockerRunner(Runner): """run docker mode""" def...
milvus/tests/benchmark/milvus_benchmark/runners/docker_runner.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/runners/docker_runner.py", "repo_id": "milvus", "token_count": 12562 }
1,992
/* eslint-disable no-process-env */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { test } from "@jest/globals"; import { HumanMessage } from "@langchain/core/messages"; import { OllamaFunctions } from "../ollama_functions.js"; test.skip("Test OllamaFunctions", async () => { const chat = new O...
langchainjs/langchain/src/experimental/chat_models/tests/ollama_functions.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/chat_models/tests/ollama_functions.int.test.ts", "repo_id": "langchainjs", "token_count": 1056 }
895
python_sources()
llama_index/llama-index-cli/llama_index/cli/new_package/BUILD/0
{ "file_path": "llama_index/llama-index-cli/llama_index/cli/new_package/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,107
<jupyter_start><jupyter_text>MarkdownHeaderTextSplitter MotivationMany chat or Q+A applications involve chunking input documents prior to embedding and vector storage.[These notes](https://www.pinecone.io/learn/chunking-strategies/) from Pinecone provide some useful tips:```When a full paragraph or document is embedded...
langchain/docs/docs/modules/data_connection/document_transformers/markdown_header_metadata.ipynb/0
{ "file_path": "langchain/docs/docs/modules/data_connection/document_transformers/markdown_header_metadata.ipynb", "repo_id": "langchain", "token_count": 1207 }
189
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
transformers/src/transformers/data/metrics/__init__.py/0
{ "file_path": "transformers/src/transformers/data/metrics/__init__.py", "repo_id": "transformers", "token_count": 1413 }
593
pub mod audio; pub mod model; pub mod quantized_model; use serde::Deserialize; // The names in comments correspond to the original implementation: // https://github.com/openai/whisper/blob/f572f2161ba831bae131364c3bffdead7af6d210/whisper/model.py#L17 #[derive(Debug, Clone, PartialEq, Deserialize)] pub struct Config {...
candle/candle-transformers/src/models/whisper/mod.rs/0
{ "file_path": "candle/candle-transformers/src/models/whisper/mod.rs", "repo_id": "candle", "token_count": 812 }
77
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-tencentvectordb/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-tencentvectordb/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,542
package model import ( "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus/internal/proto/internalpb" ) var ( credentialModel = &Credential{ Username: "user", EncryptedPassword: "password", Tenant: "tenant-1", IsSuper: true, Sha256Password: "xxx...
milvus/internal/metastore/model/credential_test.go/0
{ "file_path": "milvus/internal/metastore/model/credential_test.go", "repo_id": "milvus", "token_count": 329 }
1,721
"""Keyword-table based index. Similar to a "hash table" in concept. LlamaIndex first tries to extract keywords from the source text, and stores the keywords as keys per item. It similarly extracts keywords from the query text. Then, it tries to match those keywords to existing keywords in the table. """ from abc imp...
llama_index/llama-index-core/llama_index/core/indices/keyword_table/base.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/keyword_table/base.py", "repo_id": "llama_index", "token_count": 3945 }
1,192
"""Code for generic / auxiliary parsers. This module contains some logic to help assemble more sophisticated parsers. """ from typing import Iterator, Mapping, Optional from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseBlobParser from langchain_community.document...
langchain/libs/community/langchain_community/document_loaders/parsers/generic.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/parsers/generic.py", "repo_id": "langchain", "token_count": 1064 }
242
import os import re import time from enum import Enum from typing import List, Optional import requests from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader class BlockchainType(Enum): """Enumerator of the supported blockchains.""" ETH_MAINNET = "et...
langchain/libs/community/langchain_community/document_loaders/blockchain.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/blockchain.py", "repo_id": "langchain", "token_count": 2518 }
233
import { test } from "@jest/globals"; import { HumanMessage, AIMessage } from "@langchain/core/messages"; import { PromptTemplate, ChatPromptTemplate, AIMessagePromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate, } from "@langchain/core/prompts"; import { ChatGooglePaLM } from "../googlepa...
langchainjs/libs/langchain-community/src/chat_models/tests/chatgooglepalm.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/chat_models/tests/chatgooglepalm.int.test.ts", "repo_id": "langchainjs", "token_count": 1022 }
938
import { zodToJsonSchema, JsonSchema7ObjectType } from "zod-to-json-schema"; import type { StructuredToolInterface } from "@langchain/core/tools"; import type { BaseLanguageModel, BaseLanguageModelInterface, } from "@langchain/core/language_models/base"; import { RunnablePassthrough, RunnableSequence, } from "@...
langchainjs/langchain/src/agents/structured_chat/index.ts/0
{ "file_path": "langchainjs/langchain/src/agents/structured_chat/index.ts", "repo_id": "langchainjs", "token_count": 3723 }
879
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-neo4j/llama_index/tools/neo4j/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-neo4j/llama_index/tools/neo4j/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,490
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "embeddings/hf", }); export * from "@langchain/community/embeddings/hf";
langchainjs/langchain/src/embeddings/hf.ts/0
{ "file_path": "langchainjs/langchain/src/embeddings/hf.ts", "repo_id": "langchainjs", "token_count": 74 }
914
<jupyter_start><jupyter_text>Notion DB 2/2>[Notion](https://www.notion.so/) is a collaboration platform with modified Markdown support that integrates kanban boards, tasks, wikis and databases. It is an all-in-one workspace for notetaking, knowledge and data management, and project and task management.`NotionDBLoader` ...
langchain/docs/docs/integrations/document_loaders/notiondb.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/notiondb.ipynb", "repo_id": "langchain", "token_count": 833 }
108
from __future__ import annotations import logging import os import warnings from typing import ( Any, Callable, Dict, List, Literal, Mapping, Optional, Sequence, Set, Tuple, Union, cast, ) import numpy as np from langchain_core._api.deprecation import deprecated from la...
langchain/libs/community/langchain_community/embeddings/openai.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/openai.py", "repo_id": "langchain", "token_count": 13407 }
270
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-couchbase/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-couchbase/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,334
import { APIResponseError, Client, isFullBlock, isFullPage, iteratePaginatedAPI, APIErrorCode, isNotionClientError, isFullDatabase, } from "@notionhq/client"; import { NotionToMarkdown } from "notion-to-md"; import { getBlockChildren } from "notion-to-md/build/utils/notion.js"; import type { ListBlock...
langchainjs/langchain/src/document_loaders/web/notionapi.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/web/notionapi.ts", "repo_id": "langchainjs", "token_count": 5518 }
913
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
transformers/src/transformers/models/llama/tokenization_llama.py/0
{ "file_path": "transformers/src/transformers/models/llama/tokenization_llama.py", "repo_id": "transformers", "token_count": 9293 }
658
[tool.poetry] name = "rag-aws-bedrock" version = "0.1.0" description = "RAG using AWS Bedrock" authors = [ "Lance Martin <lance@langchain.dev>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" tiktoken = ">=0.5.1" faiss-cpu = ">=1.7.4" boto3 = ">=1.28.57" awscli = ">=1....
langchain/templates/rag-aws-bedrock/pyproject.toml/0
{ "file_path": "langchain/templates/rag-aws-bedrock/pyproject.toml", "repo_id": "langchain", "token_count": 312 }
681
"""Test toolkit integration.""" from langchain_robocorp.toolkits import ActionServerToolkit from ._fixtures import FakeChatLLMT def test_initialization() -> None: """Test toolkit initialization.""" ActionServerToolkit(url="http://localhost", llm=FakeChatLLMT())
langchain/libs/partners/robocorp/tests/unit_tests/test_toolkits.py/0
{ "file_path": "langchain/libs/partners/robocorp/tests/unit_tests/test_toolkits.py", "repo_id": "langchain", "token_count": 81 }
699
<jupyter_start><jupyter_text>OpenAI FunctionsThese output parsers use OpenAI function calling to structure its outputs. This means they are only usable with models that support function calling. There are a few different variants:- JsonOutputFunctionsParser: Returns the arguments of the function call as JSON- PydanticO...
langchain/docs/docs/modules/model_io/output_parsers/types/openai_functions.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/output_parsers/types/openai_functions.ipynb", "repo_id": "langchain", "token_count": 1623 }
198
from openai_functions_agent.agent import agent_executor if __name__ == "__main__": question = ( "Write a draft response to LangChain's last email. " "First do background research on the sender and topics to make sure you" " understand the context, then write the draft." ) print(agen...
langchain/templates/openai-functions-agent-gmail/main.py/0
{ "file_path": "langchain/templates/openai-functions-agent-gmail/main.py", "repo_id": "langchain", "token_count": 135 }
718
from __future__ import annotations from typing import Any, Dict, Iterator, List, Optional from langchain_core._api.deprecation import deprecated from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models import LanguageModelInput from langchain_core.outputs import Generation, Ge...
langchain/libs/community/langchain_community/llms/google_palm.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/google_palm.py", "repo_id": "langchain", "token_count": 3950 }
267
# Common environment variables locals { voyager_vars = var.voyage_ai_model != "" && var.voyage_api_key != "" ? { VOYAGE_AI_MODEL = var.voyage_ai_model VOYAGE_API_KEY = var.voyage_api_key } : {} env_vars = merge(local.voyager_vars, { OPENAI_API_KEY = var.openai_api_key WEAVIATE_URL =...
chat-langchain/terraform/modules/chat_langchain_backend/main.tf/0
{ "file_path": "chat-langchain/terraform/modules/chat_langchain_backend/main.tf", "repo_id": "chat-langchain", "token_count": 1967 }
12
from typing import List, Optional from fastapi import FastAPI from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor def instrument_fastapi(app: FastAPI, excluded_urls: Optional[List[str]] = None) -> None: """Instrument FastAPI to emit OpenTelemetry spans.""" FastAPIInstrumentor.instrument_app(...
chroma/chromadb/telemetry/opentelemetry/fastapi.py/0
{ "file_path": "chroma/chromadb/telemetry/opentelemetry/fastapi.py", "repo_id": "chroma", "token_count": 132 }
24
import { test, expect } from "@jest/globals"; import { HuggingFaceTransformersEmbeddings } from "../hf_transformers.js"; import { HNSWLib } from "../../vectorstores/hnswlib.js"; test("HuggingFaceTransformersEmbeddings", async () => { const embeddings = new HuggingFaceTransformersEmbeddings(); const texts = [ ...
langchainjs/libs/langchain-community/src/embeddings/tests/hf_transformers.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/embeddings/tests/hf_transformers.int.test.ts", "repo_id": "langchainjs", "token_count": 375 }
997
from langchain_exa import __all__ EXPECTED_ALL = [ "ExaSearchResults", "ExaSearchRetriever", "HighlightsContentsOptions", "TextContentsOptions", "ExaFindSimilarResults", ] def test_all_imports() -> None: assert sorted(EXPECTED_ALL) == sorted(__all__)
langchain/libs/partners/exa/tests/unit_tests/test_imports.py/0
{ "file_path": "langchain/libs/partners/exa/tests/unit_tests/test_imports.py", "repo_id": "langchain", "token_count": 107 }
643
"""Composable graph.""" # TODO: remove this file, only keep for backwards compatibility from llama_index.core.indices.composability.graph import ComposableGraph # noqa
llama_index/llama-index-core/llama_index/core/composability/base.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/composability/base.py", "repo_id": "llama_index", "token_count": 48 }
1,141
python_tests()
llama_index/llama-index-packs/llama-index-packs-resume-screener/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-resume-screener/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,814
[tool.poetry] name = "langserve" version = "0.0.41" description = "" readme = "README.md" authors = ["LangChain"] license = "LangServe" repository = "https://github.com/langchain-ai/langserve" exclude = ["langserve/playground"] include = ["langserve/playground/dist/**/*"] [tool.poetry.dependencies] python = "^3.8.1" h...
langserve/pyproject.toml/0
{ "file_path": "langserve/pyproject.toml", "repo_id": "langserve", "token_count": 1092 }
1,006
import { Chroma } from "@langchain/community/vectorstores/chroma"; import { OpenAIEmbeddings } from "@langchain/openai"; // text sample from Godel, Escher, Bach const vectorStore = await Chroma.fromTexts( [ `Tortoise: Labyrinth? Labyrinth? Could it Are we in the notorious Little Harmonic Labyrinth of the...
langchainjs/examples/src/indexes/vector_stores/chroma/fromTexts.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/chroma/fromTexts.ts", "repo_id": "langchainjs", "token_count": 508 }
811
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/using-diffusers/ip_adapter.md/0
{ "file_path": "diffusers/docs/source/en/using-diffusers/ip_adapter.md", "repo_id": "diffusers", "token_count": 7790 }
195
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/deta/convert_deta_swin_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/deta/convert_deta_swin_to_pytorch.py", "repo_id": "transformers", "token_count": 8242 }
595
import adapter from "@sveltejs/adapter-node"; import { vitePreprocess } from "@sveltejs/kit/vite"; import dotenv from "dotenv"; dotenv.config({ path: "./.env.local" }); dotenv.config({ path: "./.env" }); process.env.PUBLIC_VERSION = process.env.npm_package_version; /** @type {import('@sveltejs/kit').Config} */ const...
chat-ui/svelte.config.js/0
{ "file_path": "chat-ui/svelte.config.js", "repo_id": "chat-ui", "token_count": 253 }
105
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import ChunkPipeline, build_pipeline_init_args if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_av...
transformers/src/transformers/pipelines/zero_shot_object_detection.py/0
{ "file_path": "transformers/src/transformers/pipelines/zero_shot_object_detection.py", "repo_id": "transformers", "token_count": 4201 }
709
from langchain_community.vectorstores.matching_engine import MatchingEngine __all__ = ["MatchingEngine"]
langchain/libs/langchain/langchain/vectorstores/matching_engine.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/matching_engine.py", "repo_id": "langchain", "token_count": 29 }
628
"""Sleep tool."""
langchain/libs/community/langchain_community/tools/sleep/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/sleep/__init__.py", "repo_id": "langchain", "token_count": 6 }
309
# coding=utf-8 # Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
transformers/tests/models/albert/test_modeling_tf_albert.py/0
{ "file_path": "transformers/tests/models/albert/test_modeling_tf_albert.py", "repo_id": "transformers", "token_count": 5940 }
781
#![allow(dead_code)] // https://huggingface.co/facebook/musicgen-small/tree/main // https://github.com/huggingface/transformers/blob/cd4584e3c809bb9e1392ccd3fe38b40daba5519a/src/transformers/models/musicgen/modeling_musicgen.py // TODO: Add an offline mode. // TODO: Add a KV cache. #[cfg(feature = "mkl")] extern crate...
candle/candle-examples/examples/musicgen/main.rs/0
{ "file_path": "candle/candle-examples/examples/musicgen/main.rs", "repo_id": "candle", "token_count": 1164 }
40
# SWSL ResNet **Residual Networks**, or **ResNets**, learn residual functions with reference to the layer inputs, instead of learning unreferenced functions. Instead of hoping each few stacked layers directly fit a desired underlying mapping, residual nets let these layers fit a residual mapping. They stack [residual ...
pytorch-image-models/docs/models/.templates/models/swsl-resnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/swsl-resnet.md", "repo_id": "pytorch-image-models", "token_count": 1630 }
348
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class DPMSolverSDEScheduler(metaclass=DummyObject): _backends = ["torch", "torchsde"] def __init__(self, *args, **kwargs): requires_backends(self, ["torch", "torchsde"]) ...
diffusers/src/diffusers/utils/dummy_torch_and_torchsde_objects.py/0
{ "file_path": "diffusers/src/diffusers/utils/dummy_torch_and_torchsde_objects.py", "repo_id": "diffusers", "token_count": 224 }
266
import { OpenAIEmbeddings } from "@langchain/openai"; import { MemoryVectorStore } from "langchain/vectorstores/memory"; import { InMemoryStore } from "langchain/storage/in_memory"; import { ParentDocumentRetriever } from "langchain/retrievers/parent_document"; import { RecursiveCharacterTextSplitter } from "langchain/...
langchainjs/examples/src/retrievers/parent_document_retriever_score_threshold.ts/0
{ "file_path": "langchainjs/examples/src/retrievers/parent_document_retriever_score_threshold.ts", "repo_id": "langchainjs", "token_count": 643 }
862
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-dashscope/llama_index/llms/dashscope/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-dashscope/llama_index/llms/dashscope/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,253
# coding=utf-8 # Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
transformers/tests/models/longformer/test_modeling_longformer.py/0
{ "file_path": "transformers/tests/models/longformer/test_modeling_longformer.py", "repo_id": "transformers", "token_count": 15408 }
822
## How to release # Before the release Simple checklist on how to make releases for `tokenizers`. - Freeze `master` branch. - Run all tests (Check CI has properly run) - If any significant work, check benchmarks: - `cd tokenizers && cargo bench` (needs to be run on latest release tag to measure difference if it's ...
tokenizers/RELEASE.md/0
{ "file_path": "tokenizers/RELEASE.md", "repo_id": "tokenizers", "token_count": 1519 }
430
import { logVersion010MigrationWarning } from "../../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "llms/bedrock/web", }); export * from "@langchain/community/llms/bedrock/web";
langchainjs/langchain/src/llms/bedrock/web.ts/0
{ "file_path": "langchainjs/langchain/src/llms/bedrock/web.ts", "repo_id": "langchainjs", "token_count": 77 }
943
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/api/pipelines/ddim.md/0
{ "file_path": "diffusers/docs/source/en/api/pipelines/ddim.md", "repo_id": "diffusers", "token_count": 477 }
172
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/pkg/util/paramtable/param_item.go/0
{ "file_path": "milvus/pkg/util/paramtable/param_item.go", "repo_id": "milvus", "token_count": 2119 }
1,922
use candle::{ quantized::{self, k_quants, GgmlDType, GgmlType}, test_utils::to_vec2_round, Device, Module, Result, Tensor, }; use wasm_bindgen_test::*; wasm_bindgen_test_configure!(run_in_browser); #[wasm_bindgen_test] fn quantized_matmul_neg() -> Result<()> { let cpu = &Device::Cpu; let (m, k, n)...
candle/candle-wasm-tests/tests/quantized_tests.rs/0
{ "file_path": "candle/candle-wasm-tests/tests/quantized_tests.rs", "repo_id": "candle", "token_count": 3145 }
87
from __future__ import annotations from typing import List, Optional import aiohttp import requests from langchain_core.callbacks import ( AsyncCallbackManagerForRetrieverRun, CallbackManagerForRetrieverRun, ) from langchain_core.documents import Document from langchain_core.retrievers import BaseRetriever ...
langchain/libs/community/langchain_community/retrievers/chatgpt_plugin_retriever.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/chatgpt_plugin_retriever.py", "repo_id": "langchain", "token_count": 1324 }
277