text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# Copyright 2020 The HuggingFace Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
datasets/src/datasets/formatting/formatting.py/0
{ "file_path": "datasets/src/datasets/formatting/formatting.py", "repo_id": "datasets", "token_count": 10729 }
140
- sections: - local: index title: 🤗 Datasets - local: quickstart title: Quickstart - local: installation title: Installation title: Get started - sections: - local: tutorial title: Overview - local: load_hub title: Load a dataset from the Hub - local: access title: Know your data...
datasets/docs/source/_toctree.yml/0
{ "file_path": "datasets/docs/source/_toctree.yml", "repo_id": "datasets", "token_count": 1247 }
118
# 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/tests/deepspeed/test_deepspeed.py/0
{ "file_path": "transformers/tests/deepspeed/test_deepspeed.py", "repo_id": "transformers", "token_count": 25392 }
763
from llama_index.legacy.storage.chat_store.base import BaseChatStore from llama_index.legacy.storage.chat_store.redis_chat_store import RedisChatStore from llama_index.legacy.storage.chat_store.simple_chat_store import SimpleChatStore __all__ = ["BaseChatStore", "SimpleChatStore", "RedisChatStore"]
llama_index/llama-index-legacy/llama_index/legacy/storage/chat_store/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/storage/chat_store/__init__.py", "repo_id": "llama_index", "token_count": 95 }
1,773
"""Test text splitter.""" import os from typing import List from llama_index.core.schema import Document, MetadataMode, TextNode from llama_index.core.text_splitter import CodeSplitter def test_python_code_splitter() -> None: """Test case for code splitting using python.""" if "CI" in os.environ: ret...
llama_index/llama-index-core/tests/text_splitter/test_code_splitter.py/0
{ "file_path": "llama_index/llama-index-core/tests/text_splitter/test_code_splitter.py", "repo_id": "llama_index", "token_count": 1881 }
1,329
# -*- coding: utf-8 -*- import inspect from typing import Optional, Union import numpy as np import PIL.Image import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( Autoenco...
diffusers/examples/community/clip_guided_images_mixing_stable_diffusion.py/0
{ "file_path": "diffusers/examples/community/clip_guided_images_mixing_stable_diffusion.py", "repo_id": "diffusers", "token_count": 8926 }
185
# langchain-astradb This package contains the LangChain integrations for using DataStax Astra DB. > DataStax [Astra DB](https://docs.datastax.com/en/astra/home/astra.html) is a serverless vector-capable database built on Apache Cassandra® and made conveniently available > through an easy-to-use JSON API. _**Note.** ...
langchain/libs/partners/astradb/README.md/0
{ "file_path": "langchain/libs/partners/astradb/README.md", "repo_id": "langchain", "token_count": 336 }
624
from importlib.util import find_spec from unittest.mock import MagicMock import pytest from llama_index.legacy.bridge.pydantic import BaseModel from llama_index.legacy.core.llms.types import CompletionResponse from llama_index.legacy.llms.huggingface import HuggingFaceLLM from llama_index.legacy.program.lmformatenforc...
llama_index/llama-index-legacy/tests/program/test_lmformatenforcer.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/program/test_lmformatenforcer.py", "repo_id": "llama_index", "token_count": 422 }
1,563
<!--Copyright 2023 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/llm_tutorial.md/0
{ "file_path": "transformers/docs/source/ko/llm_tutorial.md", "repo_id": "transformers", "token_count": 8185 }
502
import threading import pytest import os import time import json from time import sleep from pathlib import Path from minio import Minio from pymilvus import connections from chaos.checker import (BulkInsertChecker, Op) from common.cus_resource_opts import CustomResourceOperations as CusResource from common.milvus_sy...
milvus/tests/python_client/chaos/test_chaos_bulk_insert.py/0
{ "file_path": "milvus/tests/python_client/chaos/test_chaos_bulk_insert.py", "repo_id": "milvus", "token_count": 3346 }
2,116
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/indices/knowledge_graph/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/knowledge_graph/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,572
{ "code": "Programming language (C++, Java, Javascript, Python, etc.)", "aa": "Afar", "aaa": "Ghotuo", "aab": "Alumu-Tesu", "aac": "Ari", "aad": "Amal", "aae": "Arbëreshë Albanian", "aaf": "Aranadan", "aag": "Ambrak", "aah": "Abu' Arapesh", "aai": "Arifama-Miniafia", "aak...
datasets/src/datasets/utils/resources/languages.json/0
{ "file_path": "datasets/src/datasets/utils/resources/languages.json", "repo_id": "datasets", "token_count": 111198 }
151
use candle_core::{DType, Result, Tensor}; #[test] fn npy() -> Result<()> { let npy = Tensor::read_npy("tests/test.npy")?; assert_eq!( npy.to_dtype(DType::U8)?.to_vec1::<u8>()?, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ); Ok(()) } #[test] fn npz() -> Result<()> { let npz = Tensor::read_npz("t...
candle/candle-core/tests/serialization_tests.rs/0
{ "file_path": "candle/candle-core/tests/serialization_tests.rs", "repo_id": "candle", "token_count": 333 }
36
from llama_index.llms.openai_like.base import OpenAILike __all__ = ["OpenAILike"]
llama_index/llama-index-integrations/llms/llama-index-llms-openai-like/llama_index/llms/openai_like/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-openai-like/llama_index/llms/openai_like/__init__.py", "repo_id": "llama_index", "token_count": 33 }
1,273
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py", "repo_id": "diffusers", "token_count": 9795 }
266
from langchain_community.agent_toolkits.spark_sql.prompt import SQL_PREFIX, SQL_SUFFIX __all__ = ["SQL_PREFIX", "SQL_SUFFIX"]
langchain/libs/langchain/langchain/agents/agent_toolkits/spark_sql/prompt.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/spark_sql/prompt.py", "repo_id": "langchain", "token_count": 52 }
464
import { Example } from "../prompts/base.js"; import { BaseExampleSelector } from "./base.js"; import { PromptTemplate } from "../prompts/prompt.js"; /** * Calculates the length of a text based on the number of words and lines. */ function getLengthBased(text: string): number { return text.split(/\n| /).length; } ...
langchainjs/langchain-core/src/example_selectors/length_based.ts/0
{ "file_path": "langchainjs/langchain-core/src/example_selectors/length_based.ts", "repo_id": "langchainjs", "token_count": 1594 }
851
from typing import Tuple from langchain_experimental.tot.memory import ToTDFSMemory from langchain_experimental.tot.thought import ThoughtValidity class ToTController: """ Tree of Thought (ToT) controller. This is a version of a ToT controller, dubbed in the paper as a "Simple Controller". It h...
langchain/libs/experimental/langchain_experimental/tot/controller.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/tot/controller.py", "repo_id": "langchain", "token_count": 687 }
427
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/falcon.md/0
{ "file_path": "transformers/docs/source/en/model_doc/falcon.md", "repo_id": "transformers", "token_count": 837 }
504
from llama_index.cli.new_package.templates.pyproject import pyproject_str from llama_index.cli.new_package.templates.readme import readme_str from llama_index.cli.new_package.templates.init import ( init_str, init_with_prefix_str, ) __all__ = ["pyproject_str", "readme_str", "init_str", "init_with_prefix_str"]
llama_index/llama-index-cli/llama_index/cli/new_package/templates/__init__.py/0
{ "file_path": "llama_index/llama-index-cli/llama_index/cli/new_package/templates/__init__.py", "repo_id": "llama_index", "token_count": 119 }
1,115
from typing import Sequence from langchain_core.tools import BaseTool def validate_tools_single_input(class_name: str, tools: Sequence[BaseTool]) -> None: """Validate tools for single input.""" for tool in tools: if not tool.is_single_input: raise ValueError( f"{class_name...
langchain/libs/langchain/langchain/agents/utils.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/utils.py", "repo_id": "langchain", "token_count": 149 }
491
# ResNet **Residual Networks**, or **ResNets**, learn residual functions with reference to the layer inputs, instead of learning unreferenced functions. Instead of hoping each few stacked layers directly fit a desired underlying mapping, residual nets let these layers fit a residual mapping. They stack [residual block...
pytorch-image-models/docs/models/.templates/models/resnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/resnet.md", "repo_id": "pytorch-image-models", "token_count": 4271 }
363
import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class IsSafetensorsCompatibleTests(unittest.TestCase): def test_all_is_compatible(self): filenames = [ "safety_checker/pytorch_model.bin", "safety_checker/model.safetensors", "vae/...
diffusers/tests/pipelines/test_pipeline_utils.py/0
{ "file_path": "diffusers/tests/pipelines/test_pipeline_utils.py", "repo_id": "diffusers", "token_count": 2746 }
277
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-dense-x-retrieval/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-dense-x-retrieval/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,651
from langchain_community.document_loaders.notiondb import ( NotionDBLoader, ) __all__ = ["NotionDBLoader"]
langchain/libs/langchain/langchain/document_loaders/notiondb.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/notiondb.py", "repo_id": "langchain", "token_count": 40 }
485
//! Various optimization algorithms. use candle::{Result, Tensor, Var}; /// The interface optimizers should implement. pub trait Optimizer: Sized { type Config: Sized; fn new(vars: Vec<Var>, config: Self::Config) -> Result<Self>; fn step(&mut self, grads: &candle::backprop::GradStore) -> Result<()>; ...
candle/candle-nn/src/optim.rs/0
{ "file_path": "candle/candle-nn/src/optim.rs", "repo_id": "candle", "token_count": 2798 }
62
from langchain_community.document_loaders.airbyte_json import AirbyteJSONLoader __all__ = ["AirbyteJSONLoader"]
langchain/libs/langchain/langchain/document_loaders/airbyte_json.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/airbyte_json.py", "repo_id": "langchain", "token_count": 33 }
474
from langchain_community.utilities.merriam_webster import ( MerriamWebsterAPIWrapper, ) __all__ = [ "MerriamWebsterAPIWrapper", ]
langchain/libs/langchain/langchain/utilities/merriam_webster.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/merriam_webster.py", "repo_id": "langchain", "token_count": 56 }
605
package common import ( "testing" "github.com/stretchr/testify/assert" ) func TestCloneStr2Str(t *testing.T) { type args struct { m Str2Str } tests := []struct { name string args args }{ { args: args{ m: nil, }, }, { args: args{ m: map[string]string{ "k1": "v1", "k2": "v2...
milvus/pkg/common/map_test.go/0
{ "file_path": "milvus/pkg/common/map_test.go", "repo_id": "milvus", "token_count": 262 }
1,948
<jupyter_start><jupyter_text>Polygon Stock Market API>[Polygon](https://polygon.io/) The Polygon.io Stocks API provides REST endpoints that let you query the latest market data from all US stock exchanges.Use the ``PolygonAPIWrapper`` to get stock market data like the latest quote for a ticker.<jupyter_code>import getp...
langchain/docs/docs/integrations/tools/polygon.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/polygon.ipynb", "repo_id": "langchain", "token_count": 193 }
170
"""Test Nomic embeddings.""" from langchain_nomic.embeddings import NomicEmbeddings def test_langchain_nomic_embedding_documents() -> None: """Test nomic embeddings.""" documents = ["foo bar"] embedding = NomicEmbeddings(model="nomic-embed-text-v1") output = embedding.embed_documents(documents) a...
langchain/libs/partners/nomic/tests/integration_tests/test_embeddings.py/0
{ "file_path": "langchain/libs/partners/nomic/tests/integration_tests/test_embeddings.py", "repo_id": "langchain", "token_count": 346 }
629
<jupyter_start><jupyter_text>Neo4j vector store If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-vector-stores-neo4jvector !pip install llama-index import os import openai os.environ["OPENAI_API_KEY"] = "OPENAI_API_KEY" openai.api_key = os...
llama_index/docs/examples/vector_stores/Neo4jVectorDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/Neo4jVectorDemo.ipynb", "repo_id": "llama_index", "token_count": 1286 }
1,136
# Frontend Dockerfile FROM node:16 # Set the working directory WORKDIR /frontend # Copy the package.json and yarn.lock COPY ./package.json ./ COPY ./yarn.lock ./ # Install Yarn and dependencies RUN yarn install # Copy the rest of the frontend code COPY . . # Expose the port the frontend runs on EXPOSE 5173 # Comm...
opengpts/frontend/Dockerfile/0
{ "file_path": "opengpts/frontend/Dockerfile", "repo_id": "opengpts", "token_count": 122 }
2,202
""" ConvNeXt Papers: * `A ConvNet for the 2020s` - https://arxiv.org/pdf/2201.03545.pdf @Article{liu2022convnet, author = {Zhuang Liu and Hanzi Mao and Chao-Yuan Wu and Christoph Feichtenhofer and Trevor Darrell and Saining Xie}, title = {A ConvNet for the 2020s}, journal = {Proceedings of the IEEE/CVF Confer...
pytorch-image-models/timm/models/convnext.py/0
{ "file_path": "pytorch-image-models/timm/models/convnext.py", "repo_id": "pytorch-image-models", "token_count": 24539 }
375
# @langchain/mistralai This package contains the LangChain.js integrations for Mistral through their SDK. ## Installation ```bash npm2yarn npm install @langchain/mistralai ``` This package, along with the main LangChain package, depends on [`@langchain/core`](https://npmjs.com/package/@langchain/core/). If you are ...
langchainjs/libs/langchain-mistralai/README.md/0
{ "file_path": "langchainjs/libs/langchain-mistralai/README.md", "repo_id": "langchainjs", "token_count": 995 }
1,102
<!--Copyright 2023 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...
peft/docs/source/package_reference/lora.md/0
{ "file_path": "peft/docs/source/package_reference/lora.md", "repo_id": "peft", "token_count": 498 }
321
from typing import List import pytest from llama_index.core.schema import BaseNode, Document from llama_index.storage.docstore.postgres import ( PostgresDocumentStore, ) from llama_index.storage.kvstore.postgres import PostgresKVStore try: import asyncpg # noqa import psycopg2 # noqa import sqlalche...
llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-postgres/tests/test_postgres.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-postgres/tests/test_postgres.py", "repo_id": "llama_index", "token_count": 858 }
1,468
import shutil import textwrap import librosa import numpy as np import pytest import soundfile as sf from datasets import Audio, ClassLabel, Features, Value from datasets.data_files import DataFilesDict, get_data_patterns from datasets.download.streaming_download_manager import StreamingDownloadManager from datasets....
datasets/tests/packaged_modules/test_audiofolder.py/0
{ "file_path": "datasets/tests/packaged_modules/test_audiofolder.py", "repo_id": "datasets", "token_count": 8594 }
151
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/epub/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/epub/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,292
from typing import Dict, Tuple from langchain.chains.query_constructor.ir import ( Comparator, Comparison, Operation, Operator, StructuredQuery, ) from langchain.retrievers.self_query.deeplake import DeepLakeTranslator DEFAULT_TRANSLATOR = DeepLakeTranslator() def test_visit_comparison() -> None...
langchain/libs/langchain/tests/unit_tests/retrievers/self_query/test_deeplake.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/retrievers/self_query/test_deeplake.py", "repo_id": "langchain", "token_count": 1076 }
636
syntax = "proto3"; package milvus.proto.data; option go_package = "github.com/milvus-io/milvus/internal/proto/datapb"; import "common.proto"; import "internal.proto"; import "milvus.proto"; import "schema.proto"; import "msg.proto"; import "index_coord.proto"; // TODO: import google/protobuf/empty.proto message Emp...
milvus/internal/proto/data_coord.proto/0
{ "file_path": "milvus/internal/proto/data_coord.proto", "repo_id": "milvus", "token_count": 8668 }
1,873
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/indices/managed/colbert_index/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/managed/colbert_index/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,663
python_sources()
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-wandb/llama_index/callbacks/wandb/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-wandb/llama_index/callbacks/wandb/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,231
python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/evaluation/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/evaluation/BUILD", "repo_id": "llama_index", "token_count": 25 }
1,659
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=True) class AudioClassification(TaskTemplate): task: str = field(default="audio-classification", metadata={"include_in_asdict_...
datasets/src/datasets/tasks/audio_classification.py/0
{ "file_path": "datasets/src/datasets/tasks/audio_classification.py", "repo_id": "datasets", "token_count": 487 }
134
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "tools/serper", }); export * from "@langchain/community/tools/serper";
langchainjs/langchain/src/tools/serper.ts/0
{ "file_path": "langchainjs/langchain/src/tools/serper.ts", "repo_id": "langchainjs", "token_count": 70 }
958
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-fastembed/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-fastembed/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,305
use crate::backend::{BackendDevice, BackendStorage}; use crate::conv::{ParamsConv1D, ParamsConv2D, ParamsConvTranspose1D, ParamsConvTranspose2D}; use crate::op::{BinaryOpT, CmpOp, ReduceOp, UnaryOpT}; use crate::{CpuStorage, DType, Layout, Result, Shape}; use candle_metal_kernels; use candle_metal_kernels::Kernels; use...
candle/candle-core/src/metal_backend.rs/0
{ "file_path": "candle/candle-core/src/metal_backend.rs", "repo_id": "candle", "token_count": 36701 }
35
<jupyter_start><jupyter_code>from transformers import AutoModelForCausalLM from peft import get_peft_config, get_peft_model, PrefixTuningConfig, TaskType, PeftType import torch from datasets import load_dataset import os from transformers import AutoTokenizer from torch.utils.data import DataLoader from transformers im...
peft/examples/causal_language_modeling/peft_prefix_tuning_clm.ipynb/0
{ "file_path": "peft/examples/causal_language_modeling/peft_prefix_tuning_clm.ipynb", "repo_id": "peft", "token_count": 4714 }
309
""" The main idea for this code is to provide a way for users to not need to bother with the hassle of multiple tokens for a concept by typing a photo of <concept>_0 <concept>_1 ... and so on and instead just do a photo of <concept> which gets translated to the above. This needs to work for both inference and training....
diffusers/examples/research_projects/multi_token_textual_inversion/multi_token_clip.py/0
{ "file_path": "diffusers/examples/research_projects/multi_token_textual_inversion/multi_token_clip.py", "repo_id": "diffusers", "token_count": 1827 }
217
import { z } from "zod"; import { ChatOpenAI } from "@langchain/openai"; import { LLMChain } from "langchain/chains"; import { StructuredOutputParser, OutputFixingParser, } from "langchain/output_parsers"; import { PromptTemplate } from "@langchain/core/prompts"; const outputParser = StructuredOutputParser.fromZod...
langchainjs/examples/src/prompts/use_with_llm_chain.ts/0
{ "file_path": "langchainjs/examples/src/prompts/use_with_llm_chain.ts", "repo_id": "langchainjs", "token_count": 736 }
860
# coding=utf-8 # Copyright 2023 the Falcon authors and 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/LICE...
transformers/src/transformers/models/falcon/modeling_falcon.py/0
{ "file_path": "transformers/src/transformers/models/falcon/modeling_falcon.py", "repo_id": "transformers", "token_count": 33509 }
663
from langchain_community.tools.azure_cognitive_services.text2speech import ( AzureCogsText2SpeechTool, ) __all__ = ["AzureCogsText2SpeechTool"]
langchain/libs/langchain/langchain/tools/azure_cognitive_services/text2speech.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/azure_cognitive_services/text2speech.py", "repo_id": "langchain", "token_count": 54 }
571
from llama_index.core.callbacks.base import BaseCallbackHandler from llama_index.finetuning.callbacks.finetuning_handler import OpenAIFineTuningHandler def test_class(): names_of_base_classes = [b.__name__ for b in OpenAIFineTuningHandler.__mro__] assert BaseCallbackHandler.__name__ in names_of_base_classes
llama_index/llama-index-finetuning/tests/callbacks/test_callback_classes.py/0
{ "file_path": "llama_index/llama-index-finetuning/tests/callbacks/test_callback_classes.py", "repo_id": "llama_index", "token_count": 105 }
1,285
[tool.poetry] name = "langchain-plugin" version = "0.1.0" description = "An example ChatGPT Plugin that exposes a LangChain chain, agent, or retriever" authors = ["LangChain Core"] readme = "README.md" packages = [{include = "app"}] [tool.poetry.scripts] app = "app.main:start" [tool.poetry.dependencies] python = "^3....
langchain-aiplugin/pyproject.toml/0
{ "file_path": "langchain-aiplugin/pyproject.toml", "repo_id": "langchain-aiplugin", "token_count": 260 }
63
python_sources()
llama_index/llama-index-integrations/program/llama-index-program-guidance/llama_index/program/guidance/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/program/llama-index-program-guidance/llama_index/program/guidance/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,253
import { TavilySearchResults } from "@langchain/community/tools/tavily_search"; import { ChatOpenAI } from "@langchain/openai"; import type { ChatPromptTemplate } from "@langchain/core/prompts"; import { pull } from "langchain/hub"; import { AgentExecutor, createOpenAIFunctionsAgent } from "langchain/agents"; // Defi...
langchainjs/examples/src/tools/tavily_search.ts/0
{ "file_path": "langchainjs/examples/src/tools/tavily_search.ts", "repo_id": "langchainjs", "token_count": 479 }
844
from langchain_community.chat_message_histories.neo4j import Neo4jChatMessageHistory __all__ = ["Neo4jChatMessageHistory"]
langchain/libs/langchain/langchain/memory/chat_message_histories/neo4j.py/0
{ "file_path": "langchain/libs/langchain/langchain/memory/chat_message_histories/neo4j.py", "repo_id": "langchain", "token_count": 40 }
520
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-psychic/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-psychic/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,407
export * from "@langchain/community/memory/chat_memory";
langchainjs/langchain/src/memory/chat_memory.ts/0
{ "file_path": "langchainjs/langchain/src/memory/chat_memory.ts", "repo_id": "langchainjs", "token_count": 16 }
970
import { test, expect } from "@jest/globals"; import { BaseRetriever } from "@langchain/core/retrievers"; import { BaseLLM } from "@langchain/core/language_models/llms"; import { LLMResult } from "@langchain/core/outputs"; import { Document } from "@langchain/core/documents"; import { PromptTemplate } from "@langchain/...
langchainjs/langchain/src/chains/router/tests/multi_retrieval_qa.test.ts/0
{ "file_path": "langchainjs/langchain/src/chains/router/tests/multi_retrieval_qa.test.ts", "repo_id": "langchainjs", "token_count": 1543 }
909
import DocCardList from "@theme/DocCardList"; # Autonomous Agents Autonomous Agents are agents that designed to be more long running. You give them one or multiple long term goals, and they independently execute towards those goals. The applications combine tool usage and long term memory. At the moment, Autonomous ...
langchainjs/docs/core_docs/docs/use_cases/autonomous_agents/index.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/use_cases/autonomous_agents/index.mdx", "repo_id": "langchainjs", "token_count": 137 }
774
from langchain_community.callbacks.confident_callback import DeepEvalCallbackHandler __all__ = ["DeepEvalCallbackHandler"]
langchain/libs/langchain/langchain/callbacks/confident_callback.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/confident_callback.py", "repo_id": "langchain", "token_count": 33 }
448
"""Base interface class for storing chat history per user.""" from abc import abstractmethod from typing import List, Optional from llama_index.legacy.llms import ChatMessage from llama_index.legacy.schema import BaseComponent class BaseChatStore(BaseComponent): @classmethod def class_name(cls) -> str: ...
llama_index/llama-index-legacy/llama_index/legacy/storage/chat_store/base.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/storage/chat_store/base.py", "repo_id": "llama_index", "token_count": 512 }
1,714
from langchain_core.prompt_values import ChatPromptValue, ChatPromptValueConcrete from langchain_core.prompts.chat import ( AIMessagePromptTemplate, BaseChatPromptTemplate, BaseMessagePromptTemplate, BaseStringMessagePromptTemplate, ChatMessagePromptTemplate, ChatPromptTemplate, HumanMessage...
langchain/libs/langchain/langchain/prompts/chat.py/0
{ "file_path": "langchain/libs/langchain/langchain/prompts/chat.py", "repo_id": "langchain", "token_count": 367 }
528
# 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 applicabl...
transformers/src/transformers/onnx/utils.py/0
{ "file_path": "transformers/src/transformers/onnx/utils.py", "repo_id": "transformers", "token_count": 1291 }
724
# Firebase Realtime Database Loader This loader retrieves documents from Firebase Realtime Database. The user specifies the Firebase Realtime Database URL and, optionally, the path to a service account key file for authentication. ## Usage Here's an example usage of the FirebaseRealtimeDatabaseReader. ```python fro...
llama_index/llama-index-integrations/readers/llama-index-readers-firebase-realtimedb/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-firebase-realtimedb/README.md", "repo_id": "llama_index", "token_count": 286 }
1,322
from typing import Callable, List, Optional from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader from langchain_community.document_loaders.gcs_file import GCSFileLoader from langchain_community.utilities.vertexai import get_client_info class GCSDirectoryLoad...
langchain/libs/community/langchain_community/document_loaders/gcs_directory.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/gcs_directory.py", "repo_id": "langchain", "token_count": 896 }
237
<jupyter_start><jupyter_text>DocArray HnswSearch>[DocArrayHnswSearch](https://docs.docarray.org/user_guide/storing/index_hnswlib/) is a lightweight Document Index implementation provided by [Docarray](https://github.com/docarray/docarray) that runs fully locally and is best suited for small- to medium-sized datasets. I...
langchain/docs/docs/integrations/vectorstores/docarray_hnsw.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/docarray_hnsw.ipynb", "repo_id": "langchain", "token_count": 840 }
175
// 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 t...
milvus/internal/core/src/segcore/load_field_data_c.h/0
{ "file_path": "milvus/internal/core/src/segcore/load_field_data_c.h", "repo_id": "milvus", "token_count": 697 }
1,749
import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; import { ChatMinimax } from "@langchain/community/chat_models/minimax"; import { HumanMessage } from "@langchain/core/messages"; const extractionFunctionZodSchema = z.object({ location: z.string().describe(" The location to get the weathe...
langchainjs/examples/src/models/chat/minimax_functions_zod.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/minimax_functions_zod.ts", "repo_id": "langchainjs", "token_count": 489 }
838
# coding=utf-8 # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
transformers/tests/quantization/gptq/test_gptq.py/0
{ "file_path": "transformers/tests/quantization/gptq/test_gptq.py", "repo_id": "transformers", "token_count": 7230 }
787
run: go: "1.20" skip-dirs: - build - configs - deployments - docs - scripts - internal/core - cmake_build linters: disable-all: true enable: - gosimple - govet - ineffassign - staticcheck - decorder - depguard - gofmt - goimports - gosec - rev...
milvus/.golangci.yml/0
{ "file_path": "milvus/.golangci.yml", "repo_id": "milvus", "token_count": 1992 }
1,710
import { resolveApiUrl } from "./utils/url"; import { simplifySchema } from "./utils/simplifySchema"; import { JsonSchema } from "@jsonforms/core"; import { compressToEncodedURIComponent } from "lz-string"; import useSWR from "swr"; import defaults from "./utils/defaults"; declare global { interface Window { //...
langserve/langserve/playground/src/useSchemas.tsx/0
{ "file_path": "langserve/langserve/playground/src/useSchemas.tsx", "repo_id": "langserve", "token_count": 966 }
1,014
<jupyter_start><jupyter_text>Embedding Distance[](https://colab.research.google.com/github/langchain-ai/langchain/blob/master/docs/docs/guides/evaluation/string/embedding_distance.ipynb)To measure semantic similarity (or dissimilarity) between a prediction and a reference label string, you could use a vector distance m...
langchain/docs/docs/guides/evaluation/string/embedding_distance.ipynb/0
{ "file_path": "langchain/docs/docs/guides/evaluation/string/embedding_distance.ipynb", "repo_id": "langchain", "token_count": 632 }
88
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-wikipedia/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-wikipedia/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,449
# 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...
transformers/src/transformers/models/videomae/__init__.py/0
{ "file_path": "transformers/src/transformers/models/videomae/__init__.py", "repo_id": "transformers", "token_count": 943 }
667
import argparse import glob from os.path import join from tokenizers import ByteLevelBPETokenizer parser = argparse.ArgumentParser() parser.add_argument( "--files", default=None, metavar="path", type=str, required=True, help="The files to use as training; accept '**/*.txt' type of patterns \ ...
tokenizers/bindings/python/examples/train_bytelevel_bpe.py/0
{ "file_path": "tokenizers/bindings/python/examples/train_bytelevel_bpe.py", "repo_id": "tokenizers", "token_count": 521 }
434
python_sources()
llama_index/benchmarks/embeddings/BUILD/0
{ "file_path": "llama_index/benchmarks/embeddings/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,075
# coding=utf-8 # Copyright 2022 the Big Science Workshop and 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/license...
transformers/src/transformers/models/bloom/configuration_bloom.py/0
{ "file_path": "transformers/src/transformers/models/bloom/configuration_bloom.py", "repo_id": "transformers", "token_count": 4332 }
576
import { logVersion010MigrationWarning } from "../../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "stores/message/cassandra", }); export * from "@langchain/community/stores/message/cassandra";
langchainjs/langchain/src/stores/message/cassandra.ts/0
{ "file_path": "langchainjs/langchain/src/stores/message/cassandra.ts", "repo_id": "langchainjs", "token_count": 77 }
938
# rag-aws-kendra This template is an application that utilizes Amazon Kendra, a machine learning powered search service, and Anthropic Claude for text generation. The application retrieves documents using a Retrieval chain to answer questions from your documents. It uses the `boto3` library to connect with the Bedro...
langchain/templates/rag-aws-kendra/README.md/0
{ "file_path": "langchain/templates/rag-aws-kendra/README.md", "repo_id": "langchain", "token_count": 1000 }
712
{ "details": { "best_of_sequences": null, "finish_reason": "eos_token", "generated_tokens": 7, "prefill": [ { "id": 0, "logprob": null, "text": "<pad>" } ], "seed": null, "tokens": [ { "id": 3, "logprob": -0.7001953, "specia...
text-generation-inference/integration-tests/models/__snapshots__/test_t5_sharded/test_t5_sharded.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_t5_sharded/test_t5_sharded.json", "repo_id": "text-generation-inference", "token_count": 680 }
405
# 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/wuerstchen/pipeline_wuerstchen.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/wuerstchen/pipeline_wuerstchen.py", "repo_id": "diffusers", "token_count": 9245 }
249
# Copyright 2020 The HuggingFace Datasets Authors. # # 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 ...
datasets/metrics/google_bleu/google_bleu.py/0
{ "file_path": "datasets/metrics/google_bleu/google_bleu.py", "repo_id": "datasets", "token_count": 4259 }
120
<jupyter_start><jupyter_text>Embeddings with ClarifaiLlamaIndex has support for Clarifai embeddings models. You must have a Clarifai account and a Personal Access Token (PAT) key. [Check here](https://clarifai.com/settings/security) to get or create a PAT.Set CLARIFAI_PAT as an environment variable or You can pass PAT ...
llama_index/docs/examples/embeddings/clarifai.ipynb/0
{ "file_path": "llama_index/docs/examples/embeddings/clarifai.ipynb", "repo_id": "llama_index", "token_count": 619 }
1,057
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 4321, "logprob": -9.84375, "text": "Test" }, { "id": 2009...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_gptq/test_flash_llama_gptq_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_gptq/test_flash_llama_gptq_all_params.json", "repo_id": "text-generation-inference", "token_count": 1035 }
405
Here is how to convert a GPT2 model generated outside of `transformers` * [Megatron-LM](https://github.com/NVIDIA/Megatron-LM)-generated model: Use [convert_megatron_gpt2_checkpoint.py](../megatron_gpt2/convert_megatron_gpt2_checkpoint.py) * [big-science fork of Megatron-Deepspeed](https://github.com/bigscience-wo...
transformers/src/transformers/models/gpt2/CONVERSION.md/0
{ "file_path": "transformers/src/transformers/models/gpt2/CONVERSION.md", "repo_id": "transformers", "token_count": 216 }
609
r"""AgentSearch reader. Example as of 1/8/2024: ```python AgentSearch = download_loader("AgentSearch") document = reader.load_data( query="latest news", search_provider="bing" )[0] print(f'Document:\n{document} ') ``` ```plaintext Document: Doc ID: 67a57dfe-8bd6-4c69-af9d-683e76177119 Text: The latest news...
llama_index/llama-index-integrations/readers/llama-index-readers-agent-search/llama_index/readers/agent_search/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-agent-search/llama_index/readers/agent_search/base.py", "repo_id": "llama_index", "token_count": 879 }
1,397
python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/indices/response/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/response/BUILD", "repo_id": "llama_index", "token_count": 25 }
1,621
from langchain.schema.runnable.base import __all__ EXPECTED_ALL = [ "Runnable", "RunnableBinding", "RunnableBindingBase", "RunnableEach", "RunnableEachBase", "RunnableGenerator", "RunnableLambda", "RunnableMap", "RunnableParallel", "RunnableSequence", "RunnableSerializable",...
langchain/libs/langchain/tests/unit_tests/schema/runnable/test_base.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/schema/runnable/test_base.py", "repo_id": "langchain", "token_count": 226 }
614
"""Test chat model integration.""" from typing import Dict, List, Union import pytest from langchain_core.messages import ( AIMessage, FunctionMessage, HumanMessage, SystemMessage, ) from langchain_core.pydantic_v1 import SecretStr from pytest import CaptureFixture from langchain_google_genai.chat_mo...
langchain/libs/partners/google-genai/tests/unit_tests/test_chat_models.py/0
{ "file_path": "langchain/libs/partners/google-genai/tests/unit_tests/test_chat_models.py", "repo_id": "langchain", "token_count": 934 }
626
# 📕 Package Versioning As of now, LangChain has an ad hoc release process: releases are cut with high frequency by a maintainer and published to [PyPI](https://pypi.org/). The different packages are versioned slightly differently. ## `langchain-core` `langchain-core` is currently on version `0.1.x`. As `langchain...
langchain/docs/docs/packages.mdx/0
{ "file_path": "langchain/docs/docs/packages.mdx", "repo_id": "langchain", "token_count": 488 }
199
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querycoordv2/ops_services.go/0
{ "file_path": "milvus/internal/querycoordv2/ops_services.go", "repo_id": "milvus", "token_count": 1228 }
1,758
from langchain_core.output_parsers.xml import XMLOutputParser __all__ = ["XMLOutputParser"]
langchain/libs/langchain/langchain/output_parsers/xml.py/0
{ "file_path": "langchain/libs/langchain/langchain/output_parsers/xml.py", "repo_id": "langchain", "token_count": 30 }
552
from langchain_core.embeddings import Embeddings # This is for backwards compatibility __all__ = ["Embeddings"]
langchain/libs/langchain/langchain/embeddings/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/embeddings/base.py", "repo_id": "langchain", "token_count": 32 }
521
import torch from timm.utils.agc import adaptive_clip_grad def dispatch_clip_grad(parameters, value: float, mode: str = 'norm', norm_type: float = 2.0): """ Dispatch to gradient clipping method Args: parameters (Iterable): model parameters to clip value (float): clipping value/factor/norm, m...
pytorch-image-models/timm/utils/clip_grad.py/0
{ "file_path": "pytorch-image-models/timm/utils/clip_grad.py", "repo_id": "pytorch-image-models", "token_count": 306 }
409
<jupyter_start><jupyter_text>Introduction à Stable DiffusionCe *notebook* va couvrir les bases de l'utilisation de Stable Diffusion pour créer et modifier des images en utilisant les pipelines existants. Nous allons également jeter un bref coup d'œil aux composants clés au sein du pipeline, tout en laissant une explora...
diffusion-models-class/units/fr/unit3/stable_diffusion_introduction.ipynb/0
{ "file_path": "diffusion-models-class/units/fr/unit3/stable_diffusion_introduction.ipynb", "repo_id": "diffusion-models-class", "token_count": 8445 }
291
from typing import TYPE_CHECKING from ....utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and i...
diffusers/src/diffusers/pipelines/deprecated/alt_diffusion/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/deprecated/alt_diffusion/__init__.py", "repo_id": "diffusers", "token_count": 685 }
241
# coding=utf-8 # Copyright Microsoft Research 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/LICENS...
transformers/src/transformers/models/layoutlmv2/configuration_layoutlmv2.py/0
{ "file_path": "transformers/src/transformers/models/layoutlmv2/configuration_layoutlmv2.py", "repo_id": "transformers", "token_count": 4766 }
655