text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# LangChain google-gauth This package contains resources to access Google AI/ML models and other Google services. Authorization to these services use either an API Key or service account credentials that are either stored on the local file system or are provided through the Google Cloud Platform environment it is runn...
langchainjs/libs/langchain-google-gauth/README.md/0
{ "file_path": "langchainjs/libs/langchain-google-gauth/README.md", "repo_id": "langchainjs", "token_count": 396 }
1,097
# coding=utf-8 # Copyright 2023 Toshiyuki Sakamoto(tanreinama) and 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 # ...
transformers/src/transformers/models/gptsan_japanese/modeling_gptsan_japanese.py/0
{ "file_path": "transformers/src/transformers/models/gptsan_japanese/modeling_gptsan_japanese.py", "repo_id": "transformers", "token_count": 28611 }
648
import functools import importlib import inspect import io import logging import multiprocessing import os import random import re import struct import sys import tempfile import time import unittest import urllib.parse from contextlib import contextmanager from distutils.util import strtobool from io import BytesIO, S...
diffusers/src/diffusers/utils/testing_utils.py/0
{ "file_path": "diffusers/src/diffusers/utils/testing_utils.py", "repo_id": "diffusers", "token_count": 14068 }
268
@ECHO OFF pushd %~dp0 REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set SOURCEDIR=. set BUILDDIR=_build if "%1" == "" goto help %SPHINXBUILD% >NUL 2>NUL if errorlevel 9009 ( echo. echo.The 'sphinx-build' command was not found. Make sure you have Sphinx echo...
langchain/docs/api_reference/make.bat/0
{ "file_path": "langchain/docs/api_reference/make.bat", "repo_id": "langchain", "token_count": 315 }
84
<jupyter_start><jupyter_text>SalesGPT - Your Context-Aware AI Sales Assistant With Knowledge BaseThis notebook demonstrates an implementation of a **Context-Aware** AI Sales agent with a Product Knowledge Base. This notebook was originally published at [filipmichalsky/SalesGPT](https://github.com/filip-michalsky/SalesG...
langchain/cookbook/sales_agent_with_context.ipynb/0
{ "file_path": "langchain/cookbook/sales_agent_with_context.ipynb", "repo_id": "langchain", "token_count": 11415 }
81
# mypy: disable-error-code=attr-defined import copy from random import random from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple from uuid import uuid4 import pytest from langchain_core.documents import Document from pytest_mock import MockerFixture from langchain_community.vectorstores import ZepVect...
langchain/libs/community/tests/integration_tests/vectorstores/test_zep.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_zep.py", "repo_id": "langchain", "token_count": 2641 }
389
import logging import os from typing import Any, Dict, List, Mapping, Optional import requests from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models.llms import LLM from langchain_core.pydantic_v1 import Field logger = logging.getLogger(__name__) class Baseten(LLM): "...
langchain/libs/community/langchain_community/llms/baseten.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/baseten.py", "repo_id": "langchain", "token_count": 1287 }
277
"""Base embeddings file. Maintain for backwards compatibility. """ from llama_index.legacy.core.embeddings.base import ( DEFAULT_EMBED_BATCH_SIZE, BaseEmbedding, Embedding, SimilarityMode, mean_agg, similarity, ) __all__ = [ "BaseEmbedding", "similarity", "SimilarityMode", "D...
llama_index/llama-index-legacy/llama_index/legacy/embeddings/base.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/embeddings/base.py", "repo_id": "llama_index", "token_count": 167 }
1,553
<jupyter_start><jupyter_text>If you're opening this Notebook on colab, you will probably need to install 🤗 Transformers as well as some other libraries. Uncomment the following cell and run it.<jupyter_code>#! pip install transformers evaluate datasets requests pandas sklearn<jupyter_output><empty_output><jupyter_text...
notebooks/examples/protein_language_modeling.ipynb/0
{ "file_path": "notebooks/examples/protein_language_modeling.ipynb", "repo_id": "notebooks", "token_count": 7787 }
324
from langchain_core.chat_history import BaseChatMessageHistory __all__ = ["BaseChatMessageHistory"]
langchain/libs/langchain/langchain/schema/chat_history.py/0
{ "file_path": "langchain/libs/langchain/langchain/schema/chat_history.py", "repo_id": "langchain", "token_count": 27 }
538
# for backwards compatibility from llama_index.legacy.core.base_query_engine import BaseQueryEngine __all__ = [ "BaseQueryEngine", ]
llama_index/llama-index-legacy/llama_index/legacy/indices/query/base.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/query/base.py", "repo_id": "llama_index", "token_count": 44 }
1,575
#ifndef _q_gemm_cuh #define _q_gemm_cuh #include <cuda_runtime.h> #include <cuda_fp16.h> #include <cstdint> #include <cstdio> #include <ATen/cuda/CUDAContext.h> #include "q_matrix.cuh" void gemm_half_q_half_cuda ( cublasHandle_t cublas_handle, const half* a, QMatrix* b, half* c, int size_m, i...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm.cuh", "repo_id": "text-generation-inference", "token_count": 293 }
378
import { BaseRetriever, type BaseRetrieverInput, } from "@langchain/core/retrievers"; import { Document } from "@langchain/core/documents"; import { VectorStore } from "@langchain/core/vectorstores"; import { CallbackManagerForRetrieverRun } from "@langchain/core/callbacks/manager"; import { LLMChain } from "../../...
langchainjs/langchain/src/retrievers/self_query/index.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/self_query/index.ts", "repo_id": "langchainjs", "token_count": 1861 }
1,010
# coding=utf-8 # Copyright 2022, Google and 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 applicab...
transformers/src/transformers/models/switch_transformers/configuration_switch_transformers.py/0
{ "file_path": "transformers/src/transformers/models/switch_transformers/configuration_switch_transformers.py", "repo_id": "transformers", "token_count": 3660 }
699
from typing import Any from llama_index.legacy.core.llms.types import ( ChatMessage, CompletionResponse, CompletionResponseGen, LLMMetadata, ) from llama_index.legacy.llms.custom import CustomLLM class TestLLM(CustomLLM): __test__ = False def __init__(self) -> None: super().__init__(...
llama_index/llama-index-legacy/tests/llms/test_custom.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/llms/test_custom.py", "repo_id": "llama_index", "token_count": 764 }
1,669
import argparse import itertools import math import os import random from pathlib import Path from typing import Iterable import numpy as np import PIL import torch import torch.nn.functional as F import torch.utils.checkpoint from accelerate import Accelerator from accelerate.utils import ProjectConfiguration, set_se...
diffusers/examples/research_projects/intel_opts/textual_inversion_dfq/textual_inversion.py/0
{ "file_path": "diffusers/examples/research_projects/intel_opts/textual_inversion_dfq/textual_inversion.py", "repo_id": "diffusers", "token_count": 18301 }
226
--- hide_table_of_contents: true --- import CodeBlock from "@theme/CodeBlock"; # Google Places Tool The Google Places Tool allows your agent to utilize the Google Places API in order to find addresses, phone numbers, website, etc. from text about a location listed on Google Places. ## Setup You will need to get an...
langchainjs/docs/core_docs/docs/integrations/tools/google_places.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/tools/google_places.mdx", "repo_id": "langchainjs", "token_count": 294 }
717
<!--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/installation.md/0
{ "file_path": "diffusers/docs/source/en/installation.md", "repo_id": "diffusers", "token_count": 1585 }
184
import { test, expect } from "@jest/globals"; import { JsonListKeysTool, JsonSpec, JsonGetValueTool, } from "../../tools/json.js"; test("JsonListKeysTool", async () => { const jsonSpec = new JsonSpec({ foo: "bar", baz: { test: { foo: [1, 2, 3], qux: [{ x: 1, y: 2, z: 3 }, { a: 1 }] } }, }); const j...
langchainjs/langchain/src/agents/tests/json.test.ts/0
{ "file_path": "langchainjs/langchain/src/agents/tests/json.test.ts", "repo_id": "langchainjs", "token_count": 1747 }
871
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from eli5_utils import ( embed_questions_for_retrieval, make_qa_s2s_model, qa_s2s_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impor...
transformers/examples/research_projects/longform-qa/eli5_app.py/0
{ "file_path": "transformers/examples/research_projects/longform-qa/eli5_app.py", "repo_id": "transformers", "token_count": 5818 }
579
"""NebulaGraph Query Engine Pack.""" import os from enum import Enum from typing import Any, Dict, List, Optional from llama_index.core import ( KnowledgeGraphIndex, QueryBundle, ServiceContext, StorageContext, VectorStoreIndex, get_response_synthesizer, ) from llama_index.core.llama_pack.base...
llama_index/llama-index-packs/llama-index-packs-nebulagraph-query-engine/llama_index/packs/nebulagraph_query_engine/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-nebulagraph-query-engine/llama_index/packs/nebulagraph_query_engine/base.py", "repo_id": "llama_index", "token_count": 3533 }
1,802
/* eslint-disable @typescript-eslint/no-explicit-any */ import { jest, test, expect } from "@jest/globals"; import { FakeEmbeddings } from "@langchain/core/utils/testing"; import { PineconeStore } from "../vectorstores.js"; test("PineconeStore with external ids", async () => { const upsert = jest.fn(); const clien...
langchainjs/libs/langchain-pinecone/src/tests/vectorstores.test.ts/0
{ "file_path": "langchainjs/libs/langchain-pinecone/src/tests/vectorstores.test.ts", "repo_id": "langchainjs", "token_count": 1260 }
1,041
// 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/core/src/storage/parquet_c.cpp/0
{ "file_path": "milvus/internal/core/src/storage/parquet_c.cpp", "repo_id": "milvus", "token_count": 6656 }
1,810
""" Random Erasing (Cutout) Originally inspired by impl at https://github.com/zhunzhong07/Random-Erasing, Apache 2.0 Copyright Zhun Zhong & Liang Zheng Hacked together by / Copyright 2019, Ross Wightman """ import random import math import torch def _get_pixels(per_pixel, rand_color, patch_size, dtype=torch.float3...
pytorch-image-models/timm/data/random_erasing.py/0
{ "file_path": "pytorch-image-models/timm/data/random_erasing.py", "repo_id": "pytorch-image-models", "token_count": 2258 }
339
# LlamaIndex Readers Integration: File
llama_index/llama-index-integrations/readers/llama-index-readers-file/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/README.md", "repo_id": "llama_index", "token_count": 9 }
1,434
import { Redis, type RedisConfigNodejs } from "@upstash/redis"; import { Generation } from "@langchain/core/outputs"; import { BaseCache, deserializeStoredGeneration, getCacheKey, serializeGeneration, } from "@langchain/core/caches"; import { StoredGeneration } from "@langchain/core/messages"; export type Ups...
langchainjs/libs/langchain-community/src/caches/upstash_redis.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/caches/upstash_redis.ts", "repo_id": "langchainjs", "token_count": 947 }
947
from typing import Any, List def _get_anthropic_client() -> Any: try: import anthropic except ImportError: raise ImportError( "Could not import anthropic python package. " "This is needed in order to accurately tokenize the text " "for anthropic models. Plea...
langchain/libs/community/langchain_community/utilities/anthropic.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/anthropic.py", "repo_id": "langchain", "token_count": 317 }
298
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, ...
chroma/clients/js/LICENSE/0
{ "file_path": "chroma/clients/js/LICENSE", "repo_id": "chroma", "token_count": 3168 }
29
"""Init params."""
llama_index/llama-index-legacy/tests/postprocessor/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/postprocessor/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,630
<!--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/zh/internal/modeling_utils.md/0
{ "file_path": "transformers/docs/source/zh/internal/modeling_utils.md", "repo_id": "transformers", "token_count": 845 }
549
import glob import time from yaml import full_load import json import pandas as pd from utils.util_log import test_log as log def gen_experiment_config(yaml): """load the yaml file of chaos experiment""" with open(yaml) as f: _config = full_load(f) f.close() return _config def findkeys(no...
milvus/tests/python_client/utils/util_common.py/0
{ "file_path": "milvus/tests/python_client/utils/util_common.py", "repo_id": "milvus", "token_count": 2037 }
1,976
<!--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/en/model_doc/dialogpt.md/0
{ "file_path": "transformers/docs/source/en/model_doc/dialogpt.md", "repo_id": "transformers", "token_count": 789 }
502
# Generated content DO NOT EDIT from .. import functional avg_pool2d = functional.avg_pool2d gelu = functional.gelu max_pool2d = functional.max_pool2d relu = functional.relu silu = functional.silu softmax = functional.softmax tanh = functional.tanh
candle/candle-pyo3/py_src/candle/functional/__init__.py/0
{ "file_path": "candle/candle-pyo3/py_src/candle/functional/__init__.py", "repo_id": "candle", "token_count": 84 }
72
import json import uuid from typing import List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader from langchain_community.tools.nuclia.tool import NucliaUnderstandingAPI class NucliaLoader(BaseLoader): """Load from any file type using `Nuclia Underst...
langchain/libs/community/langchain_community/document_loaders/nuclia.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/nuclia.py", "repo_id": "langchain", "token_count": 465 }
260
import { test, expect, jest } from "@jest/globals"; import { HumanMessage, ToolMessage } from "@langchain/core/messages"; import { InMemoryCache } from "@langchain/core/caches"; import { ChatOpenAI } from "../chat_models.js"; test("Test ChatOpenAI JSON mode", async () => { const chat = new ChatOpenAI({ modelName...
langchainjs/libs/langchain-openai/src/tests/chat_models-extended.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-openai/src/tests/chat_models-extended.int.test.ts", "repo_id": "langchainjs", "token_count": 2600 }
1,105
import { OpenAI } from "@langchain/openai"; import { ConsoleCallbackHandler } from "@langchain/core/tracers/console"; const llm = new OpenAI({ temperature: 0, // These tags will be attached to all calls made with this LLM. tags: ["example", "callbacks", "constructor"], // This handler will be used for all call...
langchainjs/examples/src/callbacks/docs_constructor_callbacks.ts/0
{ "file_path": "langchainjs/examples/src/callbacks/docs_constructor_callbacks.ts", "repo_id": "langchainjs", "token_count": 112 }
758
// 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/core/src/exec/Driver.cpp/0
{ "file_path": "milvus/internal/core/src/exec/Driver.cpp", "repo_id": "milvus", "token_count": 7248 }
1,642
""" Develop integration packages for LangChain. """ import re import shutil import subprocess from pathlib import Path from typing import Optional import typer from typing_extensions import Annotated, TypedDict from langchain_cli.utils.find_replace import replace_glob integration_cli = typer.Typer(no_args_is_help=T...
langchain/libs/cli/langchain_cli/namespaces/integration.py/0
{ "file_path": "langchain/libs/cli/langchain_cli/namespaces/integration.py", "repo_id": "langchain", "token_count": 1625 }
209
# Module Guides ## Basic First, check out our [module guide on Indexes](/module_guides/indexing/modules.md) for in-depth guides for each index (vector index, summary index, knowledge graph index). Each index corresponds to a default query engine for that index. Then check out the rest of the sections below. ```{toc...
llama_index/docs/module_guides/deploying/query_engine/modules.md/0
{ "file_path": "llama_index/docs/module_guides/deploying/query_engine/modules.md", "repo_id": "llama_index", "token_count": 852 }
1,098
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "embeddings/tensorflow", }); export * from "@langchain/community/embeddings/tensorflow";
langchainjs/langchain/src/embeddings/tensorflow.ts/0
{ "file_path": "langchainjs/langchain/src/embeddings/tensorflow.ts", "repo_id": "langchainjs", "token_count": 76 }
917
"""Test the LangSmith client.""" import asyncio import dataclasses import gc import itertools import json import os import threading import time import uuid import weakref from datetime import datetime from enum import Enum from io import BytesIO from typing import Any, NamedTuple, Optional from unittest import mock f...
langsmith-sdk/python/tests/unit_tests/test_client.py/0
{ "file_path": "langsmith-sdk/python/tests/unit_tests/test_client.py", "repo_id": "langsmith-sdk", "token_count": 10665 }
1,072
## The relevant files are currently on a shared Google ## drive at https://drive.google.com/drive/folders/1kC0I2UGl2ltrluI9NqDjaQJGw5iliw_J ## Monitor for changes and eventually migrate to use the `datasets` library curl -L 'https://drive.google.com/uc?export=download&id=1Jjhbal535VVz2ap4v4r_rN1UEHTdLK5P' \ | grep -v "...
transformers/examples/legacy/token-classification/run.sh/0
{ "file_path": "transformers/examples/legacy/token-classification/run.sh", "repo_id": "transformers", "token_count": 648 }
584
import { test, expect } from "@jest/globals"; import { ChatOpenAI, OpenAIChat } from "@langchain/openai"; import { SystemMessage } from "@langchain/core/messages"; import { ConversationSummaryMemory } from "../summary.js"; test("Test summary memory", async () => { const memory = new ConversationSummaryMemory({ l...
langchainjs/langchain/src/memory/tests/summary.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/memory/tests/summary.int.test.ts", "repo_id": "langchainjs", "token_count": 664 }
972
// 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/tests/integration/crossclusterrouting/cross_cluster_routing_test.go/0
{ "file_path": "milvus/tests/integration/crossclusterrouting/cross_cluster_routing_test.go", "repo_id": "milvus", "token_count": 1902 }
1,980
/* * 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...
milvus/pkg/mq/msgstream/msg_for_collection_test.go/0
{ "file_path": "milvus/pkg/mq/msgstream/msg_for_collection_test.go", "repo_id": "milvus", "token_count": 1762 }
1,819
<jupyter_start><jupyter_text>IFTTT WebHooksThis notebook shows how to use IFTTT Webhooks.From https://github.com/SidU/teams-langchain-js/wiki/Connecting-IFTTT-Services. Creating a webhook- Go to https://ifttt.com/create Configuring the "If This"- Click on the "If This" button in the IFTTT interface.- Search for "Webhoo...
langchain/docs/docs/integrations/tools/ifttt.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/ifttt.ipynb", "repo_id": "langchain", "token_count": 575 }
175
# coding=utf-8 # Copyright 2024 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...
diffusers/tests/pipelines/text_to_video_synthesis/test_text_to_video_zero_sdxl.py/0
{ "file_path": "diffusers/tests/pipelines/text_to_video_synthesis/test_text_to_video_zero_sdxl.py", "repo_id": "diffusers", "token_count": 7187 }
286
<jupyter_start><jupyter_text>Exact Match[](https://colab.research.google.com/github/langchain-ai/langchain/blob/master/docs/docs/guides/evaluation/string/exact_match.ipynb)Probably the simplest ways to evaluate an LLM or runnable's string output against a reference label is by a simple string equivalence.This can be ac...
langchain/docs/docs/guides/evaluation/string/exact_match.ipynb/0
{ "file_path": "langchain/docs/docs/guides/evaluation/string/exact_match.ipynb", "repo_id": "langchain", "token_count": 453 }
90
use anyhow::Result; use candle_core::{DType, Device::Cpu, Tensor}; #[test] fn display_scalar() -> Result<()> { let t = Tensor::new(1234u32, &Cpu)?; let s = format!("{t}"); assert_eq!(&s, "[1234]\nTensor[[], u32]"); let t = t.to_dtype(DType::F32)?.neg()?; let s = format!("{}", (&t / 10.0)?); ass...
candle/candle-core/tests/display_tests.rs/0
{ "file_path": "candle/candle-core/tests/display_tests.rs", "repo_id": "candle", "token_count": 1395 }
34
libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: Rocksdb Description: Rocksdb Version: @ROCKSDB_VERSION@ Libs: -L${libdir} -lrocksdb Libs.private: -lz -lbz2 Cflags: -I${includedir}
milvus/internal/core/thirdparty/rocksdb/rocksdb.pc.in/0
{ "file_path": "milvus/internal/core/thirdparty/rocksdb/rocksdb.pc.in", "repo_id": "milvus", "token_count": 101 }
1,671
const fs = require("node:fs/promises"); const { glob } = require("glob"); async function main() { const allIpynb = await glob("./docs/**/*.ipynb"); // iterate over each & rename to `.mdx` if a `.md` already exists const renamePromise = allIpynb.flatMap(async (ipynb) => { const md = ipynb.replace(".ipynb", "....
langchainjs/docs/core_docs/scripts/quatro-build.js/0
{ "file_path": "langchainjs/docs/core_docs/scripts/quatro-build.js", "repo_id": "langchainjs", "token_count": 651 }
746
from langchain_core.stores import BaseStore, K, V __all__ = ["BaseStore", "K", "V"]
langchain/libs/langchain/langchain/schema/storage.py/0
{ "file_path": "langchain/libs/langchain/langchain/schema/storage.py", "repo_id": "langchain", "token_count": 31 }
550
// 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/proxy/management_test.go/0
{ "file_path": "milvus/internal/proxy/management_test.go", "repo_id": "milvus", "token_count": 1978 }
1,739
from typing import ( Any, AsyncIterator, Awaitable, Callable, Iterator, List, Mapping, Optional, Sequence, Tuple, Type, Union, cast, ) from langchain_core.load.dump import dumpd from langchain_core.pydantic_v1 import BaseModel from langchain_core.runnables.base impor...
langchain/libs/core/langchain_core/runnables/branch.py/0
{ "file_path": "langchain/libs/core/langchain_core/runnables/branch.py", "repo_id": "langchain", "token_count": 8017 }
397
# vertexai-chuck-norris This template makes jokes about Chuck Norris using Vertex AI PaLM2. ## Environment Setup First, make sure you have a Google Cloud project with an active billing account, and have the [gcloud CLI installed](https://cloud.google.com/sdk/docs/install). Configure [application default credentia...
langchain/templates/vertexai-chuck-norris/README.md/0
{ "file_path": "langchain/templates/vertexai-chuck-norris/README.md", "repo_id": "langchain", "token_count": 813 }
759
import enum # Before Python 3.11 native StrEnum is not available class StrEnum(str, enum.Enum): """A string enum.""" pass
langgraph/langgraph/utils.py/0
{ "file_path": "langgraph/langgraph/utils.py", "repo_id": "langgraph", "token_count": 46 }
1,006
""" Adan Optimizer Adan: Adaptive Nesterov Momentum Algorithm for Faster Optimizing Deep Models[J]. arXiv preprint arXiv:2208.06677, 2022. https://arxiv.org/abs/2208.06677 Implementation adapted from https://github.com/sail-sg/Adan """ import math import torch from torch.optim import Optimizer class Adan(Opt...
pytorch-image-models/timm/optim/adan.py/0
{ "file_path": "pytorch-image-models/timm/optim/adan.py", "repo_id": "pytorch-image-models", "token_count": 2501 }
361
"""Chroma Auto-retrieval Pack.""" from typing import Any, Dict, List, Optional from llama_index.core.indices.vector_store import VectorStoreIndex from llama_index.core.indices.vector_store.retrievers import ( VectorIndexAutoRetriever, ) from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index....
llama_index/llama-index-packs/llama-index-packs-chroma-autoretrieval/llama_index/packs/chroma_autoretrieval/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-chroma-autoretrieval/llama_index/packs/chroma_autoretrieval/base.py", "repo_id": "llama_index", "token_count": 1034 }
1,776
from llama_index.readers.earnings_call_transcript.base import EarningsCallTranscript __all__ = ["EarningsCallTranscript"]
llama_index/llama-index-integrations/readers/llama-index-readers-earnings-call-transcript/llama_index/readers/earnings_call_transcript/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-earnings-call-transcript/llama_index/readers/earnings_call_transcript/__init__.py", "repo_id": "llama_index", "token_count": 38 }
1,286
# Copyright 2024 Peter Willemsen <peter@codebuffet.co>. 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 requ...
diffusers/examples/community/tiled_upscaling.py/0
{ "file_path": "diffusers/examples/community/tiled_upscaling.py", "repo_id": "diffusers", "token_count": 5904 }
191
syntax = "proto3"; package chroma; option go_package = "github.com/chroma/chroma-coordinator/internal/proto/coordinatorpb"; import "chromadb/proto/chroma.proto"; import "google/protobuf/empty.proto"; message CreateDatabaseRequest { string id = 1; string name = 2; string tenant = 3; } message GetDatabaseReques...
chroma/idl/chromadb/proto/coordinator.proto/0
{ "file_path": "chroma/idl/chromadb/proto/coordinator.proto", "repo_id": "chroma", "token_count": 1020 }
52
# Reddit Reader For any subreddit(s) you're interested in, search for relevant posts using keyword(s) and load the resulting text in the post and and top-level comments into LLMs/ LangChains. ## Get your Reddit credentials ready 1. Visit Reddit App Preferences (https://www.reddit.com/prefs/apps) or [https://old.redd...
llama_index/llama-index-integrations/readers/llama-index-readers-reddit/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-reddit/README.md", "repo_id": "llama_index", "token_count": 819 }
1,372
"""Simple file node parser.""" from typing import Any, Dict, List, Optional, Sequence, Type from llama_index.legacy.callbacks.base import CallbackManager from llama_index.legacy.node_parser.file.html import HTMLNodeParser from llama_index.legacy.node_parser.file.json import JSONNodeParser from llama_index.legacy.node...
llama_index/llama-index-legacy/llama_index/legacy/node_parser/file/simple_file.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/node_parser/file/simple_file.py", "repo_id": "llama_index", "token_count": 1157 }
1,583
# coding=utf-8 # Copyright 2020 The Google AI Language Team Authors, The HuggingFace Inc. team and Microsoft Corporation. # 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....
transformers/examples/research_projects/bert-loses-patience/pabee/modeling_pabee_bert.py/0
{ "file_path": "transformers/examples/research_projects/bert-loses-patience/pabee/modeling_pabee_bert.py", "repo_id": "transformers", "token_count": 6750 }
530
# AlephAlpha LangChain.js supports AlephAlpha's Luminous family of models. You'll need to sign up for an API key [on their website](https://www.aleph-alpha.com/). Here's an example: import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <IntegrationInstallTooltip></IntegrationInsta...
langchainjs/docs/core_docs/docs/integrations/llms/aleph_alpha.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/llms/aleph_alpha.mdx", "repo_id": "langchainjs", "token_count": 175 }
783
"""Default query for EmptyIndex.""" from typing import Any, List, Optional from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.callbacks.base import CallbackManager from llama_index.core.indices.empty.base import EmptyIndex from llama_index.core.prompts import BasePromptTemplate from l...
llama_index/llama-index-core/llama_index/core/indices/empty/retrievers.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/empty/retrievers.py", "repo_id": "llama_index", "token_count": 488 }
1,127
// Copyright (C) 2019-2023 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/internal/core/src/simd/neon.cpp/0
{ "file_path": "milvus/internal/core/src/simd/neon.cpp", "repo_id": "milvus", "token_count": 1544 }
1,741
"""Mock LLM Predictor.""" from typing import Any, Dict from deprecated import deprecated from llama_index.legacy.bridge.pydantic import Field, PrivateAttr from llama_index.legacy.callbacks.base import CallbackManager from llama_index.legacy.constants import DEFAULT_NUM_OUTPUTS from llama_index.legacy.core.llms.types...
llama_index/llama-index-legacy/llama_index/legacy/llm_predictor/mock.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llm_predictor/mock.py", "repo_id": "llama_index", "token_count": 2339 }
1,675
<!--Copyright 2022 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/en/model_doc/xlm-roberta-xl.md/0
{ "file_path": "transformers/docs/source/en/model_doc/xlm-roberta-xl.md", "repo_id": "transformers", "token_count": 969 }
523
import unittest import torch from transformers import AutoTokenizer, GenerationConfig from trl import AutoModelForCausalLMWithValueHead from trl.core import LengthSampler from trl.extras import BestOfNSampler def queries_to_scores(list_of_strings): return [torch.rand(1).item() for _ in list_of_strings] class ...
trl/tests/test_best_of_n_sampler.py/0
{ "file_path": "trl/tests/test_best_of_n_sampler.py", "repo_id": "trl", "token_count": 1507 }
789
{ "name": "test-exports-tsc", "version": "0.0.0", "type": "module", "workspaces": [ "libs/*" ], "private": true, "description": "TSC Tests for the things exported by the langchain package", "main": "./index.mjs", "scripts": { "build": "tsc -m nodenext main.ts", "test": "node ./main.js" }...
langchainjs/environment_tests/test-exports-tsc/package.json/0
{ "file_path": "langchainjs/environment_tests/test-exports-tsc/package.json", "repo_id": "langchainjs", "token_count": 303 }
752
from __future__ import annotations from typing import TYPE_CHECKING, Any, Dict, List from langchain_core.callbacks import ( AsyncCallbackManagerForRetrieverRun, CallbackManagerForRetrieverRun, ) from langchain_core.documents import Document from langchain_core.language_models.chat_models import BaseChatModel ...
langchain/libs/community/langchain_community/retrievers/cohere_rag_retriever.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/cohere_rag_retriever.py", "repo_id": "langchain", "token_count": 1222 }
276
from langchain_community.chat_models.databricks import ChatDatabricks __all__ = ["ChatDatabricks"]
langchain/libs/langchain/langchain/chat_models/databricks.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_models/databricks.py", "repo_id": "langchain", "token_count": 31 }
479
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/indices/composability/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/composability/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,713
from langchain_community.chat_models.baichuan import ( ChatBaichuan, ) __all__ = [ "ChatBaichuan", ]
langchain/libs/langchain/langchain/chat_models/baichuan.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_models/baichuan.py", "repo_id": "langchain", "token_count": 46 }
516
# langchain-robocorp This package contains the LangChain integrations for [Robocorp](https://github.com/robocorp/robocorp). ## Installation ```bash pip install -U langchain-robocorp ``` ## Action Server Toolkit See [ActionServerToolkit](https://python.langchain.com/docs/integrations/toolkits/robocorp) for detailed...
langchain/libs/partners/robocorp/README.md/0
{ "file_path": "langchain/libs/partners/robocorp/README.md", "repo_id": "langchain", "token_count": 104 }
640
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-uptrain/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-uptrain/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,171
# agent runner + agent worker from llama_index.core.agent.custom.pipeline_worker import QueryPipelineAgentWorker from llama_index.core.agent.custom.simple import CustomSimpleAgentWorker from llama_index.core.agent.react.base import ReActAgent from llama_index.core.agent.react.formatter import ReActChatFormatter from ll...
llama_index/llama-index-core/llama_index/core/agent/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/agent/__init__.py", "repo_id": "llama_index", "token_count": 336 }
1,173
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename URL = "http://www.mocksite.com/file1.txt" CONTENT = '"text": ["foo", "fo...
datasets/tests/test_download_manager.py/0
{ "file_path": "datasets/tests/test_download_manager.py", "repo_id": "datasets", "token_count": 2407 }
143
from typing import Iterator, List, Optional from langchain_community.docstore.document import Document from langchain_community.document_loaders.base import BaseLoader from langchain_community.document_loaders.unstructured import UnstructuredFileIOLoader class AzureAIDataLoader(BaseLoader): """Load from Azure AI...
langchain/libs/community/langchain_community/document_loaders/azure_ai_data.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/azure_ai_data.py", "repo_id": "langchain", "token_count": 630 }
231
import { ChatOpenAI } from "@langchain/openai"; import { PromptTemplate } from "@langchain/core/prompts"; const model = new ChatOpenAI({}); const promptTemplate = PromptTemplate.fromTemplate( "Tell me a joke about {topic}" ); const chain = promptTemplate.pipe(model); const stream = await chain.stream({ topic: "bea...
langchainjs/examples/src/guides/expression_language/interface_stream.ts/0
{ "file_path": "langchainjs/examples/src/guides/expression_language/interface_stream.ts", "repo_id": "langchainjs", "token_count": 154 }
809
from llama_index.core.readers.base import BaseReader from llama_index.readers.chroma import ChromaReader def test_class(): names_of_base_classes = [b.__name__ for b in ChromaReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-chroma/tests/test_readers_chroma.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-chroma/tests/test_readers_chroma.py", "repo_id": "llama_index", "token_count": 88 }
1,347
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-semanticscholar/llama_index/readers/semanticscholar/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-semanticscholar/llama_index/readers/semanticscholar/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,551
"""Playwright web browser toolkit.""" from __future__ import annotations from typing import TYPE_CHECKING, List, Optional, Type, cast from langchain_core.pydantic_v1 import Extra, root_validator from langchain_core.tools import BaseTool from langchain_community.agent_toolkits.base import BaseToolkit from langchain_c...
langchain/libs/community/langchain_community/agent_toolkits/playwright/toolkit.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/playwright/toolkit.py", "repo_id": "langchain", "token_count": 1478 }
227
import argparse import logging import os import sys import tensorflow as tf from datasets import load_dataset from transformers import AutoTokenizer, TFAutoModelForSequenceClassification, DataCollatorWithPadding, create_optimizer if __name__ == "__main__": parser = argparse.ArgumentParser() # Hyperparamete...
notebooks/sagemaker/02_getting_started_tensorflow/scripts/train.py/0
{ "file_path": "notebooks/sagemaker/02_getting_started_tensorflow/scripts/train.py", "repo_id": "notebooks", "token_count": 1677 }
311
from sql_llamacpp.chain import chain __all__ = ["chain"]
langchain/templates/sql-llamacpp/sql_llamacpp/__init__.py/0
{ "file_path": "langchain/templates/sql-llamacpp/sql_llamacpp/__init__.py", "repo_id": "langchain", "token_count": 20 }
703
"""Init params.""" from llama_index.finetuning.embeddings.adapter import EmbeddingAdapterFinetuneEngine from llama_index.finetuning.embeddings.sentence_transformer import ( SentenceTransformersFinetuneEngine, ) __all__ = ["EmbeddingAdapterFinetuneEngine", "SentenceTransformersFinetuneEngine"]
llama_index/llama-index-finetuning/llama_index/finetuning/embeddings/__init__.py/0
{ "file_path": "llama_index/llama-index-finetuning/llama_index/finetuning/embeddings/__init__.py", "repo_id": "llama_index", "token_count": 95 }
1,252
# coding=utf-8 # Copyright 2022 SHI Labs and The HuggingFace Inc. 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...
transformers/src/transformers/models/nat/modeling_nat.py/0
{ "file_path": "transformers/src/transformers/models/nat/modeling_nat.py", "repo_id": "transformers", "token_count": 16471 }
720
# Time Travel Implementation (Segment Level) Currently, there are two paths to implement time travel: 1. Restrict with vec_count, used in growing segment. 2. Generate bitmask and combine it with DSL calculation results. It is mainly used in the sealed segment. ## Growing Segment Time Travel 1. When inserting, ensure...
milvus/docs/design_docs/segcore/timetravel.md/0
{ "file_path": "milvus/docs/design_docs/segcore/timetravel.md", "repo_id": "milvus", "token_count": 357 }
1,908
"""Vector-store based data structures.""" from llama_index.legacy.indices.multi_modal.base import MultiModalVectorStoreIndex from llama_index.legacy.indices.multi_modal.retriever import ( MultiModalVectorIndexRetriever, ) __all__ = [ "MultiModalVectorStoreIndex", "MultiModalVectorIndexRetriever", ]
llama_index/llama-index-legacy/llama_index/legacy/indices/multi_modal/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/multi_modal/__init__.py", "repo_id": "llama_index", "token_count": 110 }
1,563
// 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/datacoord/channel_checker_test.go/0
{ "file_path": "milvus/internal/datacoord/channel_checker_test.go", "repo_id": "milvus", "token_count": 3007 }
1,824
# 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 applicabl...
diffusers/src/diffusers/pipelines/stable_diffusion/safety_checker_flax.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion/safety_checker_flax.py", "repo_id": "diffusers", "token_count": 1822 }
263
import { test } from "@jest/globals"; import { Document } from "@langchain/core/documents"; import { OpenAIEmbeddings, OpenAI } from "@langchain/openai"; import { Chroma } from "@langchain/community/vectorstores/chroma"; import { AttributeInfo } from "../../../schema/query_constructor.js"; import { SelfQueryRetriever }...
langchainjs/langchain/src/retrievers/self_query/tests/chroma_self_query.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/self_query/tests/chroma_self_query.int.test.ts", "repo_id": "langchainjs", "token_count": 1196 }
930
# coding=utf-8 # Copyright 2019-present, 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 a...
transformers/examples/research_projects/distillation/scripts/token_counts.py/0
{ "file_path": "transformers/examples/research_projects/distillation/scripts/token_counts.py", "repo_id": "transformers", "token_count": 725 }
560
# coding=utf-8 # Copyright 2020 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/tests/trainer/test_trainer_seq2seq.py/0
{ "file_path": "transformers/tests/trainer/test_trainer_seq2seq.py", "repo_id": "transformers", "token_count": 3232 }
863
# WatsonX AI LangChain.js supports integration with IBM WatsonX AI. Checkout [WatsonX AI](https://www.ibm.com/products/watsonx-ai) for a list of available models. ## Setup You will need to set the following environment variables for using the WatsonX AI API. 1. `IBM_CLOUD_API_KEY` which can be generated via [IBM Cl...
langchainjs/docs/core_docs/docs/integrations/llms/watsonx_ai.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/llms/watsonx_ai.mdx", "repo_id": "langchainjs", "token_count": 372 }
732
<jupyter_start><jupyter_text>Cloudflare Workers AI[Cloudflare AI documentation](https://developers.cloudflare.com/workers-ai/models/text-generation/) listed all generative text models available.Both Cloudflare account ID and API token are required. Find how to obtain them from [this document](https://developers.cloudfl...
langchain/docs/docs/integrations/llms/cloudflare_workersai.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/cloudflare_workersai.ipynb", "repo_id": "langchain", "token_count": 770 }
120
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and 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 # # U...
transformers/src/transformers/models/albert/tokenization_albert.py/0
{ "file_path": "transformers/src/transformers/models/albert/tokenization_albert.py", "repo_id": "transformers", "token_count": 6859 }
630
// 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/pkg/util/funcutil/parallel.go/0
{ "file_path": "milvus/pkg/util/funcutil/parallel.go", "repo_id": "milvus", "token_count": 1924 }
1,827
// 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/querynodev2/segments/plan.go/0
{ "file_path": "milvus/internal/querynodev2/segments/plan.go", "repo_id": "milvus", "token_count": 2119 }
1,911