text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
<jupyter_start><jupyter_text>BREEBS (Open Knowledge)[BREEBS](https://www.breebs.com/) is an open collaborative knowledge platform. Anybody can create a Breeb, a knowledge capsule, based on PDFs stored on a Google Drive folder.A breeb can be used by any LLM/chatbot to improve its expertise, reduce hallucinations and giv...
langchain/docs/docs/integrations/retrievers/breebs.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/breebs.ipynb", "repo_id": "langchain", "token_count": 740 }
156
import os from shutil import rmtree from typing import Callable, Dict, List, Optional import tqdm from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.postprocessor.types import BaseNodePostprocessor from llama_index.core.schema import Document, QueryBundle from llama_index.core.utils i...
llama_index/llama-index-core/llama_index/core/evaluation/benchmarks/beir.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/evaluation/benchmarks/beir.py", "repo_id": "llama_index", "token_count": 2092 }
1,172
<jupyter_start><jupyter_text>NucliaDBYou can use a local NucliaDB instance or use [Nuclia Cloud](https://nuclia.cloud).When using a local instance, you need a Nuclia Understanding API key, so your texts are properly vectorized and indexed. You can get a key by creating a free account at [https://nuclia.cloud](https://n...
langchain/docs/docs/integrations/vectorstores/nucliadb.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/nucliadb.ipynb", "repo_id": "langchain", "token_count": 501 }
192
"""Test utils.""" from typing import List from llama_index.legacy.bridge.pydantic import Field from llama_index.legacy.tools.utils import create_schema_from_function def test_create_schema_from_function() -> None: """Test create schema from function.""" def test_fn(x: int, y: int, z: List[str]) -> None: ...
llama_index/llama-index-legacy/tests/tools/test_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/tools/test_utils.py", "repo_id": "llama_index", "token_count": 665 }
1,763
# BiliBili >[Bilibili](https://www.bilibili.tv/) is one of the most beloved long-form video sites in China. ## Installation and Setup ```bash pip install bilibili-api-python ``` ## Document Loader See a [usage example](/docs/integrations/document_loaders/bilibili). ```python from langchain_community.document_load...
langchain/docs/docs/integrations/providers/bilibili.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/bilibili.mdx", "repo_id": "langchain", "token_count": 116 }
142
import { GooglePlacesAPI } from "@langchain/community/tools/google_places"; import { OpenAI } from "@langchain/openai"; import { initializeAgentExecutorWithOptions } from "langchain/agents"; export async function run() { const model = new OpenAI({ temperature: 0, }); const tools = [new GooglePlacesAPI()]; ...
langchainjs/examples/src/tools/google_places.ts/0
{ "file_path": "langchainjs/examples/src/tools/google_places.ts", "repo_id": "langchainjs", "token_count": 183 }
916
import { test, expect } from "@jest/globals"; import { SearchApi } from "../searchapi.js"; describe("SearchApi test suite", () => { class SearchApiUrlTester extends SearchApi { testThisUrl(): string { return this.buildUrl("Query"); } } test("Test default url", async () => { const searchApi = n...
langchainjs/libs/langchain-community/src/tools/tests/searchapi.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/tests/searchapi.test.ts", "repo_id": "langchainjs", "token_count": 229 }
999
from langchain_community.chat_message_histories.upstash_redis import ( UpstashRedisChatMessageHistory, ) __all__ = ["UpstashRedisChatMessageHistory"]
langchain/libs/langchain/langchain/memory/chat_message_histories/upstash_redis.py/0
{ "file_path": "langchain/libs/langchain/langchain/memory/chat_message_histories/upstash_redis.py", "repo_id": "langchain", "token_count": 53 }
530
- title: Unit 0. Welcome to the RLHF Handbook! sections: - local: chapter0/introduction title: What is this about?
alignment-handbook/chapters/en/_toctree.yml/0
{ "file_path": "alignment-handbook/chapters/en/_toctree.yml", "repo_id": "alignment-handbook", "token_count": 38 }
21
from llama_index.packs.agents_llm_compiler.base import LLMCompilerAgentPack __all__ = ["LLMCompilerAgentPack"]
llama_index/llama-index-packs/llama-index-packs-agents-llm-compiler/llama_index/packs/agents_llm_compiler/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-agents-llm-compiler/llama_index/packs/agents_llm_compiler/__init__.py", "repo_id": "llama_index", "token_count": 39 }
1,658
import { LLM, type BaseLLMParams } from "@langchain/core/language_models/llms"; import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager"; import { GenerationChunk } from "@langchain/core/outputs"; export interface CustomLLMInput extends BaseLLMParams { n: number; } export class CustomLLM extends...
langchainjs/examples/src/models/llm/custom.ts/0
{ "file_path": "langchainjs/examples/src/models/llm/custom.ts", "repo_id": "langchainjs", "token_count": 453 }
810
package backend import ( clientv3 "go.etcd.io/etcd/client/v3" "github.com/milvus-io/milvus/cmd/tools/migration/configs" "github.com/milvus-io/milvus/internal/kv" etcdkv "github.com/milvus-io/milvus/internal/kv/etcd" "github.com/milvus-io/milvus/pkg/util/etcd" ) type etcdBasedBackend struct { cfg *configs.M...
milvus/cmd/tools/migration/backend/etcd.go/0
{ "file_path": "milvus/cmd/tools/migration/backend/etcd.go", "repo_id": "milvus", "token_count": 579 }
1,702
#![allow(dead_code)] use crate::op::{BinaryOpT, CmpOp, ReduceOp, UnaryOpT}; use crate::{CpuStorage, DType, Error, Layout, Result, Shape}; #[derive(Debug, Clone)] pub struct MetalDevice; #[derive(Debug)] pub struct MetalStorage; #[derive(thiserror::Error, Debug)] pub enum MetalError { #[error("{0}")] Message(...
candle/candle-core/src/dummy_metal_backend.rs/0
{ "file_path": "candle/candle-core/src/dummy_metal_backend.rs", "repo_id": "candle", "token_count": 2690 }
28
import logging try: from .candle import * except ImportError as e: # If we are in development mode, or we did not bundle the DLLs, we try to locate them here # PyO3 wont give us any information about what DLLs are missing, so we can only try to load # the DLLs and re-import the module logging.warni...
candle/candle-pyo3/py_src/candle/__init__.py/0
{ "file_path": "candle/candle-pyo3/py_src/candle/__init__.py", "repo_id": "candle", "token_count": 919 }
60
// 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/datacoord/handler.go/0
{ "file_path": "milvus/internal/datacoord/handler.go", "repo_id": "milvus", "token_count": 5330 }
1,774
"""Test Hippo functionality.""" from typing import List, Optional from langchain_core.documents import Document from langchain_community.vectorstores.hippo import Hippo from tests.integration_tests.vectorstores.fake_embeddings import ( FakeEmbeddings, fake_texts, ) def _hippo_from_texts( metadatas: Opt...
langchain/libs/community/tests/integration_tests/vectorstores/test_hippo.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_hippo.py", "repo_id": "langchain", "token_count": 794 }
355
from langchain_community.document_loaders.max_compute import MaxComputeLoader __all__ = ["MaxComputeLoader"]
langchain/libs/langchain/langchain/document_loaders/max_compute.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/max_compute.py", "repo_id": "langchain", "token_count": 33 }
493
<jupyter_start><jupyter_text>LLM Compiler Agent Cookbook**NOTE**: Full credits to the [source repo for LLMCompiler](https://github.com/SqueezeAILab/LLMCompiler). A lot of our implementation was lifted from this repo (and adapted with LlamaIndex modules).In this cookbook, we show how to use our LLMCompiler agent impleme...
llama_index/llama-index-packs/llama-index-packs-agents-llm-compiler/examples/llm_compiler.ipynb/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-agents-llm-compiler/examples/llm_compiler.ipynb", "repo_id": "llama_index", "token_count": 2752 }
1,769
# Stripe >[Stripe](https://stripe.com/en-ca) is an Irish-American financial services and software as a service (SaaS) company. It offers payment-processing software and application programming interfaces for e-commerce websites and mobile applications. ## Installation and Setup See [setup instructions](/docs/integr...
langchain/docs/docs/integrations/providers/stripe.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/stripe.mdx", "repo_id": "langchain", "token_count": 138 }
149
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
text-generation-inference/server/text_generation_server/models/custom_modeling/flash_mistral_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_mistral_modeling.py", "repo_id": "text-generation-inference", "token_count": 7558 }
443
# coding=utf-8 # Copyright 2021 ASAPP Inc. and the HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
transformers/src/transformers/models/sew_d/modeling_sew_d.py/0
{ "file_path": "transformers/src/transformers/models/sew_d/modeling_sew_d.py", "repo_id": "transformers", "token_count": 32314 }
656
/* eslint-disable prefer-template */ /* eslint-disable no-param-reassign */ // eslint-disable-next-line import/no-extraneous-dependencies const babel = require("@babel/core"); const path = require("path"); const fs = require("fs"); /** * * @param {string|Buffer} content Content of the resource file * @param {object...
langchain/docs/code-block-loader.js/0
{ "file_path": "langchain/docs/code-block-loader.js", "repo_id": "langchain", "token_count": 918 }
87
# coding=utf-8 # Copyright 2023 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...
transformers/tests/tools/test_translation.py/0
{ "file_path": "transformers/tests/tools/test_translation.py", "repo_id": "transformers", "token_count": 1249 }
839
# coding=utf-8 # Copyright 2022 The OpenAI Team Authors 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/L...
transformers/src/transformers/models/clipseg/modeling_clipseg.py/0
{ "file_path": "transformers/src/transformers/models/clipseg/modeling_clipseg.py", "repo_id": "transformers", "token_count": 27595 }
580
from langchain_community.document_loaders.parsers.grobid import ( GrobidParser, ServerUnavailableException, ) __all__ = ["GrobidParser", "ServerUnavailableException"]
langchain/libs/langchain/langchain/document_loaders/parsers/grobid.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/parsers/grobid.py", "repo_id": "langchain", "token_count": 56 }
496
# 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/layoutlmv3/image_processing_layoutlmv3.py/0
{ "file_path": "transformers/src/transformers/models/layoutlmv3/image_processing_layoutlmv3.py", "repo_id": "transformers", "token_count": 7554 }
634
- sections: - local: index title: 🤗 Transformers - local: quicktour title: Tour rapido - local: installation title: Installazione title: Iniziare - sections: - local: pipeline_tutorial title: Pipeline per l'inferenza - local: autoclass_tutorial title: Carica istanze pre-allenate con Aut...
transformers/docs/source/it/_toctree.yml/0
{ "file_path": "transformers/docs/source/it/_toctree.yml", "repo_id": "transformers", "token_count": 771 }
531
//! Variable initialization. // This is based on: // https://github.com/pytorch/pytorch/blob/07107919297db3f8ab37f11c12666b6d6d5f692e/torch/nn/init.py# use candle::{DType, Device, Result, Shape, Tensor, Var}; /// Number of features as input or output of a layer. /// In Kaiming initialization, choosing `FanIn` preserve...
candle/candle-nn/src/init.rs/0
{ "file_path": "candle/candle-nn/src/init.rs", "repo_id": "candle", "token_count": 2212 }
57
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-together/llama_index/llms/together/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-together/llama_index/llms/together/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,334
# Serialization
candle/candle-book/src/training/serialization.md/0
{ "file_path": "candle/candle-book/src/training/serialization.md", "repo_id": "candle", "token_count": 4 }
29
import { type BaseMessage, ToolMessage, AIMessage, } from "@langchain/core/messages"; import type { ToolsAgentStep } from "../openai/output_parser.js"; export function formatToOpenAIToolMessages( steps: ToolsAgentStep[] ): BaseMessage[] { return steps.flatMap(({ action, observation }) => { if ("messageLo...
langchainjs/langchain/src/agents/format_scratchpad/openai_tools.ts/0
{ "file_path": "langchainjs/langchain/src/agents/format_scratchpad/openai_tools.ts", "repo_id": "langchainjs", "token_count": 244 }
878
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/pkg/util/contextutil/context_util.go/0
{ "file_path": "milvus/pkg/util/contextutil/context_util.go", "repo_id": "milvus", "token_count": 584 }
1,824
python_tests()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-langchain/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-langchain/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,317
from llama_index.readers.kibela.base import KibelaReader __all__ = ["KibelaReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-kibela/llama_index/readers/kibela/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-kibela/llama_index/readers/kibela/__init__.py", "repo_id": "llama_index", "token_count": 32 }
1,373
# flake8: noqa from typing import TYPE_CHECKING from ....utils import ( DIFFUSERS_SLOW_IMPORT, _LazyModule, is_note_seq_available, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, get_objects_from_module, ) _dummy_objects = {} _import_structure = {} try: i...
diffusers/src/diffusers/pipelines/deprecated/spectrogram_diffusion/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/deprecated/spectrogram_diffusion/__init__.py", "repo_id": "diffusers", "token_count": 985 }
243
use super::schedulers::{betas_for_alpha_bar, BetaSchedule, PredictionType}; use candle::{Result, Tensor}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum DDPMVarianceType { FixedSmall, FixedSmallLog, FixedLarge, FixedLargeLog, Learned, } impl Default for DDPMVarianceType { fn default() -> Self...
candle/candle-transformers/src/models/stable_diffusion/ddpm.rs/0
{ "file_path": "candle/candle-transformers/src/models/stable_diffusion/ddpm.rs", "repo_id": "candle", "token_count": 3662 }
75
python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/extractors/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/extractors/BUILD", "repo_id": "llama_index", "token_count": 25 }
1,617
from typing import Dict, Generator, List, Optional, Sequence, Union import numpy as np from numpy.typing import NDArray import pytest import chromadb from chromadb.api.types import URI, DataLoader, Documents, IDs, Image, URIs from chromadb.api import ServerAPI from chromadb.test.ef.test_multimodal_ef import hashing_mu...
chroma/chromadb/test/data_loader/test_data_loader.py/0
{ "file_path": "chroma/chromadb/test/data_loader/test_data_loader.py", "repo_id": "chroma", "token_count": 1428 }
21
from llama_index.core.readers.base import BaseReader from llama_index.readers.psychic import PsychicReader def test_class(): names_of_base_classes = [b.__name__ for b in PsychicReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-psychic/tests/test_readers_psychic.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-psychic/tests/test_readers_psychic.py", "repo_id": "llama_index", "token_count": 86 }
1,369
"""Init file."""
llama_index/llama-index-core/tests/prompts/__init__.py/0
{ "file_path": "llama_index/llama-index-core/tests/prompts/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,165
// 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/client/client.go/0
{ "file_path": "milvus/internal/distributed/indexnode/client/client.go", "repo_id": "milvus", "token_count": 2257 }
1,850
"""Test the base tool implementation.""" import json from datetime import datetime from enum import Enum from functools import partial from typing import Any, Callable, Dict, List, Optional, Type, Union import pytest from langchain_core.callbacks import ( AsyncCallbackManagerForToolRun, CallbackManagerForToo...
langchain/libs/core/tests/unit_tests/test_tools.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/test_tools.py", "repo_id": "langchain", "token_count": 10890 }
439
from llama_index.readers.firebase_realtimedb.base import FirebaseRealtimeDatabaseReader __all__ = ["FirebaseRealtimeDatabaseReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-firebase-realtimedb/llama_index/readers/firebase_realtimedb/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-firebase-realtimedb/llama_index/readers/firebase_realtimedb/__init__.py", "repo_id": "llama_index", "token_count": 41 }
1,497
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-opensearch/llama_index/readers/opensearch/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-opensearch/llama_index/readers/opensearch/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,352
from llama_index.readers.genius.base import GeniusReader __all__ = ["GeniusReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-genius/llama_index/readers/genius/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-genius/llama_index/readers/genius/__init__.py", "repo_id": "llama_index", "token_count": 28 }
1,368
import { CloseVectorHNSWWeb, HierarchicalNSWT, CloseVectorHNSWLibArgs, CloseVectorCredentials, HnswlibModule, } from "closevector-web"; import type { EmbeddingsInterface } from "@langchain/core/embeddings"; import { Document } from "@langchain/core/documents"; import { CloseVector } from "./common.js"; /**...
langchainjs/libs/langchain-community/src/vectorstores/closevector/web.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/closevector/web.ts", "repo_id": "langchainjs", "token_count": 2111 }
1,022
package indexnode import ( "context" "github.com/milvus-io/milvus/internal/types" "github.com/milvus-io/milvus/pkg/util/paramtable" ) type mockIndexNodeComponent struct { *IndexNode } var _ types.IndexNodeComponent = &mockIndexNodeComponent{} func NewMockIndexNodeComponent(ctx context.Context) (types.IndexNode...
milvus/internal/indexnode/indexnode_component_mock.go/0
{ "file_path": "milvus/internal/indexnode/indexnode_component_mock.go", "repo_id": "milvus", "token_count": 312 }
1,820
--- sidebar_position: 3 --- # Chat Models ChatModels are a core component of LangChain. LangChain does not serve its own ChatModels, but rather provides a standard interface for interacting with many different models. To be specific, this interface is one that takes as input a list of messages and returns a message. ...
langchain/docs/docs/modules/model_io/chat/index.mdx/0
{ "file_path": "langchain/docs/docs/modules/model_io/chat/index.mdx", "repo_id": "langchain", "token_count": 312 }
205
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-epsilla/llama_index/vector_stores/epsilla/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-epsilla/llama_index/vector_stores/epsilla/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,482
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/models/beit/test_modeling_flax_beit.py/0
{ "file_path": "transformers/tests/models/beit/test_modeling_flax_beit.py", "repo_id": "transformers", "token_count": 4819 }
706
# Copyright 2021 The HuggingFace Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
datasets/metrics/cer/test_cer.py/0
{ "file_path": "datasets/metrics/cer/test_cer.py", "repo_id": "datasets", "token_count": 2407 }
117
// 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/proxy/lb_policy.go/0
{ "file_path": "milvus/internal/proxy/lb_policy.go", "repo_id": "milvus", "token_count": 2716 }
1,880
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/api/pipelines/overview.md/0
{ "file_path": "diffusers/docs/source/en/api/pipelines/overview.md", "repo_id": "diffusers", "token_count": 1892 }
184
import type { HierarchicalNSW as HierarchicalNSWT, SpaceName, } from "hnswlib-node"; import type { EmbeddingsInterface } from "@langchain/core/embeddings"; import { SaveableVectorStore } from "@langchain/core/vectorstores"; import { Document } from "@langchain/core/documents"; import { SynchronousInMemoryDocstore }...
langchainjs/libs/langchain-community/src/vectorstores/hnswlib.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/hnswlib.ts", "repo_id": "langchainjs", "token_count": 4336 }
1,082
<jupyter_start><jupyter_text>Building Retrieval from ScratchIn this tutorial, we show you how to build a standard retriever against a vector database, that will fetch nodes via top-k similarity.We use Pinecone as the vector database. We load in nodes using our high-level ingestion abstractions (to see how to build this...
llama_index/docs/examples/low_level/retrieval.ipynb/0
{ "file_path": "llama_index/docs/examples/low_level/retrieval.ipynb", "repo_id": "llama_index", "token_count": 2452 }
1,071
<jupyter_start><jupyter_text>Local Peristence DemoThis notebook demonstrates how to configure Chroma to persist to disk, then load it back in.<jupyter_code>import chromadb # Create a new Chroma client with persistence enabled. persist_directory = "db" client = chromadb.PersistentClient(path=persist_directory) # Crea...
chroma/examples/basic_functionality/local_persistence.ipynb/0
{ "file_path": "chroma/examples/basic_functionality/local_persistence.ipynb", "repo_id": "chroma", "token_count": 753 }
36
<!--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/main_classes/agent.md/0
{ "file_path": "transformers/docs/source/en/main_classes/agent.md", "repo_id": "transformers", "token_count": 812 }
436
package typeutil import ( "github.com/cockroachdb/errors" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/internal/proto/planpb" "github.com/milvus-io/milvus/pkg/util/typeutil" ) // HashKey2Partitions hash partition keys to partitions func HashKey2Partitions(fieldSchema *schem...
milvus/internal/util/typeutil/hash.go/0
{ "file_path": "milvus/internal/util/typeutil/hash.go", "repo_id": "milvus", "token_count": 583 }
1,887
// 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/Collection.cpp/0
{ "file_path": "milvus/internal/core/src/segcore/Collection.cpp", "repo_id": "milvus", "token_count": 792 }
1,933
from enum import Enum from typing import Union import torch class Format(str, Enum): NCHW = 'NCHW' NHWC = 'NHWC' NCL = 'NCL' NLC = 'NLC' FormatT = Union[str, Format] def get_spatial_dim(fmt: FormatT): fmt = Format(fmt) if fmt is Format.NLC: dim = (1,) elif fmt is Format.NCL: ...
pytorch-image-models/timm/layers/format.py/0
{ "file_path": "pytorch-image-models/timm/layers/format.py", "repo_id": "pytorch-image-models", "token_count": 572 }
375
python_tests()
llama_index/llama-index-packs/llama-index-packs-evaluator-benchmarker/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-evaluator-benchmarker/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,564
// 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/datacoord/cluster_test.go/0
{ "file_path": "milvus/internal/datacoord/cluster_test.go", "repo_id": "milvus", "token_count": 2641 }
1,910
// 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/Types.h/0
{ "file_path": "milvus/internal/core/src/common/Types.h", "repo_id": "milvus", "token_count": 6271 }
1,921
import asyncio import time from typing import Any, AsyncIterator, Iterator, List, Mapping, Optional from langchain_core.callbacks.manager import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_models import LLM, LanguageModelInput from langchain_core.runnables import R...
langchain/libs/core/tests/unit_tests/fake/llm.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/fake/llm.py", "repo_id": "langchain", "token_count": 1339 }
415
"""Different ways to combine documents.""" from langchain.chains.combine_documents.reduce import ( acollapse_docs, collapse_docs, split_list_of_docs, ) from langchain.chains.combine_documents.stuff import create_stuff_documents_chain __all__ = [ "acollapse_docs", "collapse_docs", "split_list_o...
langchain/libs/langchain/langchain/chains/combine_documents/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/combine_documents/__init__.py", "repo_id": "langchain", "token_count": 139 }
457
"""Tree Index inserter.""" from typing import Optional, Sequence from llama_index.legacy.data_structs.data_structs import IndexGraph from llama_index.legacy.indices.tree.utils import get_numbered_text_from_nodes from llama_index.legacy.indices.utils import ( extract_numbers_given_response, get_sorted_node_lis...
llama_index/llama-index-legacy/llama_index/legacy/indices/tree/inserter.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/tree/inserter.py", "repo_id": "llama_index", "token_count": 3672 }
1,578
python_sources()
llama_index/llama-index-integrations/retrievers/llama-index-retrievers-you/llama_index/retrievers/you/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/retrievers/llama-index-retrievers-you/llama_index/retrievers/you/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,457
"""SQL Join query engine.""" import logging from typing import Callable, Dict, Optional, Union from llama_index.core.base.base_query_engine import BaseQueryEngine from llama_index.core.base.response.schema import RESPONSE_TYPE, Response from llama_index.core.callbacks.base import CallbackManager from llama_index.core...
llama_index/llama-index-core/llama_index/core/query_engine/sql_join_query_engine.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/query_engine/sql_join_query_engine.py", "repo_id": "llama_index", "token_count": 5305 }
1,211
# gemini-functions-agent This template creates an agent that uses Google Gemini function calling to communicate its decisions on what actions to take. This example creates an agent that can optionally look up information on the internet using Tavily's search engine. [See an example LangSmith trace here](https://sm...
langchain/templates/gemini-functions-agent/README.md/0
{ "file_path": "langchain/templates/gemini-functions-agent/README.md", "repo_id": "langchain", "token_count": 716 }
649
# coding=utf-8 # Copyright 2024 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...
diffusers/src/diffusers/models/modeling_flax_pytorch_utils.py/0
{ "file_path": "diffusers/src/diffusers/models/modeling_flax_pytorch_utils.py", "repo_id": "diffusers", "token_count": 2324 }
235
# @langchain/weaviate This package contains the LangChain.js integrations for Weaviate with the `weaviate-ts-client` SDK. ## Installation ```bash npm2yarn npm install @langchain/weaviate ``` ## Vectorstore This package adds support for Weaviate vectorstore. To follow along with this example install the `@langchai...
langchainjs/libs/langchain-weaviate/README.md/0
{ "file_path": "langchainjs/libs/langchain-weaviate/README.md", "repo_id": "langchainjs", "token_count": 751 }
1,046
# Simple VQGAN CLIP Author: @ErwannMillon This is a very simple VQGAN-CLIP implementation that was built as a part of the <a href= "https://github.com/ErwannMillon/face-editor"> Face Editor project </a> . This simplified version allows you to generate or edit images using text with just three lines of code. For a mo...
transformers/examples/research_projects/vqgan-clip/README.md/0
{ "file_path": "transformers/examples/research_projects/vqgan-clip/README.md", "repo_id": "transformers", "token_count": 777 }
557
#include <torch/extension.h> #include <c10/cuda/CUDAGuard.h> #include <ATen/cuda/CUDAContext.h> #include <cuda_runtime.h> #include <cuda_fp16.h> #include <cstdint> #include <cstdio> #include "config.h" #include "cuda/q_matrix.cuh" #include "cuda/q_gemm.cuh" #include "cpp/util.h" // Some decluttering macros #define...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/ext.cpp/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/ext.cpp", "repo_id": "text-generation-inference", "token_count": 2184 }
410
from tokenizers import Tokenizer from ..utils import data_dir, doc_pipeline_bert_tokenizer, doc_wiki_tokenizer disable_printing = True original_print = print def print(*args, **kwargs): if not disable_printing: original_print(*args, **kwargs) class TestPipeline: def test_pipeline(self, doc_wiki_t...
tokenizers/bindings/python/tests/documentation/test_pipeline.py/0
{ "file_path": "tokenizers/bindings/python/tests/documentation/test_pipeline.py", "repo_id": "tokenizers", "token_count": 3351 }
464
[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 = ["HuggingFaceEmbedding", "HuggingFaceInferenceAPIEmbedding", "HuggingFaceInferenceAPIEmbedd...
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/pyproject.toml", "repo_id": "llama_index", "token_count": 729 }
1,232
""" Swin Transformer V2 A PyTorch impl of : `Swin Transformer V2: Scaling Up Capacity and Resolution` - https://arxiv.org/abs/2111.09883 Code/weights from https://github.com/microsoft/Swin-Transformer, original copyright/license info below Modifications and additions for timm hacked together by / Copyright 2022, ...
pytorch-image-models/timm/models/swin_transformer_v2.py/0
{ "file_path": "pytorch-image-models/timm/models/swin_transformer_v2.py", "repo_id": "pytorch-image-models", "token_count": 16762 }
407
from langchain_community.document_loaders.directory import ( DirectoryLoader, ) __all__ = ["DirectoryLoader"]
langchain/libs/langchain/langchain/document_loaders/directory.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/directory.py", "repo_id": "langchain", "token_count": 34 }
488
# LlamaHub Tools Guide We offer a rich set of Tool Specs that are offered through [LlamaHub](https://llamahub.ai/) 🦙. ![](/_static/data_connectors/llamahub.png) These tool specs represent an initial curated list of services that an agent can interact with and enrich its capability to perform different actions. We a...
llama_index/docs/module_guides/deploying/agents/tools/llamahub_tools_guide.md/0
{ "file_path": "llama_index/docs/module_guides/deploying/agents/tools/llamahub_tools_guide.md", "repo_id": "llama_index", "token_count": 865 }
1,090
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
accelerate/src/accelerate/test_utils/scripts/external_deps/test_metrics.py/0
{ "file_path": "accelerate/src/accelerate/test_utils/scripts/external_deps/test_metrics.py", "repo_id": "accelerate", "token_count": 4705 }
17
""" coding=utf-8 Copyright 2018, Antonio Mendoza Hao Tan, Mohit Bansal Adapted From Facebook Inc, Detectron2 && Huggingface Co. 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...
transformers/examples/research_projects/visual_bert/modeling_frcnn.py/0
{ "file_path": "transformers/examples/research_projects/visual_bert/modeling_frcnn.py", "repo_id": "transformers", "token_count": 34766 }
617
import importlib.util from typing import Any, Dict, List, Optional from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator class SpacyEmbeddings(BaseModel, Embeddings): """Embeddings by spaCy models. Attributes: model_name (str): Name ...
langchain/libs/community/langchain_community/embeddings/spacy_embeddings.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/spacy_embeddings.py", "repo_id": "langchain", "token_count": 1658 }
273
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-azure-openai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-azure-openai/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,426
# SearxNG Search API This page covers how to use the SearxNG search API within LangChain. It is broken into two parts: installation and setup, and then references to the specific SearxNG API wrapper. ## Installation and Setup While it is possible to utilize the wrapper in conjunction with [public searx instances](h...
langchain/docs/docs/integrations/providers/searx.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/searx.mdx", "repo_id": "langchain", "token_count": 1060 }
158
from langchain_community.llms.mosaicml import ( MosaicML, ) __all__ = [ "MosaicML", ]
langchain/libs/langchain/langchain/llms/mosaicml.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/mosaicml.py", "repo_id": "langchain", "token_count": 45 }
549
"""Base schema for data structures.""" import json import textwrap import uuid from abc import abstractmethod from dataclasses import dataclass from enum import Enum, auto from hashlib import sha256 from io import BytesIO from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union from dataclasses_json import D...
llama_index/llama-index-core/llama_index/core/schema.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/schema.py", "repo_id": "llama_index", "token_count": 9635 }
1,217
package dao import ( "github.com/chroma/chroma-coordinator/internal/metastore/db/dbmodel" "gorm.io/gorm" "gorm.io/gorm/clause" ) type segmentMetadataDb struct { db *gorm.DB } func (s *segmentMetadataDb) DeleteAll() error { return s.db.Where("1 = 1").Delete(&dbmodel.SegmentMetadata{}).Error } func (s *segmentMe...
chroma/go/coordinator/internal/metastore/db/dao/segment_metadata.go/0
{ "file_path": "chroma/go/coordinator/internal/metastore/db/dao/segment_metadata.go", "repo_id": "chroma", "token_count": 396 }
46
[tool.poetry] name = "research-assistant" version = "0.0.1" description = "Uses GPT Researcher as a research agent" authors = [] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" openai = "<2" beautifulsoup4 = "^4.12.2" duckduckgo-search = "^3.9.5" tavily-python = "^0.2.6" [to...
langchain/templates/research-assistant/pyproject.toml/0
{ "file_path": "langchain/templates/research-assistant/pyproject.toml", "repo_id": "langchain", "token_count": 308 }
696
# 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/dance_diffusion/test_dance_diffusion.py/0
{ "file_path": "diffusers/tests/pipelines/dance_diffusion/test_dance_diffusion.py", "repo_id": "diffusers", "token_count": 2422 }
261
from llama_index.core.storage.index_store.keyval_index_store import KVIndexStore from llama_index.storage.index_store.postgres import PostgresIndexStore def test_class(): names_of_base_classes = [b.__name__ for b in PostgresIndexStore.__mro__] assert KVIndexStore.__name__ in names_of_base_classes
llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-postgres/tests/test_storage_index_store_postgres.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-postgres/tests/test_storage_index_store_postgres.py", "repo_id": "llama_index", "token_count": 105 }
1,496
"""Util that calls SceneXplain. In order to set this up, you need API key for the SceneXplain API. You can obtain a key by following the steps below. - Sign up for a free account at https://scenex.jina.ai/. - Navigate to the API Access page (https://scenex.jina.ai/api) and create a new API key. """ from typing import ...
langchain/libs/community/langchain_community/utilities/scenexplain.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/scenexplain.py", "repo_id": "langchain", "token_count": 952 }
330
[tool.poetry] name = "sql-research-assistant" version = "0.0.1" description = "Uses GPT Researcher as a research agent over SQL" authors = [] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" openai = "^0.28.1" bs4 = "^0.0.1" duckduckgo-search = "^4.1.0" [tool.poetry.group.dev...
langchain/templates/sql-research-assistant/pyproject.toml/0
{ "file_path": "langchain/templates/sql-research-assistant/pyproject.toml", "repo_id": "langchain", "token_count": 314 }
683
# Handle parsing errors Occasionally the LLM cannot determine what step to take because it outputs format in incorrect form to be handled by the output parser. In this case, by default the agent errors. You can control this functionality by passing `handleParsingErrors` when initializing the agent executor. This field...
langchainjs/docs/core_docs/docs/modules/agents/how_to/handle_parsing_errors.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/agents/how_to/handle_parsing_errors.mdx", "repo_id": "langchainjs", "token_count": 391 }
801
from llama_index.core.output_parsers.base import ChainableOutputParser from llama_index.output_parsers.guardrails import GuardrailsOutputParser def test_class(): names_of_base_classes = [b.__name__ for b in GuardrailsOutputParser.__mro__] assert ChainableOutputParser.__name__ in names_of_base_classes
llama_index/llama-index-integrations/output_parsers/llama-index-output-parsers-guardrails/tests/test_output_parsers_guardrails.py/0
{ "file_path": "llama_index/llama-index-integrations/output_parsers/llama-index-output-parsers-guardrails/tests/test_output_parsers_guardrails.py", "repo_id": "llama_index", "token_count": 103 }
1,433
import logging from threading import Thread from typing import Any, List, Optional, Type from llama_index.core.base.base_query_engine import BaseQueryEngine from llama_index.core.base.llms.types import ChatMessage, MessageRole from llama_index.core.base.response.schema import RESPONSE_TYPE, StreamingResponse from llam...
llama_index/llama-index-core/llama_index/core/chat_engine/condense_question.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/chat_engine/condense_question.py", "repo_id": "llama_index", "token_count": 5775 }
1,139
server.name: opensearch-dashboards server.host: "0.0.0.0" opensearch.hosts: http://localhost:9200
langchain/libs/community/tests/integration_tests/vectorstores/docker-compose/opensearch/opensearch_dashboards.yml/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/docker-compose/opensearch/opensearch_dashboards.yml", "repo_id": "langchain", "token_count": 38 }
350
--- title: Custom template formats --- # Alternate prompt template formats The primary template format for LangChain prompts is the simple and versatile `f-string`. LangChain.js supports [`handlebars`](https://handlebarsjs.com/) as an experimental alternative. Note that templates created this way cannot be added to ...
langchainjs/docs/core_docs/docs/modules/experimental/prompts/custom_formats.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/experimental/prompts/custom_formats.mdx", "repo_id": "langchainjs", "token_count": 202 }
790
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-minio/llama_index/readers/minio/minio_client/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-minio/llama_index/readers/minio/minio_client/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,388
from llama_index.vector_stores.upstash.base import UpstashVectorStore __all__ = ["UpstashVectorStore"]
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-upstash/llama_index/vector_stores/upstash/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-upstash/llama_index/vector_stores/upstash/__init__.py", "repo_id": "llama_index", "token_count": 35 }
1,547
"""Relevant prompts for constructing indexes."""
langchain/libs/langchain/langchain/indexes/prompts/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/indexes/prompts/__init__.py", "repo_id": "langchain", "token_count": 10 }
556
<!--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/training/dreambooth.md/0
{ "file_path": "diffusers/docs/source/ko/training/dreambooth.md", "repo_id": "diffusers", "token_count": 11697 }
197