text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/esm.md/0
{ "file_path": "transformers/docs/source/en/model_doc/esm.md", "repo_id": "transformers", "token_count": 1906 }
507
import { test, expect } from "@jest/globals"; import { InMemoryCache } from "../caches.js"; test("InMemoryCache", async () => { const cache = new InMemoryCache(); await cache.update("foo", "bar", [{ text: "baz" }]); expect(await cache.lookup("foo", "bar")).toEqual([{ text: "baz" }]); });
langchainjs/langchain-core/src/tests/caches.test.ts/0
{ "file_path": "langchainjs/langchain-core/src/tests/caches.test.ts", "repo_id": "langchainjs", "token_count": 108 }
870
import { expect, test } from "@jest/globals"; import process from "process"; import { OpenAI } from "@langchain/openai"; import { SerpAPI } from "@langchain/community/tools/serpapi"; import { Calculator } from "../../../tools/calculator.js"; import { initializeAgentExecutorWithOptions } from "../../../agents/index.js";...
langchainjs/langchain/src/evaluation/agents/tests/trajectory_eval_chain.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/evaluation/agents/tests/trajectory_eval_chain.int.test.ts", "repo_id": "langchainjs", "token_count": 423 }
953
python_tests()
llama_index/llama-index-integrations/tools/llama-index-tools-azure-cv/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-azure-cv/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,503
// For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node { "name": "Node.js & TypeScript", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile "image": ...
langchainjs/.devcontainer/devcontainer.json/0
{ "file_path": "langchainjs/.devcontainer/devcontainer.json", "repo_id": "langchainjs", "token_count": 336 }
738
# Vectara RAG Pack This LlamaPack provides an end-to-end Retrieval Augmented Generation flow using Vectara. Before you start, if you have not done so already, you would need to follow these steps: - Create a [free Vectara account](https://vectara.com/integrations/llamaindex). - Create a [corpus](https://docs.vectara...
llama_index/llama-index-packs/llama-index-packs-vectara-rag/README.md/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-vectara-rag/README.md", "repo_id": "llama_index", "token_count": 1214 }
1,738
<jupyter_start><jupyter_text>ChatGPT Data>[ChatGPT](https://chat.openai.com) is an artificial intelligence (AI) chatbot developed by OpenAI.This notebook covers how to load `conversations.json` from your `ChatGPT` data export folder.You can get your data export by email by going to: https://chat.openai.com/ -> (Profile...
langchain/docs/docs/integrations/document_loaders/chatgpt_loader.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/chatgpt_loader.ipynb", "repo_id": "langchain", "token_count": 182 }
109
"""Integration test for PubMed API Wrapper.""" from typing import List import pytest from langchain_core.documents import Document from langchain_community.retrievers import PubMedRetriever @pytest.fixture def retriever() -> PubMedRetriever: return PubMedRetriever() def assert_docs(docs: List[Document]) -> No...
langchain/libs/community/tests/integration_tests/retrievers/test_pubmed.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/retrievers/test_pubmed.py", "repo_id": "langchain", "token_count": 404 }
370
[tool.poetry] name = "rag-timescale-hybrid-search-time" version = "0.0.1" description = "RAG using timescale-vector DB with the self-query retriver for metadata filtering on time" authors = [] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" openai = "<2" fastapi = "^0.104.0" ...
langchain/templates/rag-timescale-hybrid-search-time/pyproject.toml/0
{ "file_path": "langchain/templates/rag-timescale-hybrid-search-time/pyproject.toml", "repo_id": "langchain", "token_count": 338 }
692
from typing import Dict, Tuple from langchain.chains.query_constructor.ir import ( Comparator, Comparison, Operation, Operator, StructuredQuery, ) from langchain.retrievers.self_query.mongodb_atlas import MongoDBAtlasTranslator DEFAULT_TRANSLATOR = MongoDBAtlasTranslator() def test_visit_compari...
langchain/libs/langchain/tests/unit_tests/retrievers/self_query/test_mongodb_atlas.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/retrievers/self_query/test_mongodb_atlas.py", "repo_id": "langchain", "token_count": 1810 }
611
import orjson as json import logging from typing import Optional, cast, Tuple from typing import Sequence from uuid import UUID import requests from overrides import override import chromadb.errors as errors from chromadb.types import Database, Tenant import chromadb.utils.embedding_functions as ef from chromadb.api ...
chroma/chromadb/api/fastapi.py/0
{ "file_path": "chroma/chromadb/api/fastapi.py", "repo_id": "chroma", "token_count": 10269 }
12
import { GooglePaLMEmbeddings } from "@langchain/community/embeddings/googlepalm"; const model = new GooglePaLMEmbeddings({ apiKey: "<YOUR API KEY>", // or set it in environment variable as `GOOGLE_PALM_API_KEY` modelName: "models/embedding-gecko-001", // OPTIONAL }); /* Embed queries */ const res = await model.em...
langchainjs/examples/src/models/embeddings/googlepalm.ts/0
{ "file_path": "langchainjs/examples/src/models/embeddings/googlepalm.ts", "repo_id": "langchainjs", "token_count": 174 }
805
import { expect, test } from "@jest/globals"; import * as url from "node:url"; import * as path from "node:path"; import { PPTXLoader } from "../fs/pptx.js"; test.skip("Test PowerPoint loader from file", async () => { const filePath = path.resolve( path.dirname(url.fileURLToPath(import.meta.url)), "./example...
langchainjs/langchain/src/document_loaders/tests/pptx.test.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/pptx.test.ts", "repo_id": "langchainjs", "token_count": 310 }
868
<jupyter_start><jupyter_text>Etherscan>[Etherscan](https://docs.etherscan.io/) is the leading blockchain explorer, search, API and analytics platform for Ethereum, a decentralized smart contracts platform. OverviewThe `Etherscan` loader use `Etherscan API` to load transactions histories under specific account on `Ethe...
langchain/docs/docs/integrations/document_loaders/etherscan.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/etherscan.ipynb", "repo_id": "langchain", "token_count": 781 }
107
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/accelerate.md/0
{ "file_path": "transformers/docs/source/ja/accelerate.md", "repo_id": "transformers", "token_count": 2185 }
522
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/blipdiffusion/test_blipdiffusion.py/0
{ "file_path": "diffusers/tests/pipelines/blipdiffusion/test_blipdiffusion.py", "repo_id": "diffusers", "token_count": 3065 }
268
import logging from enum import Enum from io import BytesIO from typing import Any, Callable, Dict, List, Optional, Union import requests from langchain_core.documents import Document from tenacity import ( before_sleep_log, retry, stop_after_attempt, wait_exponential, ) from langchain_community.docum...
langchain/libs/community/langchain_community/document_loaders/confluence.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/confluence.py", "repo_id": "langchain", "token_count": 13226 }
234
/** @type {import('next').NextConfig} */ const nextConfig = { async redirects() { return [ { source: "/", destination: "/index.html", permanent: false, }, ]; }, }; module.exports = nextConfig;
langchainjs/docs/api_refs/next.config.js/0
{ "file_path": "langchainjs/docs/api_refs/next.config.js", "repo_id": "langchainjs", "token_count": 105 }
688
from langchain_anthropic import __all__ EXPECTED_ALL = ["ChatAnthropicMessages"] def test_all_imports() -> None: assert sorted(EXPECTED_ALL) == sorted(__all__)
langchain/libs/partners/anthropic/tests/unit_tests/test_imports.py/0
{ "file_path": "langchain/libs/partners/anthropic/tests/unit_tests/test_imports.py", "repo_id": "langchain", "token_count": 60 }
680
"""Question answering over a graph.""" from __future__ import annotations import re from typing import Any, Dict, List, Optional from langchain_community.graphs.arangodb_graph import ArangoGraph from langchain_core.callbacks import CallbackManagerForChainRun from langchain_core.language_models import BaseLanguageMode...
langchain/libs/langchain/langchain/chains/graph_qa/arangodb.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/graph_qa/arangodb.py", "repo_id": "langchain", "token_count": 3838 }
489
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/core/src/query/Plan.cpp/0
{ "file_path": "milvus/internal/core/src/query/Plan.cpp", "repo_id": "milvus", "token_count": 2190 }
1,732
from __future__ import annotations import logging from typing import Any, Dict, List, Optional from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import BaseModel, root_validator from langchain_core.utils import get_from_dict_or_env logger = logging.getLogger(__name__) class VolcanoEm...
langchain/libs/community/langchain_community/embeddings/volcengine.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/volcengine.py", "repo_id": "langchain", "token_count": 1859 }
261
import pickle from typing import Optional import aiosqlite from langchain_core.pydantic_v1 import Field from langchain_core.runnables import RunnableConfig from langchain_core.runnables.utils import ConfigurableFieldSpec from langgraph.checkpoint.base import BaseCheckpointSaver, Checkpoint class AsyncSqliteSaver(Ba...
langgraph/langgraph/checkpoint/aiosqlite.py/0
{ "file_path": "langgraph/langgraph/checkpoint/aiosqlite.py", "repo_id": "langgraph", "token_count": 1185 }
1,075
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/modeling_outputs.py/0
{ "file_path": "transformers/src/transformers/modeling_outputs.py", "repo_id": "transformers", "token_count": 40604 }
578
"""Test AzureChatOpenAI wrapper.""" import os from typing import Any import pytest from langchain_core.callbacks import CallbackManager from langchain_core.messages import BaseMessage, HumanMessage from langchain_core.outputs import ChatGeneration, ChatResult, LLMResult from langchain_community.chat_models import Azu...
langchain/libs/community/tests/integration_tests/chat_models/test_azure_openai.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/chat_models/test_azure_openai.py", "repo_id": "langchain", "token_count": 2768 }
348
# Create a dataset card Each dataset should have a dataset card to promote responsible usage and inform users of any potential biases within the dataset. This idea was inspired by the Model Cards proposed by [Mitchell, 2018](https://arxiv.org/abs/1810.03993). Dataset cards help users understand a dataset's contents, t...
datasets/docs/source/dataset_card.mdx/0
{ "file_path": "datasets/docs/source/dataset_card.mdx", "repo_id": "datasets", "token_count": 757 }
120
# Generated content DO NOT EDIT from .. import utils cuda_is_available = utils.cuda_is_available get_num_threads = utils.get_num_threads has_accelerate = utils.has_accelerate has_mkl = utils.has_mkl load_ggml = utils.load_ggml load_gguf = utils.load_gguf load_safetensors = utils.load_safetensors save_gguf = utils.save...
candle/candle-pyo3/py_src/candle/utils/__init__.py/0
{ "file_path": "candle/candle-pyo3/py_src/candle/utils/__init__.py", "repo_id": "candle", "token_count": 150 }
62
"""Test tree index.""" from typing import Any, Dict, List, Optional from unittest.mock import patch from llama_index.core.data_structs.data_structs import IndexGraph from llama_index.core.indices.tree.base import TreeIndex from llama_index.core.schema import BaseNode, Document from llama_index.core.service_context im...
llama_index/llama-index-core/tests/indices/tree/test_index.py/0
{ "file_path": "llama_index/llama-index-core/tests/indices/tree/test_index.py", "repo_id": "llama_index", "token_count": 3184 }
1,234
python_requirements( name="reqs", ) python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/sitemap/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/sitemap/BUILD", "repo_id": "llama_index", "token_count": 24 }
1,458
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.openai import OpenAIImageGenerationToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in OpenAIImageGenerationToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-openai/tests/test_tools_openai_image_generation.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-openai/tests/test_tools_openai_image_generation.py", "repo_id": "llama_index", "token_count": 100 }
1,493
# Run this command to start the database: # docker-compose up --build version: "3" services: db: hostname: 127.0.0.1 image: ankane/pgvector ports: - 5432:5432 restart: always environment: - POSTGRES_DB=api - POSTGRES_USER=myuser - POSTGRES_PASSWORD=ChangeMe volumes: ...
langchainjs/libs/langchain-community/src/vectorstores/tests/pgvector/docker-compose.yml/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/pgvector/docker-compose.yml", "repo_id": "langchainjs", "token_count": 165 }
1,088
# Custom Diffusion training example [Custom Diffusion](https://arxiv.org/abs/2212.04488) is a method to customize text-to-image models like Stable Diffusion given just a few (4~5) images of a subject. The `train_custom_diffusion.py` script shows how to implement the training procedure and adapt it for stable diffusio...
diffusers/examples/custom_diffusion/README.md/0
{ "file_path": "diffusers/examples/custom_diffusion/README.md", "repo_id": "diffusers", "token_count": 3550 }
206
import { expect, test } from "@jest/globals"; import { OpenAI, OpenAIEmbeddings, ChatOpenAI } from "@langchain/openai"; import { PromptTemplate } from "@langchain/core/prompts"; import { ConversationalRetrievalQAChain } from "../conversational_retrieval_chain.js"; import { MemoryVectorStore } from "../../vectorstores/m...
langchainjs/langchain/src/chains/tests/conversational_retrieval_chain.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/chains/tests/conversational_retrieval_chain.int.test.ts", "repo_id": "langchainjs", "token_count": 3931 }
896
# coding=utf-8 # Copyright 2021 The HuggingFace Team Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a clone of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/tests/generation/test_flax_logits_process.py/0
{ "file_path": "transformers/tests/generation/test_flax_logits_process.py", "repo_id": "transformers", "token_count": 5610 }
726
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/de/autoclass_tutorial.md/0
{ "file_path": "transformers/docs/source/de/autoclass_tutorial.md", "repo_id": "transformers", "token_count": 2616 }
492
# elastic-query-generator This template allows interacting with Elasticsearch analytics databases in natural language using LLMs. It builds search queries via the Elasticsearch DSL API (filters and aggregations). ## Environment Setup Set the `OPENAI_API_KEY` environment variable to access the OpenAI models. ###...
langchain/templates/elastic-query-generator/README.md/0
{ "file_path": "langchain/templates/elastic-query-generator/README.md", "repo_id": "langchain", "token_count": 816 }
688
var fs = require("fs"); var path = require("path"); var express = require("express"); var chroma = require("chromadb"); var app = express(); app.get("/", async (req, res) => { const cc = new chroma.ChromaClient({ path: "http://localhost:8000" }); await cc.reset(); const google = new chroma.GoogleGenerativeAiEm...
chroma/clients/js/examples/node/app.js/0
{ "file_path": "chroma/clients/js/examples/node/app.js", "repo_id": "chroma", "token_count": 427 }
29
package segments import ( "context" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/internal/proto/internalpb" "github.com/milvus-io/milvus/internal/proto/querypb" "github.com/milvus-io/milvus/internal/proto/segcorepb" ) type defaultLimitReducer struct { req *querypb.Quer...
milvus/internal/querynodev2/segments/default_limit_reducer.go/0
{ "file_path": "milvus/internal/querynodev2/segments/default_limit_reducer.go", "repo_id": "milvus", "token_count": 766 }
2,046
Router Query Engine ======================= .. automodule:: llama_index.core.query_engine.router_query_engine :members: :inherited-members: :exclude-members: acombine_responses, combine_responses, default_node_to_metadata_fn
llama_index/docs/api_reference/query/query_engines/router_query_engine.rst/0
{ "file_path": "llama_index/docs/api_reference/query/query_engines/router_query_engine.rst", "repo_id": "llama_index", "token_count": 79 }
1,083
"""Init file."""
llama_index/llama-index-legacy/llama_index/legacy/indices/common/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/common/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,494
use candle::Result; use prost::Message; pub mod onnx { include!(concat!(env!("OUT_DIR"), "/onnx.rs")); } pub mod eval; pub use eval::{dtype, simple_eval}; pub fn read_file<P: AsRef<std::path::Path>>(p: P) -> Result<onnx::ModelProto> { let buf = std::fs::read(p)?; onnx::ModelProto::decode(buf.as_slice())....
candle/candle-onnx/src/lib.rs/0
{ "file_path": "candle/candle-onnx/src/lib.rs", "repo_id": "candle", "token_count": 154 }
63
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.recursive_retriever import ( EmbeddedTablesUnstructuredRetrieverPack, RecursiveRetrieverSmallToBigPack, ) def test_class(): names_of_base_classes = [ b.__name__ for b in EmbeddedTablesUnstructuredRetrieverPack.__mro__ ...
llama_index/llama-index-packs/llama-index-packs-recursive-retriever/tests/test_packs_recursive_retriever.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-recursive-retriever/tests/test_packs_recursive_retriever.py", "repo_id": "llama_index", "token_count": 217 }
1,588
<jupyter_start><jupyter_text>Dreambooth fine-tuning for Stable Diffusion using d🧨ffusers This notebook shows how to "teach" Stable Diffusion a new concept via Dreambooth using 🤗 Hugging Face [🧨 Diffusers library](https://github.com/huggingface/diffusers). _By using just 3-5 images you can teach new concepts to Stabl...
notebooks/diffusers/sd_dreambooth_training.ipynb/0
{ "file_path": "notebooks/diffusers/sd_dreambooth_training.ipynb", "repo_id": "notebooks", "token_count": 11907 }
277
import threading import time import unittest import unittest.mock from typing import Any, Dict from uuid import UUID import pytest from langsmith import Client from langchain_core.outputs import LLMResult from langchain_core.tracers.langchain import LangChainTracer from langchain_core.tracers.schemas import Run def...
langchain/libs/core/tests/unit_tests/tracers/test_langchain.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/tracers/test_langchain.py", "repo_id": "langchain", "token_count": 2638 }
421
from typing import Any import pytest from langchain_community.retrievers import DocArrayRetriever from tests.integration_tests.retrievers.docarray.fixtures import ( # noqa: F401 init_elastic, init_hnsw, init_in_memory, init_qdrant, init_weaviate, ) @pytest.mark.parametrize( "backend", [...
langchain/libs/community/tests/integration_tests/retrievers/docarray/test_backends.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/retrievers/docarray/test_backends.py", "repo_id": "langchain", "token_count": 806 }
369
from stepback_qa_prompting.chain import chain if __name__ == "__main__": chain.invoke({"question": "was chatgpt around while trump was president?"})
langchain/templates/stepback-qa-prompting/main.py/0
{ "file_path": "langchain/templates/stepback-qa-prompting/main.py", "repo_id": "langchain", "token_count": 49 }
758
python_tests()
llama_index/llama-index-integrations/tools/llama-index-tools-notion/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-notion/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,519
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py", "repo_id": "diffusers", "token_count": 30632 }
266
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/ko/quicktour.md/0
{ "file_path": "diffusers/docs/source/ko/quicktour.md", "repo_id": "diffusers", "token_count": 11429 }
190
import logging logger = logging.getLogger("milvus_benchmark.parser") def operations_parser(operations): """ Get the type and params of test """ if not operations: raise Exception("No operations in suite defined") for run_type, run_params in operations.items(): logger.debug(run_type) ...
milvus/tests/benchmark/milvus_benchmark/parser.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/parser.py", "repo_id": "milvus", "token_count": 1292 }
1,935
use crate::tokenizer::pattern::Pattern; use crate::tokenizer::Decoder; use crate::tokenizer::{NormalizedString, Normalizer, Result}; use crate::utils::SysRegex; use serde::{Deserialize, Serialize}; /// Represents the different patterns that `Replace` can use #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Eq...
tokenizers/tokenizers/src/normalizers/replace.rs/0
{ "file_path": "tokenizers/tokenizers/src/normalizers/replace.rs", "repo_id": "tokenizers", "token_count": 2048 }
482
<jupyter_start><jupyter_text>Slack ReaderDemonstrates our Slack data connector If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-readers-slack !pip install llama-index import logging import sys logging.basicConfig(stream=sys.stdout, level=l...
llama_index/docs/examples/data_connectors/SlackDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/data_connectors/SlackDemo.ipynb", "repo_id": "llama_index", "token_count": 320 }
1,054
python_sources() resource( name="py_typed", source="py.typed", )
llama_index/llama-index-legacy/llama_index/legacy/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/BUILD", "repo_id": "llama_index", "token_count": 34 }
1,484
# ESE-VoVNet **VoVNet** is a convolutional neural network that seeks to make [DenseNet](https://paperswithcode.com/method/densenet) more efficient by concatenating all features only once in the last feature map, which makes input size constant and enables enlarging new output channel. Read about [one-shot aggregatio...
pytorch-image-models/docs/models/ese-vovnet.md/0
{ "file_path": "pytorch-image-models/docs/models/ese-vovnet.md", "repo_id": "pytorch-image-models", "token_count": 1948 }
352
Empty Index Retriever ======================= .. automodule:: llama_index.core.indices.empty.retrievers :members: :inherited-members: .. :exclude-members: index_struct, query, set_llm_predictor, set_prompt_helper
llama_index/docs/api_reference/query/retrievers/empty.rst/0
{ "file_path": "llama_index/docs/api_reference/query/retrievers/empty.rst", "repo_id": "llama_index", "token_count": 81 }
1,084
import type { Client } from "typesense"; import type { MultiSearchRequestSchema } from "typesense/lib/Typesense/MultiSearch.js"; import type { SearchResponseHit, DocumentSchema, } from "typesense/lib/Typesense/Documents.js"; import type { EmbeddingsInterface } from "@langchain/core/embeddings"; import { VectorStore...
langchainjs/libs/langchain-community/src/vectorstores/typesense.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/typesense.ts", "repo_id": "langchainjs", "token_count": 3164 }
1,056
import { Readable } from "stream"; import { GoogleAuth, GoogleAuthOptions } from "google-auth-library"; import { GoogleAbstractedClient, GoogleAbstractedClientOps, } from "../types/googlevertexai-types.js"; import { GoogleVertexAIStream } from "./googlevertexai-connection.js"; class GoogleVertexAINodeStream extend...
langchainjs/libs/langchain-community/src/utils/googlevertexai-gauth.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/utils/googlevertexai-gauth.ts", "repo_id": "langchainjs", "token_count": 360 }
1,020
from llama_index.core.llms.base import BaseLLM from llama_index.llms.nvidia_tensorrt import LocalTensorRTLLM def test_embedding_class(): names_of_base_classes = [b.__name__ for b in LocalTensorRTLLM.__mro__] assert BaseLLM.__name__ in names_of_base_classes
llama_index/llama-index-integrations/llms/llama-index-llms-nvidia-tensorrt/tests/test_llms_nvidia_tensorrt.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-nvidia-tensorrt/tests/test_llms_nvidia_tensorrt.py", "repo_id": "llama_index", "token_count": 103 }
1,290
# 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/src/transformers/models/cvt/configuration_cvt.py/0
{ "file_path": "transformers/src/transformers/models/cvt/configuration_cvt.py", "repo_id": "transformers", "token_count": 2781 }
586
mod ffi; use candle::backend::BackendStorage; use candle::cuda_backend::cudarc::driver::DevicePtr; use candle::cuda_backend::WrapErr; use candle::{CpuStorage, DType, Layout, Result, Shape, Tensor}; use half::{bf16, f16}; pub struct FlashAttn { pub softmax_scale: f32, pub alibi_slopes: Option<Tensor>, pub ...
candle/candle-flash-attn/src/lib.rs/0
{ "file_path": "candle/candle-flash-attn/src/lib.rs", "repo_id": "candle", "token_count": 15951 }
51
python_sources()
llama_index/llama-index-core/llama_index/core/indices/common/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/common/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,189
"""Utility functions for working with vectors and vectorstores.""" from enum import Enum from typing import List, Tuple, Type import numpy as np from langchain_core.documents import Document from langchain_community.utils.math import cosine_similarity class DistanceStrategy(str, Enum): """Enumerator of the Dis...
langchain/libs/community/langchain_community/vectorstores/utils.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/utils.py", "repo_id": "langchain", "token_count": 1016 }
337
import multiprocessing from typing import TYPE_CHECKING, Optional, Union from .. import Dataset, Features, config from ..formatting import query_table from ..packaged_modules.sql.sql import Sql from ..utils import tqdm as hf_tqdm from .abc import AbstractDatasetInputStream if TYPE_CHECKING: import sqlite3 i...
datasets/src/datasets/io/sql.py/0
{ "file_path": "datasets/src/datasets/io/sql.py", "repo_id": "datasets", "token_count": 2040 }
139
"""Callback Handler streams to stdout on new llm token.""" import sys from typing import Any, Dict, List, Optional from langchain_core.callbacks import StreamingStdOutCallbackHandler DEFAULT_ANSWER_PREFIX_TOKENS = ["Final", "Answer", ":"] class FinalStreamingStdOutCallbackHandler(StreamingStdOutCallbackHandler): ...
langchain/libs/langchain/langchain/callbacks/streaming_stdout_final_only.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/streaming_stdout_final_only.py", "repo_id": "langchain", "token_count": 1491 }
451
# coding=utf-8 # 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 requir...
transformers/tests/models/bloom/test_tokenization_bloom.py/0
{ "file_path": "transformers/tests/models/bloom/test_tokenization_bloom.py", "repo_id": "transformers", "token_count": 3390 }
710
# coding=utf-8 # Copyright 2022 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/utils/sort_auto_mappings.py/0
{ "file_path": "transformers/utils/sort_auto_mappings.py", "repo_id": "transformers", "token_count": 1812 }
801
python_tests()
llama_index/llama-index-integrations/retrievers/llama-index-retrievers-you/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/retrievers/llama-index-retrievers-you/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,587
import os def get_boolean_env_var(var_name, default_value=False): """Retrieve the boolean value of an environment variable. Args: var_name (str): The name of the environment variable to retrieve. default_value (bool): The default value to return if the variable is not found. Returns: boo...
langchain/templates/rag-redis/rag_redis/config.py/0
{ "file_path": "langchain/templates/rag-redis/rag_redis/config.py", "repo_id": "langchain", "token_count": 844 }
685
import { OpenAI } from "@langchain/openai"; import { BufferWindowMemory } from "langchain/memory"; import { LLMChain } from "langchain/chains"; import { PromptTemplate } from "@langchain/core/prompts"; export const run = async () => { const memory = new BufferWindowMemory({ memoryKey: "chat_history", k: 1 }); cons...
langchainjs/examples/src/memory/buffer_window.ts/0
{ "file_path": "langchainjs/examples/src/memory/buffer_window.ts", "repo_id": "langchainjs", "token_count": 287 }
838
"""Wrapper around YandexGPT chat models.""" from __future__ import annotations import logging from typing import Any, Callable, Dict, List, Optional, cast from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_models.chat_models import Ba...
langchain/libs/community/langchain_community/chat_models/yandex.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/yandex.py", "repo_id": "langchain", "token_count": 3849 }
223
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/tests/integration/alias/alias_test.go/0
{ "file_path": "milvus/tests/integration/alias/alias_test.go", "repo_id": "milvus", "token_count": 2823 }
2,157
from langchain_community.document_loaders.parsers.audio import ( OpenAIWhisperParser, OpenAIWhisperParserLocal, YandexSTTParser, ) __all__ = ["OpenAIWhisperParser", "OpenAIWhisperParserLocal", "YandexSTTParser"]
langchain/libs/langchain/langchain/document_loaders/parsers/audio.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/parsers/audio.py", "repo_id": "langchain", "token_count": 86 }
512
import logging import time import pytest from pymilvus import DataType import numpy as np from pathlib import Path from base.client_base import TestcaseBase from common import common_func as cf from common import common_type as ct from common.milvus_sys import MilvusSys from common.common_type import CaseLabel, CheckTa...
milvus/tests/python_client/bulk_insert/test_bulk_insert_bench.py/0
{ "file_path": "milvus/tests/python_client/bulk_insert/test_bulk_insert_bench.py", "repo_id": "milvus", "token_count": 4504 }
1,882
# Hatena Blog Loader This loader fetches article from your own [Hatena Blog](https://hatenablog.com/) blog posts using the AtomPub API. You can get AtomPub info from the admin page after logging into Hatena Blog. ## Usage Here's an example usage of the HatenaBlogReader. ```python from llama_index import download_l...
llama_index/llama-index-integrations/readers/llama-index-readers-hatena-blog/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-hatena-blog/README.md", "repo_id": "llama_index", "token_count": 327 }
1,333
import { test } from "@jest/globals"; import { OpenAI } from "@langchain/openai"; import { ConversationChain } from "../conversation.js"; test("Test ConversationChain", async () => { const model = new OpenAI({ modelName: "gpt-3.5-turbo-instruct" }); const chain = new ConversationChain({ llm: model }); const res ...
langchainjs/langchain/src/chains/tests/conversation_chain.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/chains/tests/conversation_chain.int.test.ts", "repo_id": "langchainjs", "token_count": 124 }
911
// 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/distributed/indexnode/service_test.go/0
{ "file_path": "milvus/internal/distributed/indexnode/service_test.go", "repo_id": "milvus", "token_count": 1403 }
1,787
from langchain_core.messages import AIMessage, HumanMessage from langchain_community.chat_models.hunyuan import ChatHunyuan def test_chat_hunyuan() -> None: chat = ChatHunyuan() message = HumanMessage(content="Hello") response = chat([message]) assert isinstance(response, AIMessage) assert isinst...
langchain/libs/community/tests/integration_tests/chat_models/test_hunyuan.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/chat_models/test_hunyuan.py", "repo_id": "langchain", "token_count": 266 }
339
"""**Retriever** class returns Documents given a text **query**. It is more general than a vector store. A retriever does not need to be able to store documents, only to return (or retrieve) it. Vector stores can be used as the backbone of a retriever, but there are other types of retrievers as well. **Class hierarch...
langchain/libs/community/langchain_community/retrievers/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/__init__.py", "repo_id": "langchain", "token_count": 1523 }
276
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, MBart50TokenizerFast, MBartForConditionalGeneration, pipeline, ) from diffusers import DiffusionPipeline from diffusers.configuration_util...
diffusers/examples/community/multilingual_stable_diffusion.py/0
{ "file_path": "diffusers/examples/community/multilingual_stable_diffusion.py", "repo_id": "diffusers", "token_count": 9667 }
212
#![cfg(feature = "http")] use tokenizers::{FromPretrainedParameters, Result, Tokenizer}; #[test] fn test_from_pretrained() -> Result<()> { let tokenizer = Tokenizer::from_pretrained("bert-base-cased", None)?; let encoding = tokenizer.encode("Hey there dear friend!", false)?; assert_eq!( encoding.ge...
tokenizers/tokenizers/tests/from_pretrained.rs/0
{ "file_path": "tokenizers/tokenizers/tests/from_pretrained.rs", "repo_id": "tokenizers", "token_count": 683 }
472
from llama_index.packs.auto_merging_retriever.base import AutoMergingRetrieverPack __all__ = ["AutoMergingRetrieverPack"]
llama_index/llama-index-packs/llama-index-packs-auto-merging-retriever/llama_index/packs/auto_merging_retriever/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-auto-merging-retriever/llama_index/packs/auto_merging_retriever/__init__.py", "repo_id": "llama_index", "token_count": 42 }
1,694
""" MLP-Mixer, ResMLP, and gMLP in PyTorch This impl originally based on MLP-Mixer paper. Official JAX impl: https://github.com/google-research/vision_transformer/blob/linen/vit_jax/models_mixer.py Paper: 'MLP-Mixer: An all-MLP Architecture for Vision' - https://arxiv.org/abs/2105.01601 @article{tolstikhin2021, t...
pytorch-image-models/timm/models/mlp_mixer.py/0
{ "file_path": "pytorch-image-models/timm/models/mlp_mixer.py", "repo_id": "pytorch-image-models", "token_count": 11661 }
355
import contextlib import copy import fnmatch import json import math import posixpath import re import warnings from io import BytesIO from pathlib import Path from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union import fsspec import numpy as np from huggingface_hub import ( CommitInfo, Co...
datasets/src/datasets/dataset_dict.py/0
{ "file_path": "datasets/src/datasets/dataset_dict.py", "repo_id": "datasets", "token_count": 47125 }
135
version: '3.5' services: etcd: container_name: milvus-etcd image: quay.io/coreos/etcd:v3.5.0 volumes: - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd pulsar: container_n...
milvus/tests/python_client/deploy/cluster/docker-compose.yml/0
{ "file_path": "milvus/tests/python_client/deploy/cluster/docker-compose.yml", "repo_id": "milvus", "token_count": 2167 }
2,179
//! Linear layer //! //! This layer applies a linear transformation to the incoming data, `y = x@w.t() + b`. //! The bias is optional. The `forward` method can be used to apply the layer, it supports input //! with a batch dimension (so of shape `(b_sz, in_c)`) or without (of shape `(in_c,)`), the //! output has shape ...
candle/candle-nn/src/linear.rs/0
{ "file_path": "candle/candle-nn/src/linear.rs", "repo_id": "candle", "token_count": 1120 }
68
<html> <main id="main-content"> Websites: <a href="https://langchain.com">Langchain</a> <a href="https://docs.langchain.com">Langchain Docs</a> <a href="https://api.python.langchain.com/en/latest/api_reference.html" >Langchain API Reference</a > </main> </html>
langchain/libs/community/tests/unit_tests/document_loaders/test_docs/readthedocs/index_page/test.html/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_docs/readthedocs/index_page/test.html", "repo_id": "langchain", "token_count": 124 }
372
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
datasets/metrics/f1/f1.py/0
{ "file_path": "datasets/metrics/f1/f1.py", "repo_id": "datasets", "token_count": 2364 }
130
#!/usr/bin/env python # coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
transformers/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py/0
{ "file_path": "transformers/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py", "repo_id": "transformers", "token_count": 13708 }
577
from neo4j_vector_memory.chain import chain __all__ = ["chain"]
langchain/templates/neo4j-vector-memory/neo4j_vector_memory/__init__.py/0
{ "file_path": "langchain/templates/neo4j-vector-memory/neo4j_vector_memory/__init__.py", "repo_id": "langchain", "token_count": 22 }
645
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/core/src/common/Common.cpp/0
{ "file_path": "milvus/internal/core/src/common/Common.cpp", "repo_id": "milvus", "token_count": 894 }
1,862
<jupyter_start><jupyter_text>ForefrontAIThe `Forefront` platform gives you the ability to fine-tune and use [open-source large language models](https://docs.forefront.ai/forefront/master/models).This notebook goes over how to use Langchain with [ForefrontAI](https://www.forefront.ai/). Imports<jupyter_code>import os ...
langchain/docs/docs/integrations/llms/forefrontai.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/forefrontai.ipynb", "repo_id": "langchain", "token_count": 554 }
114
from langchain.prompts.prompt import PromptTemplate DEFAULT_INPUT_KEY = "example" DEFAULT_PROMPT = PromptTemplate( input_variables=[DEFAULT_INPUT_KEY], template="{example}" ) SYNTHETIC_FEW_SHOT_PREFIX = ( "This is a test about generating synthetic data about {subject}. Examples below:" ) SYNTHETIC_FEW_SHOT_SU...
langchain/libs/experimental/langchain_experimental/tabular_synthetic_data/prompts.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/tabular_synthetic_data/prompts.py", "repo_id": "langchain", "token_count": 145 }
426
from langchain_core.prompts import BasePromptTemplate, format_document __all__ = ["BasePromptTemplate", "format_document"]
langchain/libs/langchain/langchain/schema/prompt_template.py/0
{ "file_path": "langchain/libs/langchain/langchain/schema/prompt_template.py", "repo_id": "langchain", "token_count": 36 }
590
from langchain_community.tools.gitlab.tool import GitLabAction __all__ = ["GitLabAction"]
langchain/libs/langchain/langchain/tools/gitlab/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/gitlab/tool.py", "repo_id": "langchain", "token_count": 29 }
555
# GraphQL Tool This tool provides agents the ability to easily execute GraphQL queries against a server. The tool can be initialized with the server url and any required headers and thereafter perform queries against the server ## Usage This tool has a more extensive example usage documented in a Jupyter notebook [h...
llama_index/llama-index-integrations/tools/llama-index-tools-graphql/README.md/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-graphql/README.md", "repo_id": "llama_index", "token_count": 416 }
1,514
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ /** * Creating a sidebar enables you to: - create an ordered group of docs - render a sidebar for each doc of t...
langchain/docs/sidebars.js/0
{ "file_path": "langchain/docs/sidebars.js", "repo_id": "langchain", "token_count": 2793 }
214
# DeepSparse This page covers how to use the [DeepSparse](https://github.com/neuralmagic/deepsparse) inference runtime within LangChain. It is broken into two parts: installation and setup, and then examples of DeepSparse usage. ## Installation and Setup - Install the Python package with `pip install deepsparse` - C...
langchain/docs/docs/integrations/providers/deepsparse.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/deepsparse.mdx", "repo_id": "langchain", "token_count": 406 }
138
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.neo4j_query_engine import Neo4jQueryEnginePack def test_class(): names_of_base_classes = [b.__name__ for b in Neo4jQueryEnginePack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-neo4j-query-engine/tests/test_packs_neo4j_query_engine.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-neo4j-query-engine/tests/test_packs_neo4j_query_engine.py", "repo_id": "llama_index", "token_count": 105 }
1,597
import { OpenAI } from "@langchain/openai"; import { AWSSfnToolkit } from "@langchain/community/agents/toolkits/aws_sfn"; import { createAWSSfnAgent } from "langchain/agents/toolkits/aws_sfn"; const _EXAMPLE_STATE_MACHINE_ASL = ` { "Comment": "A simple example of the Amazon States Language to define a state machine ...
langchainjs/examples/src/agents/aws_sfn.ts/0
{ "file_path": "langchainjs/examples/src/agents/aws_sfn.ts", "repo_id": "langchainjs", "token_count": 601 }
808
from langchain_community.chat_message_histories.astradb import ( AstraDBChatMessageHistory, ) __all__ = ["AstraDBChatMessageHistory"]
langchain/libs/langchain/langchain/memory/chat_message_histories/astradb.py/0
{ "file_path": "langchain/libs/langchain/langchain/memory/chat_message_histories/astradb.py", "repo_id": "langchain", "token_count": 46 }
523