text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# Loading methods Methods for listing and loading datasets and metrics: ## Datasets [[autodoc]] datasets.list_datasets [[autodoc]] datasets.load_dataset [[autodoc]] datasets.load_from_disk [[autodoc]] datasets.load_dataset_builder [[autodoc]] datasets.get_dataset_config_names [[autodoc]] datasets.get_dataset_in...
datasets/docs/source/package_reference/loading_methods.mdx/0
{ "file_path": "datasets/docs/source/package_reference/loading_methods.mdx", "repo_id": "datasets", "token_count": 809 }
124
import { createClient } from "@vercel/kv"; import { VercelKVStore } from "@langchain/community/storage/vercel_kv"; import { AIMessage, HumanMessage } from "@langchain/core/messages"; // Pro tip: define a helper function for getting your client // along with handling the case where your environment variables // are not...
langchainjs/examples/src/stores/vercel_kv_storage.ts/0
{ "file_path": "langchainjs/examples/src/stores/vercel_kv_storage.ts", "repo_id": "langchainjs", "token_count": 823 }
885
<!DOCTYPE html> <html lang="en" class="h-full"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> <meta name="theme-color" content="rgb(249, 250, 251)" /> <script> if ( localStorage.theme === "dark" || (!("theme" in localStorage)...
chat-ui/src/app.html/0
{ "file_path": "chat-ui/src/app.html", "repo_id": "chat-ui", "token_count": 677 }
82
import json from typing import Optional from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.tools import BaseTool from langchain_community.utilities.graphql import GraphQLAPIWrapper class BaseGraphQLTool(BaseTool): """Base tool for querying a GraphQL API.""" graphql_wrapper: ...
langchain/libs/community/langchain_community/tools/graphql/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/graphql/tool.py", "repo_id": "langchain", "token_count": 398 }
302
# coding=utf-8 # Copyright 2022 LongT5 Authors 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 require...
transformers/src/transformers/models/longt5/modeling_flax_longt5.py/0
{ "file_path": "transformers/src/transformers/models/longt5/modeling_flax_longt5.py", "repo_id": "transformers", "token_count": 46153 }
652
# Copyright 2022 The Music Spectrogram Diffusion Authors. # 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...
diffusers/src/diffusers/pipelines/deprecated/spectrogram_diffusion/notes_encoder.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/deprecated/spectrogram_diffusion/notes_encoder.py", "repo_id": "diffusers", "token_count": 1254 }
240
import ast from typing import Any, List, Tuple from langchain_community.document_loaders.parsers.language.code_segmenter import ( CodeSegmenter, ) class PythonSegmenter(CodeSegmenter): """Code segmenter for `Python`.""" def __init__(self, code: str): super().__init__(code) self.source_li...
langchain/libs/community/langchain_community/document_loaders/parsers/language/python.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/parsers/language/python.py", "repo_id": "langchain", "token_count": 766 }
240
import { BlobServiceClient } from "@azure/storage-blob"; import { Document } from "@langchain/core/documents"; import { AzureBlobStorageFileLoader } from "./azure_blob_storage_file.js"; import { BaseDocumentLoader } from "../base.js"; import { UnstructuredLoaderOptions } from "../fs/unstructured.js"; /** * Interface ...
langchainjs/langchain/src/document_loaders/web/azure_blob_storage_container.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/web/azure_blob_storage_container.ts", "repo_id": "langchainjs", "token_count": 814 }
975
# 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/paint_by_example/image_encoder.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/paint_by_example/image_encoder.py", "repo_id": "diffusers", "token_count": 942 }
247
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class SpectrogramDiffusionPipeline(metaclass=DummyObject): _backends = ["transformers", "torch", "note_seq"] def __init__(self, *args, **kwargs): requires_backends(self, ["tr...
diffusers/src/diffusers/utils/dummy_transformers_and_torch_and_note_seq_objects.py/0
{ "file_path": "diffusers/src/diffusers/utils/dummy_transformers_and_torch_and_note_seq_objects.py", "repo_id": "diffusers", "token_count": 236 }
281
"""Test TimescaleVector functionality.""" import os from datetime import datetime, timedelta from typing import List from langchain_core.documents import Document from langchain_community.vectorstores.timescalevector import TimescaleVector from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbedding...
langchain/libs/community/tests/integration_tests/vectorstores/test_timescalevector.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_timescalevector.py", "repo_id": "langchain", "token_count": 6305 }
388
<!--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/ko/perf_infer_cpu.md/0
{ "file_path": "transformers/docs/source/ko/perf_infer_cpu.md", "repo_id": "transformers", "token_count": 3075 }
542
from llama_index.core.readers.base import BaseReader from llama_index.readers.preprocess import PreprocessReader def test_class(): names_of_base_classes = [b.__name__ for b in PreprocessReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-preprocess/tests/test_readers_preprocess.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-preprocess/tests/test_readers_preprocess.py", "repo_id": "llama_index", "token_count": 88 }
1,448
# LlamaIndex Llms Integration: Ai21
llama_index/llama-index-integrations/llms/llama-index-llms-ai21/README.md/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-ai21/README.md", "repo_id": "llama_index", "token_count": 11 }
1,341
"""**Evaluation** chains for grading LLM and Chain outputs. This module contains off-the-shelf evaluation chains for grading the output of LangChain primitives such as language models and chains. **Loading an evaluator** To load an evaluator, you can use the :func:`load_evaluators <langchain.evaluation.loading.load_...
langchain/libs/langchain/langchain/evaluation/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/evaluation/__init__.py", "repo_id": "langchain", "token_count": 1907 }
528
[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 = ["deepeval_callback_handler"] contains_example = false import_path = "llama_index.callbacks...
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-deepeval/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-deepeval/pyproject.toml", "repo_id": "llama_index", "token_count": 653 }
1,346
package rocksdbkv import ( "runtime" "github.com/tecbot/gorocksdb" "github.com/milvus-io/milvus/pkg/log" ) /** * A wrapper of go rocksdb iterator * it helps on 1) reserve the upperBound array to avoid garbage collection * 2) do a leakage check of iterator */ type RocksIterator struct { it *gorocksdb...
milvus/internal/kv/rocksdb/rocks_iterator.go/0
{ "file_path": "milvus/internal/kv/rocksdb/rocks_iterator.go", "repo_id": "milvus", "token_count": 1273 }
1,940
python_tests()
llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-mongodb/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-mongodb/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,462
use serde::{Deserialize, Serialize}; use crate::normalizers::NormalizerWrapper; use crate::tokenizer::{NormalizedString, Normalizer, Result}; use crate::utils::macro_rules_attribute; #[derive(Clone, Deserialize, Debug, Serialize)] #[serde(tag = "type")] /// Allows concatenating multiple other Normalizer as a Sequence...
tokenizers/tokenizers/src/normalizers/utils.rs/0
{ "file_path": "tokenizers/tokenizers/src/normalizers/utils.rs", "repo_id": "tokenizers", "token_count": 478 }
455
"""LanceDB vector store.""" import logging from typing import Any, List, Optional import numpy as np from llama_index.core.schema import ( BaseNode, MetadataMode, NodeRelationship, RelatedNodeInfo, TextNode, ) from llama_index.core.vector_stores.types import ( MetadataFilters, VectorStore,...
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-lancedb/llama_index/vector_stores/lancedb/base.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-lancedb/llama_index/vector_stores/lancedb/base.py", "repo_id": "llama_index", "token_count": 3417 }
1,608
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/gpt2/convert_gpt2_original_tf_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/gpt2/convert_gpt2_original_tf_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 937 }
677
🤗 Tokenizers is tested on Python 3.5+. You should install 🤗 Tokenizers in a `virtual environment <https://docs.python.org/3/library/venv.html>`_. If you're unfamiliar with Python virtual environments, check out the `user guide <https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/>`__. C...
tokenizers/docs/source/installation/python.inc/0
{ "file_path": "tokenizers/docs/source/installation/python.inc", "repo_id": "tokenizers", "token_count": 384 }
431
from langchain_community.tools.file_management.copy import CopyFileTool, FileCopyInput __all__ = ["FileCopyInput", "CopyFileTool"]
langchain/libs/langchain/langchain/tools/file_management/copy.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/file_management/copy.py", "repo_id": "langchain", "token_count": 38 }
576
--- hide_table_of_contents: true --- import CodeBlock from "@theme/CodeBlock"; # SearchApi tool The `SearchApi` tool connects your agents and chains to the internet. A wrapper around the Search API. This tool is handy when you need to answer questions about current events. ## Usage Input should be a search query....
langchainjs/docs/core_docs/docs/integrations/tools/searchapi.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/tools/searchapi.mdx", "repo_id": "langchainjs", "token_count": 191 }
746
import { test, expect } from "@jest/globals"; import { HumanMessage, AIMessage } from "@langchain/core/messages"; import { ChatMessageHistory } from "@langchain/community/stores/message/in_memory"; import { BufferMemory } from "../buffer_memory.js"; test("Test buffer memory", async () => { const memory = new BufferM...
langchainjs/langchain/src/memory/tests/buffer_memory.test.ts/0
{ "file_path": "langchainjs/langchain/src/memory/tests/buffer_memory.test.ts", "repo_id": "langchainjs", "token_count": 466 }
934
# coding=utf-8 # Copyright 2022 Meta 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/esm/modeling_esm.py/0
{ "file_path": "transformers/src/transformers/models/esm/modeling_esm.py", "repo_id": "transformers", "token_count": 23724 }
661
from transformers import BertTokenizer class CustomTokenizer(BertTokenizer): pass
transformers/utils/test_module/custom_tokenization.py/0
{ "file_path": "transformers/utils/test_module/custom_tokenization.py", "repo_id": "transformers", "token_count": 25 }
774
import { Serializable, SerializedConstructor } from "../load/serializable.js"; import type { StringWithAutocomplete } from "../utils/types.js"; export interface StoredMessageData { content: string; role: string | undefined; name: string | undefined; tool_call_id: string | undefined; // eslint-disable-next-li...
langchainjs/langchain-core/src/messages/index.ts/0
{ "file_path": "langchainjs/langchain-core/src/messages/index.ts", "repo_id": "langchainjs", "token_count": 7526 }
863
# Contextual chunk headers Consider a scenario where you want to store a large, arbitrary collection of documents in a vector store and perform Q&A tasks on them. Simply splitting documents with overlapping text may not provide sufficient context for LLMs to determine if multiple chunks are referencing the same inform...
langchainjs/docs/core_docs/docs/modules/data_connection/document_transformers/contextual_chunk_headers.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/document_transformers/contextual_chunk_headers.mdx", "repo_id": "langchainjs", "token_count": 271 }
808
import asyncio import functools import logging from typing import Any, Callable, cast from llama_index.core.callbacks.base import CallbackManager logger = logging.getLogger(__name__) def trace_method( trace_id: str, callback_manager_attr: str = "callback_manager" ) -> Callable[[Callable], Callable]: """ ...
llama_index/llama-index-core/llama_index/core/callbacks/utils.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/callbacks/utils.py", "repo_id": "llama_index", "token_count": 966 }
1,248
--- sidebar_position: 3 --- # Comparison Evaluators Comparison evaluators in LangChain help measure two different chains or LLM outputs. These evaluators are helpful for comparative analyses, such as A/B testing between two language models, or comparing different versions of the same model. They can also be useful fo...
langchain/docs/docs/guides/evaluation/comparison/index.mdx/0
{ "file_path": "langchain/docs/docs/guides/evaluation/comparison/index.mdx", "repo_id": "langchain", "token_count": 471 }
87
from __future__ import annotations from typing import Any, TypeVar from langchain_core.exceptions import OutputParserException from langchain_core.language_models import BaseLanguageModel from langchain_core.output_parsers import BaseOutputParser from langchain_core.prompts import BasePromptTemplate from langchain.o...
langchain/libs/langchain/langchain/output_parsers/fix.py/0
{ "file_path": "langchain/libs/langchain/langchain/output_parsers/fix.py", "repo_id": "langchain", "token_count": 1437 }
528
from langchain_community.tools.office365.base import O365BaseTool __all__ = ["O365BaseTool"]
langchain/libs/langchain/langchain/tools/office365/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/office365/base.py", "repo_id": "langchain", "token_count": 30 }
584
"""**LangChain Google Generative AI Integration** This module integrates Google's Generative AI models, specifically the Gemini series, with the LangChain framework. It provides classes for interacting with chat models and generating embeddings, leveraging Google's advanced AI capabilities. **Chat Models** The `Chat...
langchain/libs/partners/google-genai/langchain_google_genai/__init__.py/0
{ "file_path": "langchain/libs/partners/google-genai/langchain_google_genai/__init__.py", "repo_id": "langchain", "token_count": 653 }
683
label: 'Safety'
langchain/docs/docs/guides/safety/_category_.yml/0
{ "file_path": "langchain/docs/docs/guides/safety/_category_.yml", "repo_id": "langchain", "token_count": 6 }
96
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/using-diffusers/other-formats.md/0
{ "file_path": "diffusers/docs/source/en/using-diffusers/other-formats.md", "repo_id": "diffusers", "token_count": 2824 }
174
- sections: - local: index title: 🤗 Transformers - local: quicktour title: クイックツアー - local: installation title: インストール title: Get started - sections: - local: pipeline_tutorial title: パイプラインを使用して推論を実行する - local: autoclass_tutorial title: AutoClass を使用して移植可能なコードを作成する - local: preproces...
transformers/docs/source/ja/_toctree.yml/0
{ "file_path": "transformers/docs/source/ja/_toctree.yml", "repo_id": "transformers", "token_count": 5823 }
534
# 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...
accelerate/src/accelerate/utils/constants.py/0
{ "file_path": "accelerate/src/accelerate/utils/constants.py", "repo_id": "accelerate", "token_count": 1118 }
14
# 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/test_pipeline_mixin.py/0
{ "file_path": "transformers/tests/test_pipeline_mixin.py", "repo_id": "transformers", "token_count": 9643 }
767
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/api/pipelines/dance_diffusion.md/0
{ "file_path": "diffusers/docs/source/en/api/pipelines/dance_diffusion.md", "repo_id": "diffusers", "token_count": 369 }
178
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/evaluation/benchmarks/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/evaluation/benchmarks/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,651
#!/bin/sh set -e if [[ "${MSYSTEM}" != "MINGW64" ]] ; then echo non MINGW64, exit. exit 1 fi pacmanInstall() { pacman -S --noconfirm --needed \ git make tar dos2unix zip unzip patch \ mingw-w64-x86_64-toolchain \ mingw-w64-x86_64-make \ mingw-w64-x86_64-ccache \ mingw-w64-x86_64-cmake \...
milvus/scripts/install_deps_msys.sh/0
{ "file_path": "milvus/scripts/install_deps_msys.sh", "repo_id": "milvus", "token_count": 448 }
1,847
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base"; import type { VectorStoreInterface } from "@langchain/core/vectorstores"; import { Document } from "@langchain/core/documents"; import { ChainValues } from "@langchain/core/utils/types"; import { CallbackManagerForChainRun } from "@...
langchainjs/langchain/src/experimental/babyagi/agent.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/babyagi/agent.ts", "repo_id": "langchainjs", "token_count": 3767 }
880
"""Init params."""
llama_index/llama-index-core/llama_index/core/indices/common/struct_store/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/common/struct_store/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,174
reviewers: - czs007 - xiaofan-luan - scsven approvers: - maintainers
milvus/docs/OWNERS/0
{ "file_path": "milvus/docs/OWNERS", "repo_id": "milvus", "token_count": 36 }
1,712
from langchain_community.tools.dataforseo_api_search.tool import ( DataForSeoAPISearchResults, DataForSeoAPISearchRun, ) """DataForSeo API Toolkit.""" """Tool for the DataForSeo SERP API.""" __all__ = ["DataForSeoAPISearchRun", "DataForSeoAPISearchResults"]
langchain/libs/community/langchain_community/tools/dataforseo_api_search/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/dataforseo_api_search/__init__.py", "repo_id": "langchain", "token_count": 101 }
283
nodeLinker: node-modules plugins: - path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs spec: "@yarnpkg/plugin-typescript" yarnPath: .yarn/releases/yarn-3.4.1.cjs
langchainjs/.yarnrc.yml/0
{ "file_path": "langchainjs/.yarnrc.yml", "repo_id": "langchainjs", "token_count": 77 }
762
"""Node recency post-processor.""" from datetime import datetime from typing import List, Optional, Set import numpy as np import pandas as pd # NOTE: currently not being used # DEFAULT_INFER_RECENCY_TMPL = ( # "A question is provided.\n" # "The goal is to determine whether the question requires finding the m...
llama_index/llama-index-core/llama_index/core/postprocessor/node_recency.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/postprocessor/node_recency.py", "repo_id": "llama_index", "token_count": 3037 }
1,133
import { ChatOpenAI } from "@langchain/openai"; import { Redis } from "ioredis"; import { RedisCache } from "@langchain/community/caches/ioredis"; const client = new Redis("redis://localhost:6379"); const cache = new RedisCache(client, { ttl: 60, // Optional key expiration value }); const model = new ChatOpenAI({ ...
langchainjs/examples/src/cache/chat_models/redis.ts/0
{ "file_path": "langchainjs/examples/src/cache/chat_models/redis.ts", "repo_id": "langchainjs", "token_count": 247 }
771
python_tests()
llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-falkordb/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-falkordb/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,264
// 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/event_header.go/0
{ "file_path": "milvus/internal/storage/event_header.go", "repo_id": "milvus", "token_count": 770 }
2,009
#!/usr/bin/env bash set -euxo pipefail DIR=$1 for file in $DIR/*; do if [[ $file == 'dist-esm/require.js' ]]; then continue; fi node $file; done
langchainjs/environment_tests/test-exports-esbuild/entrypoint.sh/0
{ "file_path": "langchainjs/environment_tests/test-exports-esbuild/entrypoint.sh", "repo_id": "langchainjs", "token_count": 69 }
750
# 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/models/lora.py/0
{ "file_path": "diffusers/src/diffusers/models/lora.py", "repo_id": "diffusers", "token_count": 7841 }
236
[toolchain] # Released on: 28 December, 2023 # Branched from master on: 10 November, 2023 # https://releases.rs/docs/1.75.0/ channel = "1.75.0" components = ["rustfmt", "clippy"]
text-generation-inference/rust-toolchain.toml/0
{ "file_path": "text-generation-inference/rust-toolchain.toml", "repo_id": "text-generation-inference", "token_count": 68 }
412
from langchain.retrievers.pubmed import PubMedRetriever __all__ = [ "PubMedRetriever", ]
langchain/libs/langchain/langchain/retrievers/pupmed.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/pupmed.py", "repo_id": "langchain", "token_count": 36 }
534
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/fsmt/convert_fsmt_original_pytorch_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/fsmt/convert_fsmt_original_pytorch_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 4617 }
645
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of#iterating_over_async_generators export async function* streamToAsyncIterable( stream: ReadableStream<Uint8Array> ): AsyncIterableIterator<Uint8Array> { const reader = stream.getReader(); try { while (true) { const { d...
chat-ui/src/lib/utils/streamToAsyncIterable.ts/0
{ "file_path": "chat-ui/src/lib/utils/streamToAsyncIterable.ts", "repo_id": "chat-ui", "token_count": 161 }
106
{ "initializer_range": 0.02, "layer_norm_epsilon": 0.00001, "n_embd": 768, "n_head": 12, "n_layer": 6, "n_positions": 1024, "vocab_size": 50257 }
transformers/examples/research_projects/distillation/training_configs/distilgpt2.json/0
{ "file_path": "transformers/examples/research_projects/distillation/training_configs/distilgpt2.json", "repo_id": "transformers", "token_count": 79 }
585
use crate::encodec_model; use candle::{DType, Device, Result, Tensor, D}; use candle_nn::{ embedding, layer_norm, linear_no_bias, Activation, Embedding, LayerNorm, Linear, Module, VarBuilder, }; use candle_transformers::models::t5; // https://github.com/huggingface/transformers/blob/cd4584e3c809bb9e1392ccd3fe3...
candle/candle-examples/examples/musicgen/musicgen_model.rs/0
{ "file_path": "candle/candle-examples/examples/musicgen/musicgen_model.rs", "repo_id": "candle", "token_count": 7041 }
42
import { calendar_v3 } from "googleapis"; import type { JWT } from "googleapis-common"; import { PromptTemplate } from "@langchain/core/prompts"; import { BaseLLM } from "@langchain/core/language_models/llms"; import { CallbackManagerForToolRun } from "@langchain/core/callbacks/manager"; import { StringOutputParser } f...
langchainjs/libs/langchain-community/src/tools/google_calendar/commands/run-view-events.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/google_calendar/commands/run-view-events.ts", "repo_id": "langchainjs", "token_count": 904 }
1,015
"""Different methods for rendering Tools to be passed to LLMs. Depending on the LLM you are using and the prompting strategy you are using, you may want Tools to be rendered in a different way. This module contains various ways to render tools. """ from typing import List # For backwards compatibility from langchain_...
langchain/libs/langchain/langchain/tools/render.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/render.py", "repo_id": "langchain", "token_count": 528 }
559
"""Semantic embedding chunking agent pack. Inspired by Greg Kamradt's text splitting notebook: https://github.com/FullStackRetrieval-com/RetrievalTutorials/blob/main/5_Levels_Of_Text_Splitting.ipynb We've ported over relevant code sections. Check out the original notebook as well! """ import re from typing import A...
llama_index/llama-index-packs/llama-index-packs-node-parser-semantic-chunking/llama_index/packs/node_parser_semantic_chunking/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-node-parser-semantic-chunking/llama_index/packs/node_parser_semantic_chunking/base.py", "repo_id": "llama_index", "token_count": 3203 }
1,581
"""Utility functions for parsing an OpenAPI spec. Kept for backwards compat.""" from langchain_community.utilities.openapi import HTTPVerb, OpenAPISpec __all__ = ["HTTPVerb", "OpenAPISpec"]
langchain/libs/community/langchain_community/tools/openapi/utils/openapi_utils.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/openapi/utils/openapi_utils.py", "repo_id": "langchain", "token_count": 57 }
315
CREATE EXTENSION IF NOT EXISTS vector;
llama_index/llama-index-legacy/tests/initialization/postgres/postgres_init.sql/0
{ "file_path": "llama_index/llama-index-legacy/tests/initialization/postgres/postgres_init.sql", "repo_id": "llama_index", "token_count": 13 }
1,556
<!--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/main_classes/trainer.md/0
{ "file_path": "transformers/docs/source/en/main_classes/trainer.md", "repo_id": "transformers", "token_count": 689 }
496
# coding=utf-8 # Copyright 2024 Harutatsu Akiyama, Jinbin Bai, 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 # # Unle...
diffusers/tests/pipelines/controlnet/test_controlnet_inpaint_sdxl.py/0
{ "file_path": "diffusers/tests/pipelines/controlnet/test_controlnet_inpaint_sdxl.py", "repo_id": "diffusers", "token_count": 5255 }
269
use candle::{DType, Device, Tensor}; use candle_nn::VarBuilder; use candle_transformers::generation::LogitsProcessor; use candle_transformers::models::blip; use candle_transformers::models::quantized_blip; use candle_wasm_example_blip::console_log; use candle_wasm_example_blip::token_output_stream::TokenOutputStream; u...
candle/candle-wasm-examples/blip/src/bin/m.rs/0
{ "file_path": "candle/candle-wasm-examples/blip/src/bin/m.rs", "repo_id": "candle", "token_count": 2699 }
81
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import Pipeline, build_pipeline_init_args if is_vision_available(): from ..image_utils import load_image if is_torch_available(): import torch ...
transformers/src/transformers/pipelines/object_detection.py/0
{ "file_path": "transformers/src/transformers/pipelines/object_detection.py", "repo_id": "transformers", "token_count": 3401 }
686
from typing import Dict, Type from llama_index.legacy.embeddings.base import BaseEmbedding from llama_index.legacy.embeddings.google import GoogleUnivSentEncoderEmbedding from llama_index.legacy.embeddings.huggingface import HuggingFaceEmbedding from llama_index.legacy.embeddings.langchain import LangchainEmbedding fr...
llama_index/llama-index-legacy/llama_index/legacy/embeddings/loading.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/embeddings/loading.py", "repo_id": "llama_index", "token_count": 709 }
1,490
"""Test Base Retriever logic.""" from __future__ import annotations from typing import Dict, List, Optional import pytest from langchain_core.callbacks import ( AsyncCallbackManagerForRetrieverRun, CallbackManagerForRetrieverRun, ) from langchain_core.retrievers import BaseRetriever, Document from tests.uni...
langchain/libs/community/tests/unit_tests/retrievers/test_base.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/retrievers/test_base.py", "repo_id": "langchain", "token_count": 3388 }
379
import os from configparser import ConfigParser, SectionProxy from typing import Any, Type from llama_index import ( LLMPredictor, ServiceContext, VectorStoreIndex, ) from llama_index.embeddings.base import BaseEmbedding from llama_index.embeddings.openai import OpenAIEmbedding from llama_index.indices imp...
llama_index/experimental/cli/configuration.py/0
{ "file_path": "llama_index/experimental/cli/configuration.py", "repo_id": "llama_index", "token_count": 1475 }
1,155
# Two types of value-based methods [[two-types-value-based-methods]] In value-based methods, **we learn a value function** that **maps a state to the expected value of being at that state.** <img src="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit3/vbm-1.jpg" alt="Value ...
deep-rl-class/units/en/unit2/two-types-value-based-methods.mdx/0
{ "file_path": "deep-rl-class/units/en/unit2/two-types-value-based-methods.mdx", "repo_id": "deep-rl-class", "token_count": 1727 }
163
import dataclasses import logging import os from copy import deepcopy from typing import Optional, Dict, Callable, Any, Tuple from torch import nn as nn from torch.hub import load_state_dict_from_url from timm.models._features import FeatureListNet, FeatureHookNet from timm.models._features_fx import FeatureGraphNet ...
pytorch-image-models/timm/models/_builder.py/0
{ "file_path": "pytorch-image-models/timm/models/_builder.py", "repo_id": "pytorch-image-models", "token_count": 7677 }
372
from __future__ import annotations from abc import ABC, abstractmethod from functools import lru_cache from typing import ( TYPE_CHECKING, Any, List, Optional, Sequence, Set, TypeVar, Union, ) from typing_extensions import TypeAlias from langchain_core._api import deprecated from lang...
langchain/libs/core/langchain_core/language_models/base.py/0
{ "file_path": "langchain/libs/core/langchain_core/language_models/base.py", "repo_id": "langchain", "token_count": 4072 }
390
import os import tempfile from typing import Generator import pytest from langchain.storage.exceptions import InvalidKeyException from langchain.storage.file_system import LocalFileStore @pytest.fixture def file_store() -> Generator[LocalFileStore, None, None]: # Create a temporary directory for testing wit...
langchain/libs/langchain/tests/unit_tests/storage/test_filesystem.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/storage/test_filesystem.py", "repo_id": "langchain", "token_count": 1221 }
674
# 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/LICENSE-2.0 # # Unless r...
transformers/tests/models/luke/test_modeling_luke.py/0
{ "file_path": "transformers/tests/models/luke/test_modeling_luke.py", "repo_id": "transformers", "token_count": 17134 }
719
package proxy import ( "fmt" "math" "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/pkg/common" "github.com/milvus-io/milvus/pkg/util/paramtable" "github.com/milvus-io/mi...
milvus/internal/proxy/validate_util_test.go/0
{ "file_path": "milvus/internal/proxy/validate_util_test.go", "repo_id": "milvus", "token_count": 40734 }
1,836
from __future__ import annotations from typing import TYPE_CHECKING, Iterable, List, Optional, Sequence from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader if TYPE_CHECKING: import praw def _dependable_praw_import() -> praw: try: import pr...
langchain/libs/community/langchain_community/document_loaders/reddit.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/reddit.py", "repo_id": "langchain", "token_count": 2182 }
248
package model import "github.com/chroma/chroma-coordinator/internal/types" type Tenant struct { Name string } type CreateTenant struct { Name string Ts types.Timestamp } type GetTenant struct { Name string Ts types.Timestamp }
chroma/go/coordinator/internal/model/tenant.go/0
{ "file_path": "chroma/go/coordinator/internal/model/tenant.go", "repo_id": "chroma", "token_count": 83 }
53
import os from pathlib import Path from typing import List, Optional, Tuple import requests def get_file_content(url: str, path: str) -> Tuple[str, int]: """Get the content of a file from the GitHub REST API.""" resp = requests.get(url + path) return resp.text, resp.status_code def get_file_content_byt...
llama_index/llama-index-core/llama_index/core/download/utils.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/download/utils.py", "repo_id": "llama_index", "token_count": 1285 }
1,143
"""Test dataset generation.""" from tempfile import TemporaryDirectory from llama_index.legacy import SimpleDirectoryReader from llama_index.legacy.extractors import ( QuestionsAnsweredExtractor, TitleExtractor, ) from llama_index.legacy.ingestion import IngestionPipeline from llama_index.legacy.llms import M...
llama_index/llama-index-legacy/tests/extractors/test_metadata_extractor.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/extractors/test_metadata_extractor.py", "repo_id": "llama_index", "token_count": 1149 }
1,548
ann_accuracy: collections: - server: cache_config.cpu_cache_capacity: 16 engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: true gpu_resource_config.cache_capacity: 4 gpu_resource_config.search_resources: ...
milvus/tests/benchmark/milvus_benchmark/suites/cpu_accuracy_ann_debug.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/cpu_accuracy_ann_debug.yaml", "repo_id": "milvus", "token_count": 403 }
1,973
import { PDFLoader } from "langchain/document_loaders/fs/pdf"; export const run = async () => { const loader = new PDFLoader("src/document_loaders/example_data/bitcoin.pdf"); const docs = await loader.load(); console.log({ docs }); };
langchainjs/examples/src/document_loaders/pdf.ts/0
{ "file_path": "langchainjs/examples/src/document_loaders/pdf.ts", "repo_id": "langchainjs", "token_count": 78 }
771
[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 = ["TextToImageToolSpec"] contains_example = false import_path = "llama_index.tools.text_to_i...
llama_index/llama-index-integrations/tools/llama-index-tools-text-to-image/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-text-to-image/pyproject.toml", "repo_id": "llama_index", "token_count": 674 }
1,500
# 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/loaders/utils.py/0
{ "file_path": "diffusers/src/diffusers/loaders/utils.py", "repo_id": "diffusers", "token_count": 1031 }
211
poetry_requirements( name="poetry", module_mapping={"llama-cpp-python": ["llama_cpp"]}, )
llama_index/llama-index-integrations/llms/llama-index-llms-llama-cpp/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-llama-cpp/BUILD", "repo_id": "llama_index", "token_count": 42 }
1,265
from __future__ import annotations import logging from typing import Union from langchain_core.agents import AgentAction, AgentFinish from langchain_core.exceptions import OutputParserException from langchain_core.output_parsers.json import parse_json_markdown from langchain.agents.agent import AgentOutputParser lo...
langchain/libs/langchain/langchain/agents/output_parsers/json.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/output_parsers/json.py", "repo_id": "langchain", "token_count": 697 }
488
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-pdf-table/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-pdf-table/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,428
from rag_vectara.chain import chain __all__ = ["chain"]
langchain/templates/rag-vectara/rag_vectara/__init__.py/0
{ "file_path": "langchain/templates/rag-vectara/rag_vectara/__init__.py", "repo_id": "langchain", "token_count": 20 }
676
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { ChatPromptTemplate, MessagesPlaceholder, } from "@langchain/core/prompts"; import { ChatAnthropic } from "@langchain/anthropic"; import { RunnableWithMessageHistory } from "@langchain/core/runnables"; import { UpstashRedisChatMessageHistory } fr...
langchainjs/examples/src/guides/expression_language/message_history.ts/0
{ "file_path": "langchainjs/examples/src/guides/expression_language/message_history.ts", "repo_id": "langchainjs", "token_count": 561 }
807
"""Base vector store index query.""" import asyncio from typing import Any, Dict, List, Optional from llama_index.core.base.base_multi_modal_retriever import ( MultiModalRetriever, ) from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.core.callbacks.base import CallbackManager from ll...
llama_index/llama-index-core/llama_index/core/indices/multi_modal/retriever.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/multi_modal/retriever.py", "repo_id": "llama_index", "token_count": 7153 }
1,265
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/unittest/test_utils/DataGen.h/0
{ "file_path": "milvus/internal/core/unittest/test_utils/DataGen.h", "repo_id": "milvus", "token_count": 23509 }
1,681
from pathlib import Path import pytest from langchain_community.document_loaders import ( TelegramChatApiLoader, TelegramChatFileLoader, ) def test_telegram_chat_file_loader() -> None: """Test TelegramChatFileLoader.""" file_path = Path(__file__).parent / "test_docs" / "telegram.json" loader = T...
langchain/libs/community/tests/integration_tests/document_loaders/test_telegram.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_telegram.py", "repo_id": "langchain", "token_count": 522 }
345
import json import os import re from pathlib import Path from typing import Dict, List, Tuple mappings_path = os.path.join(os.path.dirname(__file__), "mappings.json") def _parse_from_imports( mappings: Dict[str, str], installed_modules: List[str], line_idx: int, lines: List[str], verbose: bool = ...
llama_index/llama-index-core/llama_index/core/command_line/upgrade.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/command_line/upgrade.py", "repo_id": "llama_index", "token_count": 4567 }
1,204
// 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/eventlog/grpc.go/0
{ "file_path": "milvus/pkg/eventlog/grpc.go", "repo_id": "milvus", "token_count": 1471 }
1,950
from langchain_community.retrievers.remote_retriever import RemoteLangChainRetriever __all__ = ["RemoteLangChainRetriever"]
langchain/libs/langchain/langchain/retrievers/remote_retriever.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/remote_retriever.py", "repo_id": "langchain", "token_count": 39 }
569
# coding=utf-8 # Copyright 2019 Facebook AI Research and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Licens...
transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py/0
{ "file_path": "transformers/src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py", "repo_id": "transformers", "token_count": 35223 }
756
# DreamBooth training example [DreamBooth](https://arxiv.org/abs/2208.12242) is a method to personalize text2image models like stable diffusion given just a few(3~5) images of a subject. The `train_dreambooth.py` script shows how to implement the training procedure and adapt it for stable diffusion. ## Running local...
diffusers/examples/dreambooth/README.md/0
{ "file_path": "diffusers/examples/dreambooth/README.md", "repo_id": "diffusers", "token_count": 9833 }
209
import { SFNClient as Client, StartExecutionCommand as Invoker, DescribeExecutionCommand as Describer, SendTaskSuccessCommand as TaskSuccessSender, } from "@aws-sdk/client-sfn"; import { Tool, ToolParams } from "@langchain/core/tools"; /** * Interface for AWS Step Functions configuration. */ export interfac...
langchainjs/libs/langchain-community/src/tools/aws_sfn.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/aws_sfn.ts", "repo_id": "langchainjs", "token_count": 2270 }
957
from langchain_community.llms.chatglm import ChatGLM __all__ = ["ChatGLM"]
langchain/libs/langchain/langchain/llms/chatglm.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/chatglm.py", "repo_id": "langchain", "token_count": 28 }
511