text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from rag_multi_index_router.chain import chain __all__ = ["chain"]
langchain/templates/rag-multi-index-router/rag_multi_index_router/__init__.py/0
{ "file_path": "langchain/templates/rag-multi-index-router/rag_multi_index_router/__init__.py", "repo_id": "langchain", "token_count": 23 }
696
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class ASTFeatureExtractor(metaclass=DummyObject): _backends = ["speech"] def __init__(self, *args, **kwargs): requires_backends(self, ["speech"]) class Speech2TextFeatureEx...
transformers/src/transformers/utils/dummy_speech_objects.py/0
{ "file_path": "transformers/src/transformers/utils/dummy_speech_objects.py", "repo_id": "transformers", "token_count": 166 }
787
<jupyter_start><jupyter_text>DashVector 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-dashvector !pip install llama-index import logging import sys import os logging.basicConfig(stream=sys.stdout, level=loggin...
llama_index/docs/examples/vector_stores/DashvectorIndexDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/DashvectorIndexDemo.ipynb", "repo_id": "llama_index", "token_count": 646 }
1,145
// 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/src/query/visitors/VerifyExprVisitor.cpp/0
{ "file_path": "milvus/internal/core/src/query/visitors/VerifyExprVisitor.cpp", "repo_id": "milvus", "token_count": 508 }
1,744
# Copyright 2024 ETH Zurich Computer Vision Lab and 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...
diffusers/src/diffusers/schedulers/scheduling_repaint.py/0
{ "file_path": "diffusers/src/diffusers/schedulers/scheduling_repaint.py", "repo_id": "diffusers", "token_count": 6515 }
241
from langchain_experimental.tot.base import ToTChain from langchain_experimental.tot.checker import ToTChecker __all__ = ["ToTChain", "ToTChecker"]
langchain/libs/experimental/langchain_experimental/tot/__init__.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/tot/__init__.py", "repo_id": "langchain", "token_count": 51 }
449
import { gmail_v1, google } from "googleapis"; import { z } from "zod"; import { StructuredTool } from "@langchain/core/tools"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; export interface GmailBaseToolParams { credentials?: { clientEmail?: string; privateKey?: string; keyfile?: s...
langchainjs/libs/langchain-community/src/tools/gmail/base.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/gmail/base.ts", "repo_id": "langchainjs", "token_count": 749 }
1,073
"""Test the public API of the tools package.""" from langchain_community.vectorstores import __all__ as public_api _EXPECTED = [ "AlibabaCloudOpenSearch", "AlibabaCloudOpenSearchSettings", "AnalyticDB", "Annoy", "AtlasDB", "AwaDB", "AzureSearch", "Bagel", "Cassandra", "AstraDB",...
langchain/libs/community/tests/unit_tests/vectorstores/test_public_api.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/vectorstores/test_public_api.py", "repo_id": "langchain", "token_count": 778 }
408
python_sources()
llama_index/llama-index-core/llama_index/core/callbacks/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/callbacks/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,112
FROM rust:1.74.1 as builder ARG CHROMA_KUBERNETES_INTEGRATION=0 ENV CHROMA_KUBERNETES_INTEGRATION $CHROMA_KUBERNETES_INTEGRATION WORKDIR / RUN git clone https://github.com/chroma-core/hnswlib.git WORKDIR /chroma/ COPY . . ENV PROTOC_ZIP=protoc-25.1-linux-x86_64.zip RUN curl -OL https://github.com/protocolbuffers/pro...
chroma/rust/worker/Dockerfile/0
{ "file_path": "chroma/rust/worker/Dockerfile", "repo_id": "chroma", "token_count": 263 }
58
import argparse import itertools import json import logging import math import uuid import warnings from os import environ, listdir, makedirs from os.path import basename, join from pathlib import Path from typing import List import datasets import numpy as np import torch import torch.nn.functional as F import torch....
diffusers/examples/research_projects/multi_subject_dreambooth/train_multi_subject_dreambooth.py/0
{ "file_path": "diffusers/examples/research_projects/multi_subject_dreambooth/train_multi_subject_dreambooth.py", "repo_id": "diffusers", "token_count": 21727 }
199
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-hubspot/llama_index/readers/hubspot/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-hubspot/llama_index/readers/hubspot/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,378
apiVersion: chaos-mesh.org/v1alpha1 kind: PodChaos metadata: name: milvus-podchaos namespace: chaos-testing spec: action: pod-kill duration: 30s mode: one scheduler: cron: '@every 20s' selector: labelSelectors: app.kubernetes.io/name: zong-single-etcd-0 namespaces: - milvus value: ...
milvus/tests/benchmark/milvus_benchmark/chaos/pod-new.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/chaos/pod-new.yaml", "repo_id": "milvus", "token_count": 139 }
1,933
//! Layer Normalization. //! //! This layer applies Layer Normalization over a mini-batch of inputs as described in [`Layer //! Normalization`]. The input is expected to have three dimensions: a batch dimension, a length, //! and a hidden size, the normalization is applied over the last dimension. //! //! # Example //!...
candle/candle-nn/src/layer_norm.rs/0
{ "file_path": "candle/candle-nn/src/layer_norm.rs", "repo_id": "candle", "token_count": 2263 }
56
import { Redis } from "@upstash/redis"; import { BufferMemory } from "langchain/memory"; import { UpstashRedisChatMessageHistory } from "@langchain/community/stores/message/upstash_redis"; import { ChatOpenAI } from "@langchain/openai"; import { ConversationChain } from "langchain/chains"; // Create your own Redis cli...
langchainjs/examples/src/memory/upstash_redis_advanced.ts/0
{ "file_path": "langchainjs/examples/src/memory/upstash_redis_advanced.ts", "repo_id": "langchainjs", "token_count": 391 }
890
//! ConvNeXt implementation. //! //! See "A ConvNet for the 2020s" Liu et al. 2022 //! <https://arxiv.org/abs/2201.03545> //! and //! "ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders" Woo et al. 2023 //! <https://arxiv.org/abs/2301.00808> //! Original code: //! https://github.com/facebookresear...
candle/candle-transformers/src/models/convnext.rs/0
{ "file_path": "candle/candle-transformers/src/models/convnext.rs", "repo_id": "candle", "token_count": 4881 }
72
<jupyter_start><jupyter_text>Connect to templateIn `server.py`, set -```add_routes(app, nvidia_rag_canonical_chain, path="/nvidia_rag_canonical")```<jupyter_code>from langserve.client import RemoteRunnable rag_app = RemoteRunnable("http://0.0.0.0:8000/nvidia_rag_canonical") rag_app.invoke("How many Americans receive S...
langchain/templates/nvidia-rag-canonical/nvidia_rag_canonical.ipynb/0
{ "file_path": "langchain/templates/nvidia-rag-canonical/nvidia_rag_canonical.ipynb", "repo_id": "langchain", "token_count": 136 }
654
# coding=utf-8 # Copyright 2020 The Google AI Language Team Authors, Allegro.pl, Facebook Inc. and the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://ww...
transformers/src/transformers/models/herbert/tokenization_herbert_fast.py/0
{ "file_path": "transformers/src/transformers/models/herbert/tokenization_herbert_fast.py", "repo_id": "transformers", "token_count": 2812 }
683
# Modules Notebooks with usage of these components can be found below. ## Response Evaluation ```{toctree} --- maxdepth: 1 --- /examples/evaluation/faithfulness_eval.ipynb /examples/evaluation/relevancy_eval.ipynb /examples/evaluation/answer_and_context_relevancy.ipynb /examples/evaluation/Deepeval.ipynb /examples/...
llama_index/docs/module_guides/evaluating/modules.md/0
{ "file_path": "llama_index/docs/module_guides/evaluating/modules.md", "repo_id": "llama_index", "token_count": 287 }
1,092
<!--- 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 ...
transformers/docs/source/de/installation.md/0
{ "file_path": "transformers/docs/source/de/installation.md", "repo_id": "transformers", "token_count": 3989 }
464
/* eslint-disable */ var globRequire = require console.log = (..._args: any[]) => {} describe('quicktourExample', () => { function require(mod: string) { if (mod.startsWith('tokenizers')) { return globRequire('../../') } else { return globRequire(mod) } } it.skip('trains the tokenizer',...
tokenizers/bindings/node/examples/documentation/quicktour.test.ts/0
{ "file_path": "tokenizers/bindings/node/examples/documentation/quicktour.test.ts", "repo_id": "tokenizers", "token_count": 2324 }
431
<jupyter_start><jupyter_text>CitationsHow can we get a model to cite which parts of the source documents it referenced in its response?To explore some techniques for extracting citations, let's first create a simple RAG chain. To start we'll just retrieve from the web using the [TavilySearchAPIRetriever](https://js.lan...
langchainjs/docs/core_docs/docs/use_cases/question_answering/citations.ipynb/0
{ "file_path": "langchainjs/docs/core_docs/docs/use_cases/question_answering/citations.ipynb", "repo_id": "langchainjs", "token_count": 5829 }
768
# coding=utf-8 # Copyright 2023 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/nougat/processing_nougat.py/0
{ "file_path": "transformers/src/transformers/models/nougat/processing_nougat.py", "repo_id": "transformers", "token_count": 2932 }
638
import pytest from langchain_community.tools.yahoo_finance_news import YahooFinanceNewsTool # skip all tests if yfinance is not installed yfinance = pytest.importorskip("yfinance") def test_success() -> None: """Test that the tool runs successfully.""" tool = YahooFinanceNewsTool() query = "Microsoft" ...
langchain/libs/community/tests/integration_tests/tools/test_yahoo_finance_news.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/tools/test_yahoo_finance_news.py", "repo_id": "langchain", "token_count": 302 }
373
## Root Coordinator recovery on power failure ## 1. Basic idea 1. `RootCoord` (Root Coordinator) reads meta from etcd when it starts. 2. `RootCoord` needs to store the `position` of the msgstream into etcd every time it consumes the msgstream. 3. `RootCoord` reads the `position` of msgstream from etcd when it starts ...
milvus/docs/design_docs/20220105-root_coordinator_recovery_on_power_failure.md/0
{ "file_path": "milvus/docs/design_docs/20220105-root_coordinator_recovery_on_power_failure.md", "repo_id": "milvus", "token_count": 2147 }
1,714
[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 = ["TelegramReader"] contains_example = false import_path = "llama_index.readers.telegram" [...
llama_index/llama-index-integrations/readers/llama-index-readers-telegram/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-telegram/pyproject.toml", "repo_id": "llama_index", "token_count": 662 }
1,426
// 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/src/segcore/segcore_init_c.cpp/0
{ "file_path": "milvus/internal/core/src/segcore/segcore_init_c.cpp", "repo_id": "milvus", "token_count": 1166 }
1,659
from llama_index.core.storage.docstore.keyval_docstore import KVDocumentStore from llama_index.storage.docstore.redis import RedisDocumentStore def test_class(): names_of_base_classes = [b.__name__ for b in RedisDocumentStore.__mro__] assert KVDocumentStore.__name__ in names_of_base_classes
llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-redis/tests/test_storage_docstore_redis.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-redis/tests/test_storage_docstore_redis.py", "repo_id": "llama_index", "token_count": 102 }
1,492
// Code generated by mockery v2.32.4. DO NOT EDIT. package datacoord import ( datapb "github.com/milvus-io/milvus/internal/proto/datapb" mock "github.com/stretchr/testify/mock" ) // MockCompactionPlanContext is an autogenerated mock type for the compactionPlanContext type type MockCompactionPlanContext struct { m...
milvus/internal/datacoord/mock_compaction_plan_context.go/0
{ "file_path": "milvus/internal/datacoord/mock_compaction_plan_context.go", "repo_id": "milvus", "token_count": 4103 }
1,914
from llama_index.legacy.param_tuner.base import ( AsyncParamTuner, BaseParamTuner, ParamTuner, RayTuneParamTuner, ) __all__ = ["BaseParamTuner", "ParamTuner", "AsyncParamTuner", "RayTuneParamTuner"]
llama_index/llama-index-legacy/llama_index/legacy/param_tuner/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/param_tuner/__init__.py", "repo_id": "llama_index", "token_count": 89 }
1,510
from langchain.schema.runnable.router import __all__ EXPECTED_ALL = ["RouterInput", "RouterRunnable"] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
langchain/libs/langchain/tests/unit_tests/schema/runnable/test_router.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/schema/runnable/test_router.py", "repo_id": "langchain", "token_count": 71 }
607
// 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/import_options.go/0
{ "file_path": "milvus/internal/util/importutil/import_options.go", "repo_id": "milvus", "token_count": 1322 }
1,802
# Metric Card for *Current Metric* ***Metric Card Instructions:*** *Copy this file into the relevant metric folder, then fill it out and save it as README.md. Feel free to take a look at existing metric cards if you'd like examples.* ## Metric Description *Give a brief overview of this metric.* ## How to Use *Give g...
datasets/templates/metric_card_template.md/0
{ "file_path": "datasets/templates/metric_card_template.md", "repo_id": "datasets", "token_count": 397 }
161
[build-system] build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] [tool.codespell] check-filenames = true check-hidden = true ignore-words-list = "Gere" skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb" [tool.llamahub] classes = ["arize_phoenix_callback_handler"] contains_example = false impo...
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-arize-phoenix/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-arize-phoenix/pyproject.toml", "repo_id": "llama_index", "token_count": 730 }
1,345
<jupyter_start><jupyter_text>Embedded Tables PackThis LlamaPack provides an example of our embedded-tables pack (with recursive retrieval + Unstructured.io).<jupyter_code>%pip install llama-index-packs-recursive-retriever !pip install llama-index llama-hub unstructured==0.10.18 lxml import nest_asyncio nest_asyncio.ap...
llama_index/llama-index-packs/llama-index-packs-recursive-retriever/examples/embedded_tables.ipynb/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-recursive-retriever/examples/embedded_tables.ipynb", "repo_id": "llama_index", "token_count": 649 }
1,867
from llama_index.core.readers.base import BaseReader from llama_index.readers.hive import HiveReader def test_class(): names_of_base_classes = [b.__name__ for b in HiveReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-hive/tests/test_readers_hive.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-hive/tests/test_readers_hive.py", "repo_id": "llama_index", "token_count": 86 }
1,384
package crypto import ( "crypto/md5" // #nosec "crypto/sha256" "encoding/base64" "encoding/hex" "golang.org/x/crypto/bcrypt" ) func SHA256(src string, salt string) string { h := sha256.New() h.Write([]byte(src + salt)) sum := h.Sum(nil) s := hex.EncodeToString(sum) return s } // PasswordEncrypt encrypt p...
milvus/pkg/util/crypto/crypto.go/0
{ "file_path": "milvus/pkg/util/crypto/crypto.go", "repo_id": "milvus", "token_count": 366 }
2,048
from langchain_core.utils.function_calling import format_tool_to_openai_function # For backwards compatibility __all__ = ["format_tool_to_openai_function"]
langchain/libs/langchain/langchain/tools/convert_to_openai.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/convert_to_openai.py", "repo_id": "langchain", "token_count": 46 }
546
<!--- 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/docs/source/es/performance.md/0
{ "file_path": "transformers/docs/source/es/performance.md", "repo_id": "transformers", "token_count": 1751 }
470
import { test, expect, describe } from "@jest/globals"; import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { WebBrowser } from "../webbrowser.js"; import fetchAdapter from "../../util/axios-fetch-adapter.js"; describe("webbrowser Test suite", () => { test("get word of the day", async () => { ...
langchainjs/langchain/src/tools/tests/webbrowser.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/tools/tests/webbrowser.int.test.ts", "repo_id": "langchainjs", "token_count": 1567 }
932
import { expect, test } from "@jest/globals"; import { LengthBasedExampleSelector, SemanticSimilarityExampleSelector, } from "@langchain/core/example_selectors"; import { PromptTemplate } from "@langchain/core/prompts"; import { FakeEmbeddings } from "@langchain/core/utils/testing"; import { MemoryVectorStore } fro...
langchainjs/langchain/src/prompts/tests/selectors.test.ts/0
{ "file_path": "langchainjs/langchain/src/prompts/tests/selectors.test.ts", "repo_id": "langchainjs", "token_count": 996 }
957
// 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/allocator/id_allocator.go/0
{ "file_path": "milvus/internal/allocator/id_allocator.go", "repo_id": "milvus", "token_count": 1682 }
1,636
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-docarray/llama_index/vector_stores/docarray/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-docarray/llama_index/vector_stores/docarray/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,458
# 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/tests/test_modeling_value_head.py/0
{ "file_path": "trl/tests/test_modeling_value_head.py", "repo_id": "trl", "token_count": 9527 }
779
"""Init file."""
llama_index/llama-index-core/tests/playground/__init__.py/0
{ "file_path": "llama_index/llama-index-core/tests/playground/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,271
from __future__ import annotations from typing import Any, Dict, Optional from langchain_community.chat_message_histories import ZepChatMessageHistory from langchain.memory import ConversationBufferMemory class ZepMemory(ConversationBufferMemory): """Persist your chain history to the Zep MemoryStore. The ...
langchain/libs/langchain/langchain/memory/zep_memory.py/0
{ "file_path": "langchain/libs/langchain/langchain/memory/zep_memory.py", "repo_id": "langchain", "token_count": 2377 }
527
<jupyter_start><jupyter_text>Zep>[Zep](https://docs.getzep.com/) is an open-source platform for LLM apps. Go from a prototype>built in LangChain or LlamaIndex, or a custom app, to production in minutes without rewriting code. Key Features:- **Fast!** `Zep` operates independently of your chat loop, ensuring a snappy use...
langchain/docs/docs/integrations/vectorstores/zep.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/zep.ipynb", "repo_id": "langchain", "token_count": 3288 }
182
insert_search_performance: collections: # - # milvus: # db_config.primary_path: /test/milvus/distribued/sift_10m_128_l2_flat # cache_config.cpu_cache_capacity: 8GB # engine_config.use_blas_threshold: 0 # engine_config.gpu_search_threshold: 200 # gpu_resource_config.enable: t...
milvus/tests/benchmark/milvus_benchmark/suites/2_insert_search.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/2_insert_search.yaml", "repo_id": "milvus", "token_count": 2512 }
2,148
import { NextRequest, NextResponse } from "next/server"; import { Message as VercelChatMessage, StreamingTextResponse } from "ai"; import { createClient } from "@supabase/supabase-js"; import { SupabaseVectorStore } from "@langchain/community/vectorstores/supabase"; import { AIMessage, ChatMessage, HumanMessage } fro...
langchain-nextjs-template/app/api/chat/retrieval_agents/route.ts/0
{ "file_path": "langchain-nextjs-template/app/api/chat/retrieval_agents/route.ts", "repo_id": "langchain-nextjs-template", "token_count": 2185 }
66
/* eslint-disable no-promise-executor-return */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { test } from "@jest/globals"; import { FakeLLM } from "../../utils/testing/index.js"; test("RunnableWithFallbacks", async () => { const llm = new FakeLLM({ thrownErrorString: "Bad error!", }); awai...
langchainjs/langchain-core/src/runnables/tests/runnable_with_fallbacks.test.ts/0
{ "file_path": "langchainjs/langchain-core/src/runnables/tests/runnable_with_fallbacks.test.ts", "repo_id": "langchainjs", "token_count": 433 }
933
from langchain_community.tools.brave_search.tool import BraveSearch __all__ = ["BraveSearch"]
langchain/libs/langchain/langchain/tools/brave_search/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/brave_search/tool.py", "repo_id": "langchain", "token_count": 28 }
572
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-sagemaker-endpoint/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-sagemaker-endpoint/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,316
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-snowflake/llama_index/readers/snowflake/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-snowflake/llama_index/readers/snowflake/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,441
"""Chain for question-answering with self-verification.""" from __future__ import annotations import warnings from typing import Any, Dict, List, Optional from langchain_core.callbacks import CallbackManagerForChainRun from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import Pro...
langchain/libs/langchain/langchain/chains/llm_checker/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/llm_checker/base.py", "repo_id": "langchain", "token_count": 2761 }
469
import { Chroma } from "@langchain/community/vectorstores/chroma"; import { OpenAIEmbeddings } from "@langchain/openai"; const embeddings = new OpenAIEmbeddings(); const vectorStore = new Chroma(embeddings, { collectionName: "test-deletion", }); const documents = [ { pageContent: `Tortoise: Labyrinth? Labyrin...
langchainjs/examples/src/indexes/vector_stores/chroma/delete.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/chroma/delete.ts", "repo_id": "langchainjs", "token_count": 622 }
813
#!/usr/bin/env bash # 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...
milvus/build/set_docker_mirror.sh/0
{ "file_path": "milvus/build/set_docker_mirror.sh", "repo_id": "milvus", "token_count": 723 }
1,697
<!--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/tasks_explained.md/0
{ "file_path": "transformers/docs/source/en/tasks_explained.md", "repo_id": "transformers", "token_count": 6963 }
512
import { expect } from "@jest/globals"; import { ICacheClient, IMomentoCache, CacheDelete, CacheGet, CacheIncrement, CacheKeyExists, CacheKeysExist, CacheSet, CacheSetIfNotExists, CacheSetFetch, CacheSetAddElements, CacheSetAddElement, CacheSetRemoveElements, CacheSetRemoveElement, CacheL...
langchainjs/libs/langchain-community/src/caches/tests/momento.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/caches/tests/momento.test.ts", "repo_id": "langchainjs", "token_count": 2813 }
975
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/lora/config.py/0
{ "file_path": "peft/src/peft/tuners/lora/config.py", "repo_id": "peft", "token_count": 5276 }
335
<jupyter_start><jupyter_text>Together AI> The Together API makes it easy to fine-tune or run leading open-source models with a couple lines of code. We have integrated the world’s leading open-source models, including Llama-2, RedPajama, Falcon, Alpaca, Stable Diffusion XL, and more. Read more: https://together.aiTo us...
langchain/docs/docs/integrations/llms/together.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/together.ipynb", "repo_id": "langchain", "token_count": 462 }
131
import type { protos } from "@google-ai/generativelanguage"; import type { google } from "@google-ai/generativelanguage/build/protos/protos.js"; import { GoogleAuth, GoogleAuthOptions } from "google-auth-library"; import type { BaseLanguageModel } from "@langchain/core/language_models/base"; import { ChatGooglePaLM } f...
langchainjs/langchain/src/experimental/hubs/makersuite/googlemakersuitehub.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/hubs/makersuite/googlemakersuitehub.ts", "repo_id": "langchainjs", "token_count": 4397 }
924
from langchain_experimental.prompts.load import load_prompt __all__ = ["load_prompt"]
langchain/libs/experimental/langchain_experimental/prompts/__init__.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/prompts/__init__.py", "repo_id": "langchain", "token_count": 30 }
435
""" Exponential Moving Average (EMA) of model updates Hacked together by / Copyright 2020 Ross Wightman """ import logging from collections import OrderedDict from copy import deepcopy from typing import Optional import torch import torch.nn as nn _logger = logging.getLogger(__name__) class ModelEma: """ Model...
pytorch-image-models/timm/utils/model_ema.py/0
{ "file_path": "pytorch-image-models/timm/utils/model_ema.py", "repo_id": "pytorch-image-models", "token_count": 4590 }
397
{ "collection_name": "book", "output_fields": ["book_id"], "search_params": [ {"key": "anns_field", "value": "book_intro"}, {"key": "topk", "value": "2"}, {"key": "params", "value": "{\"nprobe\": 10}"}, {"key": "metric_type", "value": "L2"}, {"key": "round_decimal", "value": "-1"} ], "vect...
milvus/tests/scripts/restful-data/search.json/0
{ "file_path": "milvus/tests/scripts/restful-data/search.json", "repo_id": "milvus", "token_count": 166 }
2,049
from langchain_community.utils.openai_functions import ( FunctionDescription, ToolDescription, convert_pydantic_to_openai_function, convert_pydantic_to_openai_tool, ) __all__ = [ "FunctionDescription", "ToolDescription", "convert_pydantic_to_openai_function", "convert_pydantic_to_openai...
langchain/libs/langchain/langchain/utils/openai_functions.py/0
{ "file_path": "langchain/libs/langchain/langchain/utils/openai_functions.py", "repo_id": "langchain", "token_count": 129 }
599
"""Generative Agents primitives.""" from langchain_experimental.generative_agents.generative_agent import GenerativeAgent from langchain_experimental.generative_agents.memory import GenerativeAgentMemory __all__ = ["GenerativeAgent", "GenerativeAgentMemory"]
langchain/libs/experimental/langchain_experimental/generative_agents/__init__.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/generative_agents/__init__.py", "repo_id": "langchain", "token_count": 66 }
418
import hashlib import json import logging import os from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import Iterable, Optional, Union import torch from torch.hub import HASH_REGEX, download_url_to_file, urlparse try: from torch.hub import get_dir except Im...
pytorch-image-models/timm/models/_hub.py/0
{ "file_path": "pytorch-image-models/timm/models/_hub.py", "repo_id": "pytorch-image-models", "token_count": 6737 }
370
# Feature Extraction All of the models in `timm` have consistent mechanisms for obtaining various types of features from the model for tasks besides classification. ## Penultimate Layer Features (Pre-Classifier Features) The features from the penultimate model layer can be obtained in several ways without requiring ...
pytorch-image-models/hfdocs/source/feature_extraction.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/feature_extraction.mdx", "repo_id": "pytorch-image-models", "token_count": 2004 }
343
from langchain.memory import chat_message_histories from tests.unit_tests import assert_all_importable EXPECTED_ALL = [ "AstraDBChatMessageHistory", "ChatMessageHistory", "CassandraChatMessageHistory", "CosmosDBChatMessageHistory", "DynamoDBChatMessageHistory", "ElasticsearchChatMessageHistory"...
langchain/libs/langchain/tests/unit_tests/memory/chat_message_histories/test_imports.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/memory/chat_message_histories/test_imports.py", "repo_id": "langchain", "token_count": 323 }
662
.. _Ref-Indices-Empty: Empty Index =========== Building the Empty Index .. automodule:: llama_index.core.indices.empty :members: :inherited-members: :exclude-members: delete, docstore, index_struct, index_struct_cls
llama_index/docs/api_reference/indices/empty.rst/0
{ "file_path": "llama_index/docs/api_reference/indices/empty.rst", "repo_id": "llama_index", "token_count": 81 }
1,035
from __future__ import annotations import logging from typing import ( TYPE_CHECKING, Any, Callable, Dict, Generator, Iterable, List, Optional, Tuple, TypeVar, Union, ) import numpy as np from langchain_core.documents import Document from langchain_core.embeddings import Em...
langchain/libs/community/langchain_community/vectorstores/mongodb_atlas.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/mongodb_atlas.py", "repo_id": "langchain", "token_count": 6020 }
333
nodeLinker: node-modules
chat-langchain/chat-langchain/.yarnrc.yml/0
{ "file_path": "chat-langchain/chat-langchain/.yarnrc.yml", "repo_id": "chat-langchain", "token_count": 8 }
7
import { type ClientOptions, OpenAI as OpenAIClient } from "openai"; import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager"; import { GenerationChunk } from "@langchain/core/outputs"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { type BaseLLMParams, LLM } from "@lang...
langchainjs/libs/langchain-openai/src/legacy.ts/0
{ "file_path": "langchainjs/libs/langchain-openai/src/legacy.ts", "repo_id": "langchainjs", "token_count": 5220 }
996
"""Google Calendar reader.""" import datetime import os from typing import Any, List, Optional, Union from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document SCOPES = ["https://www.googleapis.com/auth/calendar.readonly"] # Copyright 2018 Google LLC # # Licensed under the Ap...
llama_index/llama-index-integrations/readers/llama-index-readers-google/llama_index/readers/google/calendar/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-google/llama_index/readers/google/calendar/base.py", "repo_id": "llama_index", "token_count": 2049 }
1,451
python_sources()
llama_index/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/llama_index/indices/managed/llama_cloud/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/llama_index/indices/managed/llama_cloud/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,338
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-astra/llama_index/vector_stores/astra/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-astra/llama_index/vector_stores/astra/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,510
# candle-dinov2 [DINOv2](https://github.com/facebookresearch/dinov2) is a computer vision model. In this example, it is used as an ImageNet classifier: the model returns the probability for the image to belong to each of the 1000 ImageNet categories. ## Running some example ```bash cargo run --example dinov2 --relea...
candle/candle-examples/examples/dinov2/README.md/0
{ "file_path": "candle/candle-examples/examples/dinov2/README.md", "repo_id": "candle", "token_count": 250 }
48
import { expect, test } from "@jest/globals"; import { Document } from "@langchain/core/documents"; import { MozillaReadabilityTransformer } from "../mozilla_readability.js"; test("Test HTML to text transformer", async () => { const webpageText = `<!DOCTYPE html> <html> <head> <title>🦜️🔗 LangChain</title> ...
langchainjs/libs/langchain-community/src/document_transformers/tests/mozilla_readability.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/document_transformers/tests/mozilla_readability.test.ts", "repo_id": "langchainjs", "token_count": 515 }
1,054
from collections.abc import Generator from unittest.mock import MagicMock, patch import pytest from langchain_community.tools.edenai import EdenAiTextModerationTool tool = EdenAiTextModerationTool( providers=["openai"], language="en", edenai_api_key="fake_key" ) @pytest.fixture def mock_post() -> Generator: ...
langchain/libs/community/tests/unit_tests/tools/eden_ai/test_tools.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/tools/eden_ai/test_tools.py", "repo_id": "langchain", "token_count": 1339 }
406
#include "cuda_utils.cuh" #define BINARY_OP_OUT(TYPENAME, OUT_TYPENAME, FN_NAME, FUNC) \ extern "C" __global__ void FN_NAME( \ const size_t numel, \ const size_t num_dims, \ const size_t *dims_and_strides, \ const TYPENAME *lhs, \ const TYPENAME *rhs, \ OUT_TYPENAME *out \ ) { \ const size_...
candle/candle-kernels/src/binary_op_macros.cuh/0
{ "file_path": "candle/candle-kernels/src/binary_op_macros.cuh", "repo_id": "candle", "token_count": 1539 }
55
# Copyright 2024 Stanford University Team and 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 # #...
diffusers/src/diffusers/schedulers/scheduling_lcm.py/0
{ "file_path": "diffusers/src/diffusers/schedulers/scheduling_lcm.py", "repo_id": "diffusers", "token_count": 13495 }
272
"""Pebblo's safe dataloader is a wrapper for document loaders""" import logging import os import uuid from http import HTTPStatus from typing import Any, Dict, Iterator, List import requests from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader from langchain_...
langchain/libs/community/langchain_community/document_loaders/pebblo.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/pebblo.py", "repo_id": "langchain", "token_count": 5010 }
257
package datacoord import ( "fmt" "github.com/samber/lo" "go.uber.org/zap" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" "github.com/milvus-io/milvus/internal/proto/datapb" "github.com/milvus-io/milvus/pkg/log" ) type CompactionView interface { Get...
milvus/internal/datacoord/compaction_view.go/0
{ "file_path": "milvus/internal/datacoord/compaction_view.go", "repo_id": "milvus", "token_count": 2083 }
1,773
package planparserv2 import ( "fmt" "github.com/antlr/antlr4/runtime/Go/antlr" "github.com/samber/lo" "go.uber.org/zap" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/internal/proto/planpb" "github.com/milvus-io/milvus/pkg/log" "github.com/milvus-io/milvus/pkg/util/typeut...
milvus/internal/parser/planparserv2/plan_parser_v2.go/0
{ "file_path": "milvus/internal/parser/planparserv2/plan_parser_v2.go", "repo_id": "milvus", "token_count": 2244 }
1,872
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "vectorstores/cloudflare_vectorize", newEntrypointName: "", newPackageName: "@langchain/cloudflare", }); export * from "@langchain/community/vectorstores/cloudflar...
langchainjs/langchain/src/vectorstores/cloudflare_vectorize.ts/0
{ "file_path": "langchainjs/langchain/src/vectorstores/cloudflare_vectorize.ts", "repo_id": "langchainjs", "token_count": 103 }
1,031
# TensorFlow This Embeddings integration runs the embeddings entirely in your browser or Node.js environment, using [TensorFlow.js](https://www.tensorflow.org/js). This means that your data isn't sent to any third party, and you don't need to sign up for any API keys. However, it does require more memory and processin...
langchainjs/docs/core_docs/docs/integrations/text_embedding/tensorflow.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/text_embedding/tensorflow.mdx", "repo_id": "langchainjs", "token_count": 357 }
715
import { z } from "zod"; import { zodToJsonSchema, type JsonSchema7ObjectType, } from "zod-to-json-schema"; import { Document, MappingDocumentTransformer, } from "@langchain/core/documents"; import { ChatOpenAI } from "@langchain/openai"; import { BaseChain } from "../chains/base.js"; import { TaggingChainOp...
langchainjs/langchain/src/document_transformers/openai_functions.ts/0
{ "file_path": "langchainjs/langchain/src/document_transformers/openai_functions.ts", "repo_id": "langchainjs", "token_count": 724 }
928
"""Chain for question-answering against a vector database."""
langchain/libs/langchain/langchain/chains/retrieval_qa/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/retrieval_qa/__init__.py", "repo_id": "langchain", "token_count": 15 }
489
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/poly/router.py/0
{ "file_path": "peft/src/peft/tuners/poly/router.py", "repo_id": "peft", "token_count": 1117 }
351
# coding=utf-8 # Copyright 2023 The Kakao Enterprise Authors, the MMS-TTS Authors 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 # # h...
transformers/src/transformers/models/vits/tokenization_vits.py/0
{ "file_path": "transformers/src/transformers/models/vits/tokenization_vits.py", "repo_id": "transformers", "token_count": 3981 }
749
import * as uuid from "uuid"; import { VectorizeIndex, VectorizeVectorMetadata, } from "@cloudflare/workers-types"; import type { EmbeddingsInterface } from "@langchain/core/embeddings"; import { VectorStore } from "@langchain/core/vectorstores"; import { Document } from "@langchain/core/documents"; import { Asy...
langchainjs/libs/langchain-community/src/vectorstores/cloudflare_vectorize.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/cloudflare_vectorize.ts", "repo_id": "langchainjs", "token_count": 2531 }
1,002
/// Pretty printing of tensors /// This implementation should be in line with the PyTorch version. /// https://github.com/pytorch/pytorch/blob/7b419e8513a024e172eae767e24ec1b849976b13/torch/_tensor_str.py use crate::{DType, Result, Tensor, WithDType}; use half::{bf16, f16}; impl Tensor { fn fmt_dt<T: WithDType + s...
candle/candle-core/src/display.rs/0
{ "file_path": "candle/candle-core/src/display.rs", "repo_id": "candle", "token_count": 9501 }
34
# Add DATABASE_URL to .env file in this directory DATABASE_URL=postgresql://[USERNAME]:[PASSWORD]@[ADDR]/[DBNAME]
langchainjs/examples/src/indexes/vector_stores/prisma_vectorstore/.env.example/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/prisma_vectorstore/.env.example", "repo_id": "langchainjs", "token_count": 46 }
817
import argparse import os import torch from transformers import T5EncoderModel, T5Tokenizer from diffusers import AutoencoderKL, DPMSolverMultistepScheduler, PixArtAlphaPipeline, Transformer2DModel ckpt_id = "PixArt-alpha/PixArt-alpha" # https://github.com/PixArt-alpha/PixArt-alpha/blob/0f55e922376d8b797edd44d25d0e...
diffusers/scripts/convert_pixart_alpha_to_diffusers.py/0
{ "file_path": "diffusers/scripts/convert_pixart_alpha_to_diffusers.py", "repo_id": "diffusers", "token_count": 4086 }
220
__version__ = "0.28.0.dev0" from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .data_loader import skip_first_batches from .inference impo...
accelerate/src/accelerate/__init__.py/0
{ "file_path": "accelerate/src/accelerate/__init__.py", "repo_id": "accelerate", "token_count": 322 }
12
A markdown document with no additional metadata.
langchainjs/langchain/src/document_loaders/tests/example_data/obsidian/no_metadata.md/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/example_data/obsidian/no_metadata.md", "repo_id": "langchainjs", "token_count": 10 }
920
import { describe, expect, test, jest } from "@jest/globals"; import { SQLiteRecordManager } from "../sqlite.js"; describe("SQLiteRecordManager", () => { const tableName = "upsertion_record"; let recordManager: SQLiteRecordManager; beforeAll(async () => { const localPath = ":memory:"; recordManager = ne...
langchainjs/libs/langchain-community/src/indexes/tests/sqlite.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/indexes/tests/sqlite.int.test.ts", "repo_id": "langchainjs", "token_count": 2218 }
956
import inspect from typing import Callable, Dict, List, Optional, Union import numpy as np import PIL import PIL.Image import torch from transformers import T5EncoderModel, T5Tokenizer from ...loaders import LoraLoaderMixin from ...models import Kandinsky3UNet, VQModel from ...schedulers import DDPMScheduler from ......
diffusers/src/diffusers/pipelines/kandinsky3/pipeline_kandinsky3_img2img.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/kandinsky3/pipeline_kandinsky3_img2img.py", "repo_id": "diffusers", "token_count": 14216 }
238
from pathlib import Path from langchain.memory import ConversationBufferMemory from langchain.pydantic_v1 import BaseModel from langchain_community.chat_models import ChatOllama, ChatOpenAI from langchain_community.utilities import SQLDatabase from langchain_core.output_parsers import StrOutputParser from langchain_co...
langchain/templates/sql-research-assistant/sql_research_assistant/search/sql.py/0
{ "file_path": "langchain/templates/sql-research-assistant/sql_research_assistant/search/sql.py", "repo_id": "langchain", "token_count": 909 }
711
# 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/roc_bert/test_modeling_roc_bert.py/0
{ "file_path": "transformers/tests/models/roc_bert/test_modeling_roc_bert.py", "repo_id": "transformers", "token_count": 13598 }
786