text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. # # 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....
datasets/templates/new_dataset_script.py/0
{ "file_path": "datasets/templates/new_dataset_script.py", "repo_id": "datasets", "token_count": 3156 }
154
<jupyter_start><jupyter_text>Qdrant Hybrid SearchQdrant supports hybrid search by combining search results from `sparse` and `dense` vectors.`dense` vectors are the ones you have probably already been using -- embedding models from OpenAI, BGE, SentenceTransformers, etc. are typically `dense` embedding models. They cre...
llama_index/docs/examples/vector_stores/qdrant_hybrid.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/qdrant_hybrid.ipynb", "repo_id": "llama_index", "token_count": 4432 }
1,221
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-papers/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-papers/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,362
import { ConstitutionalPrinciple, ConstitutionalChain, LLMChain, } from "langchain/chains"; import { OpenAI } from "@langchain/openai"; import { PromptTemplate } from "@langchain/core/prompts"; // LLMs can produce harmful, toxic, or otherwise undesirable outputs. This chain allows you to apply a set of constitut...
langchainjs/examples/src/chains/constitutional_chain.ts/0
{ "file_path": "langchainjs/examples/src/chains/constitutional_chain.ts", "repo_id": "langchainjs", "token_count": 410 }
774
from pathlib import Path from langchain_community.document_loaders import UnstructuredODTLoader def test_unstructured_odt_loader() -> None: """Test unstructured loader.""" file_path = Path(__file__).parent.parent / "examples/fake.odt" loader = UnstructuredODTLoader(str(file_path)) docs = loader.load(...
langchain/libs/community/tests/integration_tests/document_loaders/test_odt.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_odt.py", "repo_id": "langchain", "token_count": 121 }
343
from enum import Enum from typing import Any, Mapping, Optional, Sequence from langchain_core.messages import AnyMessage from langchain_core.runnables import ( ConfigurableField, ConfigurableFieldMultiOption, RunnableBinding, ) from langgraph.checkpoint import CheckpointAt from app.agent_types.google_agen...
opengpts/backend/app/agent.py/0
{ "file_path": "opengpts/backend/app/agent.py", "repo_id": "opengpts", "token_count": 4896 }
1,912
import unittest import pytest from langchain_community.document_loaders.parsers.language.go import GoSegmenter @pytest.mark.requires("tree_sitter", "tree_sitter_languages") class TestGoSegmenter(unittest.TestCase): def setUp(self) -> None: self.example_code = """func foo(a int) int { return a; } ty...
langchain/libs/community/tests/unit_tests/document_loaders/parsers/language/test_go.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/parsers/language/test_go.py", "repo_id": "langchain", "token_count": 600 }
388
import { MistralAIEmbeddings } from "@langchain/mistralai"; /* Embed queries */ const embeddings = new MistralAIEmbeddings({ apiKey: process.env.MISTRAL_API_KEY, }); const res = await embeddings.embedQuery("Hello world"); console.log(res); /* Embed documents */ const documentRes = await embeddings.embedDocuments(["H...
langchainjs/examples/src/models/embeddings/mistral.ts/0
{ "file_path": "langchainjs/examples/src/models/embeddings/mistral.ts", "repo_id": "langchainjs", "token_count": 121 }
836
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-myscale/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-myscale/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,666
from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension import torch extra_compile_args = ["-std=c++17"] if not torch.version.hip: extra_compile_args.append("-arch=compute_80") setup( name="custom_kernels", ext_modules=[ CUDAExtension( name="cus...
text-generation-inference/server/custom_kernels/setup.py/0
{ "file_path": "text-generation-inference/server/custom_kernels/setup.py", "repo_id": "text-generation-inference", "token_count": 342 }
433
from langchain_community.tools.sleep.tool import SleepInput, SleepTool __all__ = ["SleepInput", "SleepTool"]
langchain/libs/langchain/langchain/tools/sleep/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/sleep/tool.py", "repo_id": "langchain", "token_count": 32 }
590
# rag-gemini-multi-modal Multi-modal LLMs enable visual assistants that can perform question-answering about images. This template create a visual assistant for slide decks, which often contain visuals such as graphs or figures. It uses OpenCLIP embeddings to embed all of the slide images and stores them in Chroma...
langchain/templates/rag-gemini-multi-modal/README.md/0
{ "file_path": "langchain/templates/rag-gemini-multi-modal/README.md", "repo_id": "langchain", "token_count": 1254 }
675
import asyncio import functools import inspect import json import os import time import warnings from typing import Any from unittest.mock import MagicMock, patch import pytest from langsmith import Client from langsmith.run_helpers import ( _get_inputs, as_runnable, is_traceable_function, traceable, ...
langsmith-sdk/python/tests/unit_tests/test_run_helpers.py/0
{ "file_path": "langsmith-sdk/python/tests/unit_tests/test_run_helpers.py", "repo_id": "langsmith-sdk", "token_count": 5348 }
1,074
# Inspired by: https://github.com/haofanwang/ControlNet-for-Diffusers/ import inspect from typing import Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np import PIL.Image import torch import torch.nn.functional as F from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from di...
diffusers/examples/community/stable_diffusion_controlnet_inpaint.py/0
{ "file_path": "diffusers/examples/community/stable_diffusion_controlnet_inpaint.py", "repo_id": "diffusers", "token_count": 25229 }
211
import logging from typing import Any, List, Optional from llama_index.legacy.bridge.pydantic import Field, PrivateAttr from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.constants import DEFAULT_EMBED_BATCH_SIZE from llama_index.legacy.core.embeddings.base import BaseEmbedding logger = ...
llama_index/llama-index-legacy/llama_index/legacy/embeddings/clarifai.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/embeddings/clarifai.py", "repo_id": "llama_index", "token_count": 2362 }
1,509
build_performance: collections: - server: db_config.primary_path: /test/milvus/db_data_011/sift_10m_100000_128_l2_sq8_4096 cache_config.cpu_cache_capacity: 32GB engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: tr...
milvus/tests/benchmark/milvus_benchmark/suites/011_gpu_build_debug.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/011_gpu_build_debug.yaml", "repo_id": "milvus", "token_count": 2699 }
1,969
search_performance: collections: - server: db_config.primary_path: /test/milvus/db_data_010/shards_sift_1m_128_128_l2_insert wal_enable: true collection_name: sift_1m_1024_128_l2 run_count: 2 top_ks: [1, 10, 100] nqs: [1, 10, 100] search_params: - nprobe...
milvus/tests/benchmark/milvus_benchmark/suites/shards_search_performance_sift1m.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/shards_search_performance_sift1m.yaml", "repo_id": "milvus", "token_count": 171 }
1,978
// 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/retrieve.go/0
{ "file_path": "milvus/internal/querynodev2/segments/retrieve.go", "repo_id": "milvus", "token_count": 1962 }
1,844
python_tests()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-sagemaker-endpoint/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-sagemaker-endpoint/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,272
// 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/util/importutil/json_parser_test.go/0
{ "file_path": "milvus/internal/util/importutil/json_parser_test.go", "repo_id": "milvus", "token_count": 8901 }
1,797
"""Chain that tries to verify assumptions before answering a question. Heavily borrowed from https://github.com/jagilley/fact-checker """
langchain/libs/langchain/langchain/chains/llm_checker/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/llm_checker/__init__.py", "repo_id": "langchain", "token_count": 37 }
462
python_sources()
llama_index/llama-index-packs/llama-index-packs-fusion-retriever/examples/hybrid_fusion/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-fusion-retriever/examples/hybrid_fusion/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,565
import { type EvalResults, type RunOnDatasetParams, runOnDataset, } from "./runner_utils.js"; export { type EvalResults, type RunOnDatasetParams, runOnDataset }; export * from "./config.js";
langchainjs/langchain/src/smith/index.ts/0
{ "file_path": "langchainjs/langchain/src/smith/index.ts", "repo_id": "langchainjs", "token_count": 72 }
909
# coding=utf-8 # Copyright 2023 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 # # Unless r...
transformers/tests/models/efficientformer/test_modeling_tf_efficientformer.py/0
{ "file_path": "transformers/tests/models/efficientformer/test_modeling_tf_efficientformer.py", "repo_id": "transformers", "token_count": 7249 }
758
import os import tempfile from datetime import datetime, timedelta import requests from langchain.text_splitter import CharacterTextSplitter from langchain_community.document_loaders import JSONLoader from langchain_community.embeddings.openai import OpenAIEmbeddings from langchain_community.vectorstores.timescalevect...
langchain/templates/rag-timescale-conversation/rag_timescale_conversation/load_sample_dataset.py/0
{ "file_path": "langchain/templates/rag-timescale-conversation/rag_timescale_conversation/load_sample_dataset.py", "repo_id": "langchain", "token_count": 1026 }
749
pub const WITH_TIMER: bool = true; struct Timer { label: &'static str, } // impl Timer { // fn new(label: &'static str) -> Self { // if WITH_TIMER { // web_sys::console::time_with_label(label); // } // Self { label } // } // } impl Drop for Timer { fn drop(&mut sel...
candle/candle-wasm-examples/whisper/src/lib.rs/0
{ "file_path": "candle/candle-wasm-examples/whisper/src/lib.rs", "repo_id": "candle", "token_count": 252 }
93
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-opensearch/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-opensearch/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,411
# coding=utf-8 # Copyright 2023 MBZUAI 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/swiftformer/modeling_swiftformer.py/0
{ "file_path": "transformers/src/transformers/models/swiftformer/modeling_swiftformer.py", "repo_id": "transformers", "token_count": 9784 }
726
from langchain_community.chat_loaders.langsmith import ( LangSmithDatasetChatLoader, LangSmithRunChatLoader, ) __all__ = ["LangSmithRunChatLoader", "LangSmithDatasetChatLoader"]
langchain/libs/langchain/langchain/chat_loaders/langsmith.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_loaders/langsmith.py", "repo_id": "langchain", "token_count": 64 }
468
"""Util that calls Google Lens Search.""" from typing import Any, Dict, Optional, cast import requests from langchain_core.pydantic_v1 import BaseModel, Extra, SecretStr, root_validator from langchain_core.utils import convert_to_secret_str, get_from_dict_or_env class GoogleLensAPIWrapper(BaseModel): """Wrapper...
langchain/libs/community/langchain_community/utilities/google_lens.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/google_lens.py", "repo_id": "langchain", "token_count": 1211 }
300
<jupyter_start><jupyter_text>RST>A [reStructured Text (RST)](https://en.wikipedia.org/wiki/ReStructuredText) file is a file format for textual data used primarily in the Python programming language community for technical documentation. `UnstructuredRSTLoader`You can load data from RST files with `UnstructuredRSTLoade...
langchain/docs/docs/integrations/document_loaders/rst.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/rst.ipynb", "repo_id": "langchain", "token_count": 240 }
118
import sys import traceback from importlib.machinery import SourceFileLoader if __name__ == "__main__": files = sys.argv[1:] has_failure = False for file in files: try: SourceFileLoader("x", file).load_module() except Exception: has_faillure = True print(...
langchain/libs/partners/google-vertexai/scripts/check_imports.py/0
{ "file_path": "langchain/libs/partners/google-vertexai/scripts/check_imports.py", "repo_id": "langchain", "token_count": 207 }
687
"""Init file.""" from llama_index.readers.file.pymu_pdf.base import ( PyMuPDFReader, ) __all__ = ["PyMuPDFReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/pymu_pdf/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/pymu_pdf/__init__.py", "repo_id": "llama_index", "token_count": 51 }
1,369
# 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 applicabl...
transformers/src/transformers/utils/versions.py/0
{ "file_path": "transformers/src/transformers/utils/versions.py", "repo_id": "transformers", "token_count": 1705 }
773
<jupyter_start><jupyter_text>Small-to-big Retrieval PackThis LlamaPack provides an example of our small-to-big retrieval (with recursive retrieval).<jupyter_code>import nest_asyncio nest_asyncio.apply()<jupyter_output><empty_output><jupyter_text>Setup Data<jupyter_code>!wget "https://www.dropbox.com/s/f6bmb19xdg0xedm/...
llama_index/llama-index-packs/llama-index-packs-recursive-retriever/examples/small_to_big.ipynb/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-recursive-retriever/examples/small_to_big.ipynb", "repo_id": "llama_index", "token_count": 580 }
1,811
import os import torch from datasets import load_dataset from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, default_data_collator, get_linear_schedule_with_warmup from peft import AdaLoraConfig, PeftConfig, PeftModel, TaskType, get_peft_model ...
peft/examples/conditional_generation/peft_adalora_seq2seq.py/0
{ "file_path": "peft/examples/conditional_generation/peft_adalora_seq2seq.py", "repo_id": "peft", "token_count": 2250 }
326
package model import ( pb "github.com/milvus-io/milvus/internal/proto/etcdpb" "github.com/milvus-io/milvus/pkg/common" ) type Partition struct { PartitionID int64 PartitionName string PartitionCreatedTimestamp uint64 Extra map[string]string // deprecated. Collectio...
milvus/internal/metastore/model/partition.go/0
{ "file_path": "milvus/internal/metastore/model/partition.go", "repo_id": "milvus", "token_count": 945 }
1,722
#!/usr/bin/env python # coding=utf-8 # Copyright 2021 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/LI...
transformers/examples/tensorflow/text-classification/run_text_classification.py/0
{ "file_path": "transformers/examples/tensorflow/text-classification/run_text_classification.py", "repo_id": "transformers", "token_count": 10860 }
543
# Feedly Loader This loader fetches the entries from a list of RSS feeds subscribed in [Feedly](https://feedly.com). You must initialize the loader with your [Feedly API token](https://developer.feedly.com), and then pass the category name which you want to extract. ## Usage ```python from llama_index import downloa...
llama_index/llama-index-integrations/readers/llama-index-readers-feedly-rss/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-feedly-rss/README.md", "repo_id": "llama_index", "token_count": 181 }
1,312
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-ollama/llama_index/llms/ollama/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-ollama/llama_index/llms/ollama/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,232
#!/usr/bin/env sh alias antlr4='java -Xmx500M -cp "../../../scripts/antlr-4.9-complete.jar:$CLASSPATH" org.antlr.v4.Tool' rm -fr generated antlr4 -Dlanguage=Go -package planparserv2 -o generated -no-listener -visitor Plan.g4
milvus/internal/parser/planparserv2/generate.sh/0
{ "file_path": "milvus/internal/parser/planparserv2/generate.sh", "repo_id": "milvus", "token_count": 93 }
1,836
/* eslint-disable import/first */ import { CheerioWebBaseLoader } from "langchain/document_loaders/web/cheerio"; import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai"; const chatModel = new ChatOpenAI({}); const embeddings = new OpenAIEmbeddings({}); const loader = new CheerioWebBaseLoader( "https://doc...
langchainjs/examples/src/get_started/quickstart3.ts/0
{ "file_path": "langchainjs/examples/src/get_started/quickstart3.ts", "repo_id": "langchainjs", "token_count": 1048 }
801
<jupyter_start><jupyter_text>Bored Llama: BoardDocs in LLaMA Index!This is a fun experiment to see if we can crawl a BoardDocs site to index it for LangChain fun.<jupyter_code>import sys from llama_index import download_loader # Use the temporary / staging location to exercise the loader before first checkin lands Boa...
llama_index/llama-index-integrations/readers/llama-index-readers-boarddocs/examples/BoardDocsReader.ipynb/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-boarddocs/examples/BoardDocsReader.ipynb", "repo_id": "llama_index", "token_count": 379 }
1,413
# Metrics <Tip warning={true}> Metrics is deprecated in 🤗 Datasets. To learn more about how to use metrics, take a look at the library 🤗 [Evaluate](https://huggingface.co/docs/evaluate/index)! In addition to metrics, you can find more tools for evaluating models and datasets. </Tip> Metrics are important for eval...
datasets/docs/source/how_to_metrics.mdx/0
{ "file_path": "datasets/docs/source/how_to_metrics.mdx", "repo_id": "datasets", "token_count": 3350 }
122
from __future__ import annotations import json import logging from typing import ( Any, Callable, Dict, List, Optional, Tuple, Union, cast, ) import requests from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import BaseModel, Extra, SecretStr, root_valida...
langchain/libs/community/langchain_community/embeddings/voyageai.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/voyageai.py", "repo_id": "langchain", "token_count": 2702 }
261
import logging import multiprocessing from multiprocessing.connection import Connection from typing import Generator, Callable from hypothesis import given import hypothesis.strategies as st import pytest import chromadb from chromadb.api import ClientAPI, ServerAPI from chromadb.config import Settings, System import c...
chroma/chromadb/test/property/test_persist.py/0
{ "file_path": "chroma/chromadb/test/property/test_persist.py", "repo_id": "chroma", "token_count": 2865 }
25
<jupyter_start><jupyter_text>Typesense Vector Store Download Data<jupyter_code>%pip install llama-index-embeddings-openai %pip install llama-index-vector-stores-typesense !mkdir -p 'data/paul_graham/' !wget 'https://raw.githubusercontent.com/run-llama/llama_index/main/docs/examples/data/paul_graham/paul_graham_essay.t...
llama_index/docs/examples/vector_stores/TypesenseDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/TypesenseDemo.ipynb", "repo_id": "llama_index", "token_count": 845 }
1,086
import { test, expect } from "@jest/globals"; import { Replicate } from "../replicate.js"; // Test skipped because Replicate appears to be timing out often when called test.skip("Test Replicate", async () => { const model = new Replicate({ model: "a16z-infra/llama13b-v2-chat:df7690f1994d94e96ad9d568eac121a...
langchainjs/libs/langchain-community/src/llms/tests/replicate.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/llms/tests/replicate.int.test.ts", "repo_id": "langchainjs", "token_count": 682 }
948
# 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 applicabl...
transformers/src/transformers/debug_utils.py/0
{ "file_path": "transformers/src/transformers/debug_utils.py", "repo_id": "transformers", "token_count": 5154 }
606
<!--- Copyright 2021 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 ...
transformers/examples/tensorflow/question-answering/README.md/0
{ "file_path": "transformers/examples/tensorflow/question-answering/README.md", "repo_id": "transformers", "token_count": 653 }
584
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-obsidian/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-obsidian/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,494
[build-system] build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] [tool.codespell] check-filenames = true check-hidden = true skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb" [tool.llamahub] classes = ["WeaviateReader"] contains_example = false import_path = "llama_index.readers.weaviate" [...
llama_index/llama-index-integrations/readers/llama-index-readers-weaviate/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-weaviate/pyproject.toml", "repo_id": "llama_index", "token_count": 663 }
1,393
import platform from argparse import ArgumentParser import fsspec import huggingface_hub import pandas import pyarrow from datasets import __version__ as version from datasets.commands import BaseDatasetsCLICommand def info_command_factory(_): return EnvironmentCommand() class EnvironmentCommand(BaseDatasetsC...
datasets/src/datasets/commands/env.py/0
{ "file_path": "datasets/src/datasets/commands/env.py", "repo_id": "datasets", "token_count": 476 }
129
# Structured Outputs The ability of LLMs to produce structured outputs are important for downstream applications that rely on reliably parsing output values. LlamaIndex itself also relies on structured output in the following ways. - **Document retrieval**: Many data structures within LlamaIndex rely on LLM calls wit...
llama_index/docs/module_guides/querying/structured_outputs/structured_outputs.md/0
{ "file_path": "llama_index/docs/module_guides/querying/structured_outputs/structured_outputs.md", "repo_id": "llama_index", "token_count": 602 }
1,126
from llama_index.callbacks.honeyhive.base import honeyhive_callback_handler __all__ = ["honeyhive_callback_handler"]
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-honeyhive/llama_index/callbacks/honeyhive/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-honeyhive/llama_index/callbacks/honeyhive/__init__.py", "repo_id": "llama_index", "token_count": 40 }
1,229
import { Tool, type ToolParams } from "@langchain/core/tools"; /** * Interface for parameters required to create an instance of * AIPluginTool. */ export interface AIPluginToolParams extends ToolParams { name: string; description: string; apiSpec: string; } /** * Class for creating instances of AI tools fro...
langchainjs/libs/langchain-community/src/tools/aiplugin.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/aiplugin.ts", "repo_id": "langchainjs", "token_count": 779 }
1,003
from typer.testing import CliRunner from chromadb.cli.cli import app from chromadb.cli.utils import set_log_file_path runner = CliRunner() def test_app() -> None: result = runner.invoke( app, [ "run", "--path", "chroma_test_data", "--port", ...
chroma/chromadb/test/test_cli.py/0
{ "file_path": "chroma/chromadb/test/test_cli.py", "repo_id": "chroma", "token_count": 307 }
24
<jupyter_start><jupyter_text>Cohere>[Cohere](https://cohere.ai/about) is a Canadian startup that provides natural language processing models that help companies improve human-machine interactions.Head to the [API reference](https://api.python.langchain.com/en/latest/llms/langchain_community.llms.cohere.Cohere.html) for...
langchain/docs/docs/integrations/llms/cohere.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/cohere.ipynb", "repo_id": "langchain", "token_count": 607 }
113
package rootcoord import ( "context" "encoding/json" "fmt" "strings" "sync" "testing" "github.com/cockroachdb/errors" "github.com/golang/protobuf/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "go.uber.org/atomic" "go.uber.org/zap" "g...
milvus/internal/metastore/kv/rootcoord/kv_catalog_test.go/0
{ "file_path": "milvus/internal/metastore/kv/rootcoord/kv_catalog_test.go", "repo_id": "milvus", "token_count": 33300 }
1,826
<jupyter_start><jupyter_text>Building an Agent around a Query PipelineIn this cookbook we show you how to build an agent around a query pipeline.Agents offer the ability to do complex, sequential reasoning on top of any query DAG that you have setup. Conceptually this is also one of the ways you can add a "loop" to the...
llama_index/docs/examples/agent/agent_runner/query_pipeline_agent.ipynb/0
{ "file_path": "llama_index/docs/examples/agent/agent_runner/query_pipeline_agent.ipynb", "repo_id": "llama_index", "token_count": 6067 }
1,169
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-qdrant/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-qdrant/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,509
from langchain_core.tracers.log_stream import ( LogEntry, LogStreamCallbackHandler, RunLog, RunLogPatch, RunState, ) __all__ = ["LogEntry", "RunState", "RunLog", "RunLogPatch", "LogStreamCallbackHandler"]
langchain/libs/langchain/langchain/callbacks/tracers/log_stream.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/tracers/log_stream.py", "repo_id": "langchain", "token_count": 84 }
483
# Introduction à 🤗 Diffusers <CourseFloatingBanner unit={1} classNames="absolute z-10 right-0 top-0" notebooks={[ {label: "Introduction to Diffusers", value: "https://colab.research.google.com/github/huggingface/diffusion-models-class/blob/main/units/fr/unit1/introduction_to_diffusers.ipynb"}, {label: "In...
diffusion-models-class/units/fr/unit1/2.mdx/0
{ "file_path": "diffusion-models-class/units/fr/unit1/2.mdx", "repo_id": "diffusion-models-class", "token_count": 13425 }
281
# Unstructured.io File Loader This loader extracts the text from a variety of unstructured text files using [Unstructured.io](https://github.com/Unstructured-IO/unstructured). Currently, the file extensions that are supported are `.txt`, `.docx`, `.pptx`, `.jpg`, `.png`, `.eml`, `.html`, and `.pdf` documents. A single...
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/unstructured/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/unstructured/README.md", "repo_id": "llama_index", "token_count": 761 }
1,296
export const extname = (path: string) => `.${path.split(".").pop()}`;
langchainjs/langchain/src/util/extname.ts/0
{ "file_path": "langchainjs/langchain/src/util/extname.ts", "repo_id": "langchainjs", "token_count": 26 }
960
MIT License Copyright (c) 2023 langchain-ai Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, dist...
langchain-aiplugin/LICENSE/0
{ "file_path": "langchain-aiplugin/LICENSE", "repo_id": "langchain-aiplugin", "token_count": 276 }
66
import hashlib import logging from functools import cached_property from tenacity import stop_after_attempt, wait_random, retry, retry_if_exception from chromadb.api.types import ( Document, Documents, Embedding, Image, Images, EmbeddingFunction, Embeddings, is_image, is_document, ...
chroma/chromadb/utils/embedding_functions.py/0
{ "file_path": "chroma/chromadb/utils/embedding_functions.py", "repo_id": "chroma", "token_count": 14431 }
28
import { PUBLIC_APP_ASSETS } from "$env/static/public"; export const isHuggingChat = PUBLIC_APP_ASSETS === "huggingchat";
chat-ui/src/lib/utils/isHuggingChat.ts/0
{ "file_path": "chat-ui/src/lib/utils/isHuggingChat.ts", "repo_id": "chat-ui", "token_count": 40 }
108
# 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 applicabl...
trl/trl/trainer/base.py/0
{ "file_path": "trl/trl/trainer/base.py", "repo_id": "trl", "token_count": 538 }
793
export * from "./chat_models.js"; export * from "./llms.js"; export * from "./embeddings.js"; export * from "./rerank.js";
langchainjs/libs/langchain-cohere/src/index.ts/0
{ "file_path": "langchainjs/libs/langchain-cohere/src/index.ts", "repo_id": "langchainjs", "token_count": 46 }
933
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.code_interpreter import CodeInterpreterToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in CodeInterpreterToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-code-interpreter/tests/test_tools_code_interpreter.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-code-interpreter/tests/test_tools_code_interpreter.py", "repo_id": "llama_index", "token_count": 101 }
1,563
import argparse import re import torch import yaml from transformers import ( CLIPProcessor, CLIPTextModel, CLIPTokenizer, CLIPVisionModelWithProjection, ) from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionGLIGENPipeline, StableDiffusionGLIGENTextImagePipeline, U...
diffusers/scripts/convert_gligen_to_diffusers.py/0
{ "file_path": "diffusers/scripts/convert_gligen_to_diffusers.py", "repo_id": "diffusers", "token_count": 11150 }
222
import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { Tool } from "@langchain/core/tools"; /** * Interface for parameters required by GoogleCustomSearch class. */ export interface GoogleCustomSearchParams { apiKey?: string; googleCSEId?: string; } /** * Class that uses the Google Search ...
langchainjs/libs/langchain-community/src/tools/google_custom_search.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/google_custom_search.ts", "repo_id": "langchainjs", "token_count": 847 }
998
# coding=utf-8 # Copyright 2021 Google AI 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 # # Unless required by ...
transformers/tests/models/canine/test_tokenization_canine.py/0
{ "file_path": "transformers/tests/models/canine/test_tokenization_canine.py", "repo_id": "transformers", "token_count": 7133 }
736
# coding=utf-8 # Copyright 2022 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 # # Unless r...
transformers/tests/models/timesformer/test_modeling_timesformer.py/0
{ "file_path": "transformers/tests/models/timesformer/test_modeling_timesformer.py", "repo_id": "transformers", "token_count": 5998 }
752
from llama_index.vector_stores.opensearch.base import ( OpensearchVectorStore, OpensearchVectorClient, ) __all__ = ["OpensearchVectorStore", "OpensearchVectorClient"]
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/__init__.py", "repo_id": "llama_index", "token_count": 60 }
1,530
import { BaseChatIflytekXinghuo } from "./common.js"; import { WebSocketStreamOptions, BaseWebSocketStream, } from "../../utils/iflytek_websocket_stream.js"; class WebSocketStream extends BaseWebSocketStream<string> { openWebSocket(url: string, options: WebSocketStreamOptions): WebSocket { return new WebSock...
langchainjs/libs/langchain-community/src/chat_models/iflytek_xinghuo/web.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/chat_models/iflytek_xinghuo/web.ts", "repo_id": "langchainjs", "token_count": 671 }
949
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-huggingface/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-huggingface/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,259
export async function GET({ locals }) { if (locals.user) { const res = { id: locals.user._id, username: locals.user.username, name: locals.user.name, email: locals.user.email, avatarUrl: locals.user.avatarUrl, hfUserId: locals.user.hfUserId, }; return Response.json(res); } return Response.js...
chat-ui/src/routes/api/user/+server.ts/0
{ "file_path": "chat-ui/src/routes/api/user/+server.ts", "repo_id": "chat-ui", "token_count": 148 }
116
import { NodeHandler, ASTParser } from "./base.js"; import { PropertyAssignmentType } from "./types.js"; /** * Handler for `PropertyAssignment` nodes in an AST. Extends the * `NodeHandler` base class. */ export class PropertyAssignmentHandler extends NodeHandler { /** * Checks if a given node is a `PropertyAss...
langchainjs/langchain/src/output_parsers/expression_type_handlers/property_assignment_handler.ts/0
{ "file_path": "langchainjs/langchain/src/output_parsers/expression_type_handlers/property_assignment_handler.ts", "repo_id": "langchainjs", "token_count": 618 }
937
# Kandinsky2.2 text-to-image fine-tuning Kandinsky 2.2 includes a prior pipeline that generates image embeddings from text prompts, and a decoder pipeline that generates the output image based on the image embeddings. We provide `train_text_to_image_prior.py` and `train_text_to_image_decoder.py` scripts to show you ho...
diffusers/examples/kandinsky2_2/text_to_image/README.md/0
{ "file_path": "diffusers/examples/kandinsky2_2/text_to_image/README.md", "repo_id": "diffusers", "token_count": 4394 }
194
/** * Prompt for trajectory evaluation chain. */ import { AIMessagePromptTemplate, ChatPromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate, } from "@langchain/core/prompts"; const EVAL_TEMPLATE = `An AI language model has been given access to the following set of tools to help answer a u...
langchainjs/langchain/src/evaluation/agents/prompt.ts/0
{ "file_path": "langchainjs/langchain/src/evaluation/agents/prompt.ts", "repo_id": "langchainjs", "token_count": 1727 }
981
# LlamaIndex Readers Integration: Txtai
llama_index/llama-index-integrations/readers/llama-index-readers-txtai/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-txtai/README.md", "repo_id": "llama_index", "token_count": 11 }
1,387
<!--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/optimization/coreml.md/0
{ "file_path": "diffusers/docs/source/en/optimization/coreml.md", "repo_id": "diffusers", "token_count": 3088 }
184
<jupyter_start><jupyter_text>Output-fixing parserThis output parser wraps another output parser, and in the event that the first one fails it calls out to another LLM to fix any errors.But we can do other things besides throw errors. Specifically, we can pass the misformatted output, along with the formatted instructio...
langchain/docs/docs/modules/model_io/output_parsers/types/output_fixing.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/output_parsers/types/output_fixing.ipynb", "repo_id": "langchain", "token_count": 425 }
192
import json import logging import os import tempfile import time from abc import ABC from io import StringIO from pathlib import Path from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Union from urllib.parse import urlparse import requests from langchain_core.documents import Document from lan...
langchain/libs/community/langchain_community/document_loaders/pdf.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/pdf.py", "repo_id": "langchain", "token_count": 11959 }
259
from llama_index.core.vector_stores.types import VectorStore from llama_index.vector_stores.epsilla import EpsillaVectorStore def test_class(): names_of_base_classes = [b.__name__ for b in EpsillaVectorStore.__mro__] assert VectorStore.__name__ in names_of_base_classes
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-epsilla/tests/test_vector_stores_epsilla.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-epsilla/tests/test_vector_stores_epsilla.py", "repo_id": "llama_index", "token_count": 92 }
1,527
from arguments import TokenizerTrainingArguments from datasets import load_dataset from tqdm import tqdm from transformers import AutoTokenizer, HfArgumentParser from transformers.models.gpt2.tokenization_gpt2 import bytes_to_unicode # Iterator for Training def batch_iterator(batch_size=10): for _ in tqdm(range(...
transformers/examples/research_projects/codeparrot/scripts/bpe_training.py/0
{ "file_path": "transformers/examples/research_projects/codeparrot/scripts/bpe_training.py", "repo_id": "transformers", "token_count": 347 }
537
from llama_index.vector_stores.pgvecto_rs.base import PGVectoRsStore __all__ = ["PGVectoRsStore"]
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-pgvecto-rs/llama_index/vector_stores/pgvecto_rs/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-pgvecto-rs/llama_index/vector_stores/pgvecto_rs/__init__.py", "repo_id": "llama_index", "token_count": 40 }
1,614
# 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/utils/torch_utils.py/0
{ "file_path": "diffusers/src/diffusers/utils/torch_utils.py", "repo_id": "diffusers", "token_count": 2337 }
264
# flake8: noqa from langchain.prompts.prompt import PromptTemplate PROMPT_SUFFIX = """Only use the following tables: {table_info} Question: {input}""" _VECTOR_SQL_DEFAULT_TEMPLATE = """You are a {dialect} expert. Given an input question, first create a syntactically correct {dialect} query to run, then look at the ...
langchain/libs/experimental/langchain_experimental/sql/prompt.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/sql/prompt.py", "repo_id": "langchain", "token_count": 1237 }
423
import logging import re from pathlib import Path from typing import Any, Iterator, List, Mapping, Optional from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader from langchain_community.utilities.bibtex import BibtexparserWrapper logger = logging.getLogger(__...
langchain/libs/community/langchain_community/document_loaders/bibtex.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/bibtex.py", "repo_id": "langchain", "token_count": 1705 }
232
// Code generated by mockery v2.32.4. DO NOT EDIT. package mocks import ( context "context" commonpb "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" grpc "google.golang.org/grpc" internalpb "github.com/milvus-io/milvus/internal/proto/internalpb" milvuspb "github.com/milvus-io/milvus-proto/go-api/v2/mi...
milvus/internal/mocks/mock_querynode_client.go/0
{ "file_path": "milvus/internal/mocks/mock_querynode_client.go", "repo_id": "milvus", "token_count": 25834 }
1,865
# coding=utf-8 # Copyright 2023 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 # # Unless requi...
transformers/src/transformers/models/fuyu/modeling_fuyu.py/0
{ "file_path": "transformers/src/transformers/models/fuyu/modeling_fuyu.py", "repo_id": "transformers", "token_count": 7181 }
675
"""Vanna AI Pack. Uses: https://vanna.ai/. """ from typing import Any, Dict, Optional, cast from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.query_engine import CustomQueryEngine import pandas as pd from llama_index.core.base.response.schema import RESPONSE_TYPE, Response class Van...
llama_index/llama-index-packs/llama-index-packs-vanna/llama_index/packs/vanna/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-vanna/llama_index/packs/vanna/base.py", "repo_id": "llama_index", "token_count": 1646 }
1,600
from __future__ import annotations import inspect from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Sequence, Type, Union, ) from langchain_core.chat_history import BaseChatMessageHistory from langchain_core.load.load import load from langchain_core.pydantic_...
langchain/libs/core/langchain_core/runnables/history.py/0
{ "file_path": "langchain/libs/core/langchain_core/runnables/history.py", "repo_id": "langchain", "token_count": 8381 }
407
// 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/storage/utils.go/0
{ "file_path": "milvus/internal/storage/utils.go", "repo_id": "milvus", "token_count": 13607 }
1,932
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-linear/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-linear/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,392
// Inlined from https://github.com/flexdinesh/browser-or-node import { __version__ } from "../index.js"; declare global { const Deno: | { version: { deno: string; }; } | undefined; } let globalEnv: string; export const isBrowser = () => typeof window !== "undefined" && type...
langsmith-sdk/js/src/utils/env.ts/0
{ "file_path": "langsmith-sdk/js/src/utils/env.ts", "repo_id": "langsmith-sdk", "token_count": 2635 }
1,078
// 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/log/log.go/0
{ "file_path": "milvus/pkg/log/log.go", "repo_id": "milvus", "token_count": 2652 }
1,818