text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from langchain_core.runnables import __all__ EXPECTED_ALL = [ "chain", "AddableDict", "ConfigurableField", "ConfigurableFieldSingleOption", "ConfigurableFieldMultiOption", "ConfigurableFieldSpec", "ensure_config", "run_in_executor", "patch_config", "RouterInput", "RouterRunn...
langchain/libs/core/tests/unit_tests/runnables/test_imports.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/runnables/test_imports.py", "repo_id": "langchain", "token_count": 346 }
449
"""Loader that uses unstructured to load HTML files.""" import logging from typing import Any, List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader logger = logging.getLogger(__name__) class UnstructuredURLLoader(BaseLoader): """Load files from rem...
langchain/libs/community/langchain_community/document_loaders/url.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/url.py", "repo_id": "langchain", "token_count": 2772 }
264
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/utils/add_pipeline_model_mapping_to_test.py/0
{ "file_path": "transformers/utils/add_pipeline_model_mapping_to_test.py", "repo_id": "transformers", "token_count": 5411 }
809
from __future__ import annotations from typing import Any, Dict, List, Optional, cast from uuid import uuid4 from langchain_core.callbacks import CallbackManagerForRetrieverRun from langchain_core.documents import Document from langchain_core.pydantic_v1 import root_validator from langchain_core.retrievers import Bas...
langchain/libs/community/langchain_community/retrievers/weaviate_hybrid_search.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/weaviate_hybrid_search.py", "repo_id": "langchain", "token_count": 2678 }
280
def _format_docs(docs): result = "\n".join( [ f'<item index="{i+1}">\n<page_content>\n{r}\n</page_content>\n</item>' for i, r in enumerate(docs) ] ) return result def format_agent_scratchpad(intermediate_steps): thoughts = "" for action, observation in inter...
langchain/templates/anthropic-iterative-search/anthropic_iterative_search/agent_scratchpad.py/0
{ "file_path": "langchain/templates/anthropic-iterative-search/anthropic_iterative_search/agent_scratchpad.py", "repo_id": "langchain", "token_count": 200 }
700
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/examples/feature_extraction/peft_lora_embedding_semantic_search.py/0
{ "file_path": "peft/examples/feature_extraction/peft_lora_embedding_semantic_search.py", "repo_id": "peft", "token_count": 8602 }
299
"""Init params."""
llama_index/llama-index-legacy/llama_index/legacy/readers/file/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/file/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,760
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/util/importutil/json_handler_test.go/0
{ "file_path": "milvus/internal/util/importutil/json_handler_test.go", "repo_id": "milvus", "token_count": 7630 }
1,870
<jupyter_start><jupyter_text>Modèles (TensorFlow) Installez la bibliothèque 🤗 *Transformers* pour exécuter ce *notebook*.<jupyter_code>!pip install transformers[sentencepiece] from transformers import CamembertConfig, TFCamembertModel # Construire la configuration config = CamembertConfig() # Construire le modèle à ...
notebooks/course/fr/chapter2/section3_tf.ipynb/0
{ "file_path": "notebooks/course/fr/chapter2/section3_tf.ipynb", "repo_id": "notebooks", "token_count": 351 }
297
<jupyter_start>
langchain/docs/docs/integrations/document_loaders/microsoft_sharepoint.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/microsoft_sharepoint.ipynb", "repo_id": "langchain", "token_count": 8 }
118
import argparse import functools import json import os from operator import itemgetter from typing import Literal, Optional, Union import weaviate from langchain import load as langchain_load from langchain.chat_models import ChatAnthropic, ChatOpenAI from langchain.embeddings import OpenAIEmbeddings from langchain.pr...
chat-langchain/_scripts/evaluate_chains.py/0
{ "file_path": "chat-langchain/_scripts/evaluate_chains.py", "repo_id": "chat-langchain", "token_count": 2654 }
5
import pytest from llama_index.legacy.node_parser.relational.unstructured_element import ( UnstructuredElementNodeParser, ) from llama_index.legacy.schema import Document, IndexNode, TextNode try: from unstructured.partition.html import partition_html except ImportError: partition_html = None # type: igno...
llama_index/llama-index-legacy/tests/node_parser/test_unstructured.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/node_parser/test_unstructured.py", "repo_id": "llama_index", "token_count": 1511 }
1,673
package model import ( "testing" ) func TestCheckPartitionsEqual(t *testing.T) { type args struct { partitionsA []*Partition partitionsB []*Partition } tests := []struct { name string args args want bool }{ { // length not match. args: args{ partitionsA: []*Partition{{PartitionName: "_defau...
milvus/internal/metastore/model/partition_test.go/0
{ "file_path": "milvus/internal/metastore/model/partition_test.go", "repo_id": "milvus", "token_count": 444 }
1,999
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/storage/event_data.go/0
{ "file_path": "milvus/internal/storage/event_data.go", "repo_id": "milvus", "token_count": 4527 }
2,063
import { AgentTrajectoryEvaluator, LLMPairwiseStringEvaluator, LLMStringEvaluator, PairwiseStringEvaluator, StringEvaluator, } from "./base.js"; export interface EvaluatorType { /** * The criteria evaluator, which evaluates a model based on a * custom set of criteria without any reference labels. ...
langchainjs/langchain/src/evaluation/types.ts/0
{ "file_path": "langchainjs/langchain/src/evaluation/types.ts", "repo_id": "langchainjs", "token_count": 406 }
918
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use candle::{test_utils::to_vec2_round, DType, Device, Result, Tensor}; use candle_nn::RNN; /* The following test can be verified against PyTorch using the following snippet. import torch from torch import...
candle/candle-nn/tests/rnn.rs/0
{ "file_path": "candle/candle-nn/tests/rnn.rs", "repo_id": "candle", "token_count": 2010 }
59
- sections: - local: index title: 🤗 Transformers - local: quicktour title: Lawatan cepat - local: installation title: Pemasangan title: Mulakan - sections: - local: pipeline_tutorial title: Jalankan inferens dengan saluran paip - local: autoclass_tutorial title: Tuli...
transformers/docs/source/ms/_toctree.yml/0
{ "file_path": "transformers/docs/source/ms/_toctree.yml", "repo_id": "transformers", "token_count": 12527 }
545
# XML output parser The `XMLOutputParser` takes language model output which contains XML and parses it into a JSON object. The output parser also supports streaming outputs. Currently, the XML parser does not contain support for self closing tags, or attributes on tags. ## Usage import CodeBlock from "@theme/CodeB...
langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/types/xml.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/types/xml.mdx", "repo_id": "langchainjs", "token_count": 238 }
739
import { AmazonKnowledgeBaseRetriever } from "@langchain/community/retrievers/amazon_knowledge_base"; const retriever = new AmazonKnowledgeBaseRetriever({ topK: 10, knowledgeBaseId: "YOUR_KNOWLEDGE_BASE_ID", region: "us-east-2", clientOptions: { credentials: { accessKeyId: "YOUR_ACCESS_KEY_ID", ...
langchainjs/examples/src/retrievers/amazon_knowledge_bases.ts/0
{ "file_path": "langchainjs/examples/src/retrievers/amazon_knowledge_bases.ts", "repo_id": "langchainjs", "token_count": 175 }
846
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.stock_market_data_query_engine import ( StockMarketDataQueryEnginePack, ) def test_class(): names_of_base_classes = [b.__name__ for b in StockMarketDataQueryEnginePack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_class...
llama_index/llama-index-packs/llama-index-packs-stock-market-data-query-engine/tests/test_packs_stock_market_data_query_engine.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-stock-market-data-query-engine/tests/test_packs_stock_market_data_query_engine.py", "repo_id": "llama_index", "token_count": 114 }
1,686
import { writable } from "svelte/store"; export const ERROR_MESSAGES = { default: "Oops, something went wrong.", authOnly: "You have to be logged in.", rateLimited: "You are sending too many messages. Try again later.", }; export const error = writable<string | null>(null);
chat-ui/src/lib/stores/errors.ts/0
{ "file_path": "chat-ui/src/lib/stores/errors.ts", "repo_id": "chat-ui", "token_count": 85 }
101
# rag-gpt-crawler GPT-crawler will crawl websites to produce files for use in custom GPTs or other apps (RAG). This template uses [gpt-crawler](https://github.com/BuilderIO/gpt-crawler) to build a RAG app ## Environment Setup Set the `OPENAI_API_KEY` environment variable to access the OpenAI models. ## Crawling ...
langchain/templates/rag-gpt-crawler/README.md/0
{ "file_path": "langchain/templates/rag-gpt-crawler/README.md", "repo_id": "langchain", "token_count": 845 }
658
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/modeling_flax_pytorch_utils.py/0
{ "file_path": "transformers/src/transformers/modeling_flax_pytorch_utils.py", "repo_id": "transformers", "token_count": 9864 }
602
package balance import ( "math" "math/rand" "sort" "time" "github.com/samber/lo" "go.uber.org/zap" "github.com/milvus-io/milvus/internal/proto/datapb" "github.com/milvus-io/milvus/internal/querycoordv2/meta" "github.com/milvus-io/milvus/internal/querycoordv2/params" "github.com/milvus-io/milvus/internal/qu...
milvus/internal/querycoordv2/balance/multi_target_balance.go/0
{ "file_path": "milvus/internal/querycoordv2/balance/multi_target_balance.go", "repo_id": "milvus", "token_count": 7065 }
1,891
import { LlamaCpp } from "@langchain/community/llms/llama_cpp"; const llamaPath = "/Replace/with/path/to/your/model/gguf-llama2-q4_0.bin"; const question = "Where do Llamas come from?"; const model = new LlamaCpp({ modelPath: llamaPath }); console.log(`You: ${question}`); const response = await model.invoke(question...
langchainjs/examples/src/models/llm/llama_cpp.ts/0
{ "file_path": "langchainjs/examples/src/models/llm/llama_cpp.ts", "repo_id": "langchainjs", "token_count": 128 }
842
"""LLM predictor tests.""" from typing import Any from unittest.mock import patch from llama_index.legacy.llm_predictor.structured import ( LLMPredictor, StructuredLLMPredictor, ) from llama_index.legacy.prompts import BasePromptTemplate from llama_index.legacy.prompts.base import PromptTemplate from llama_in...
llama_index/llama-index-legacy/tests/llm_predictor/test_base.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/llm_predictor/test_base.py", "repo_id": "llama_index", "token_count": 548 }
1,639
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/fuyu/image_processing_fuyu.py/0
{ "file_path": "transformers/src/transformers/models/fuyu/image_processing_fuyu.py", "repo_id": "transformers", "token_count": 14899 }
692
label: 'Multimodal embedding models' position: 0
langchainjs/docs/core_docs/docs/modules/data_connection/experimental/multimodal_embeddings/_category_.yml/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/experimental/multimodal_embeddings/_category_.yml", "repo_id": "langchainjs", "token_count": 15 }
787
[ { "deploy_mode": "cluster", "server": "idc-sh002", "suite_params": [ { "suite": "2_insert_search_sift10m_2048.yaml", "image_type": "cpu" } ] }, { "server": "idc-sh005", "suite_params": [ { ...
milvus/tests/benchmark/milvus_benchmark/scheduler/2_data.json/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/scheduler/2_data.json", "repo_id": "milvus", "token_count": 516 }
1,867
from llama_index.packs.multi_document_agents.base import MultiDocumentAgentsPack __all__ = ["MultiDocumentAgentsPack"]
llama_index/llama-index-packs/llama-index-packs-multi-document-agents/llama_index/packs/multi_document_agents/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-multi-document-agents/llama_index/packs/multi_document_agents/__init__.py", "repo_id": "llama_index", "token_count": 35 }
1,665
from langchain_community.document_transformers.embeddings_redundant_filter import ( EmbeddingsClusteringFilter, EmbeddingsRedundantFilter, _DocumentWithState, _filter_similar_embeddings, _get_embeddings_from_stateful_docs, get_stateful_documents, ) __all__ = [ "EmbeddingsRedundantFilter", ...
langchain/libs/langchain/langchain/document_transformers/embeddings_redundant_filter.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_transformers/embeddings_redundant_filter.py", "repo_id": "langchain", "token_count": 189 }
494
import { SerializedConstitutionalPrinciple } from "../serde.js"; /** * Class representing a constitutional principle with critique request, * revision request, and name properties. * @example * ```typescript * const principle = new ConstitutionalPrinciple({ * name: "Ethical Principle", * critiqueRequest: "T...
langchainjs/langchain/src/chains/constitutional_ai/constitutional_principle.ts/0
{ "file_path": "langchainjs/langchain/src/chains/constitutional_ai/constitutional_principle.ts", "repo_id": "langchainjs", "token_count": 6608 }
890
<!--Copyright 2021 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/gpt_neo.md/0
{ "file_path": "transformers/docs/source/en/model_doc/gpt_neo.md", "repo_id": "transformers", "token_count": 1582 }
506
import { VectorStore } from "@langchain/core/vectorstores"; import { v5 as uuidv5 } from "uuid"; import { RecordManagerInterface, UUIDV5_NAMESPACE, } from "@langchain/community/indexes/base"; import { insecureHash } from "@langchain/core/utils/hash"; import { DocumentInterface } from "@langchain/core/documents"; im...
langchainjs/langchain/src/indexes/indexing.ts/0
{ "file_path": "langchainjs/langchain/src/indexes/indexing.ts", "repo_id": "langchainjs", "token_count": 3858 }
913
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/storage/event_writer_test.go/0
{ "file_path": "milvus/internal/storage/event_writer_test.go", "repo_id": "milvus", "token_count": 1214 }
1,861
import enum import warnings from ..utils import add_end_docstrings, is_tf_available, is_torch_available from .base import Pipeline, build_pipeline_init_args if is_torch_available(): from ..models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES if is_tf_available(): import tensorflow as tf f...
transformers/src/transformers/pipelines/text_generation.py/0
{ "file_path": "transformers/src/transformers/pipelines/text_generation.py", "repo_id": "transformers", "token_count": 6925 }
708
import types import warnings from typing import List, Optional, Tuple, Union import numpy as np from ..models.bert.tokenization_bert import BasicTokenizer from ..utils import ( ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available, ) from .base import ArgumentHandler, ChunkPipeline, Da...
transformers/src/transformers/pipelines/token_classification.py/0
{ "file_path": "transformers/src/transformers/pipelines/token_classification.py", "repo_id": "transformers", "token_count": 11839 }
687
import { ChatLlamaCpp } from "@langchain/community/chat_models/llama_cpp"; import { SystemMessage, HumanMessage } from "@langchain/core/messages"; const llamaPath = "/Replace/with/path/to/your/model/gguf-llama2-q4_0.bin"; const model = new ChatLlamaCpp({ modelPath: llamaPath }); const response = await model.call([ ...
langchainjs/examples/src/models/chat/integration_llama_cpp_system.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/integration_llama_cpp_system.ts", "repo_id": "langchainjs", "token_count": 323 }
896
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-chroma/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-chroma/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,550
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 4321, "logprob": -8.6875, "text": "Test" }, { "id": 2009,...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama.json", "repo_id": "text-generation-inference", "token_count": 1050 }
362
kind: NetworkChaos apiVersion: chaos-mesh.org/v1alpha1 metadata: name: test-etcd-network-latency namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: app.kubernetes.io/instance: milvus-chaos app.kubernetes.io/name: etcd mode: all action: delay delay:...
milvus/tests/python_client/chaos/chaos_objects/network_latency/chaos_etcd_network_latency.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/network_latency/chaos_etcd_network_latency.yaml", "repo_id": "milvus", "token_count": 235 }
1,895
"""Module contains logic for indexing documents into vector stores.""" from __future__ import annotations import hashlib import json import uuid from itertools import islice from typing import ( Any, AsyncIterable, AsyncIterator, Callable, Dict, Iterable, Iterator, List, Literal, ...
langchain/libs/langchain/langchain/indexes/_api.py/0
{ "file_path": "langchain/libs/langchain/langchain/indexes/_api.py", "repo_id": "langchain", "token_count": 9441 }
510
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,264
import csv from typing import List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader class CoNLLULoader(BaseLoader): """Load `CoNLL-U` files.""" def __init__(self, file_path: str): """Initialize with a file path.""" self.file_path...
langchain/libs/community/langchain_community/document_loaders/conllu.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/conllu.py", "repo_id": "langchain", "token_count": 453 }
233
# List parser This output parser can be used when you want to return a list of comma-separated items. import CodeBlock from "@theme/CodeBlock"; import Comma from "@examples/prompts/comma_list_parser_sequence.ts"; import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <IntegrationIn...
langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/types/csv.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/types/csv.mdx", "repo_id": "langchainjs", "token_count": 144 }
763
""" coding=utf-8 Copyright 2018, Antonio Mendoza Hao Tan, Mohit Bansal Adapted From Facebook Inc, Detectron2 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/license...
transformers/examples/research_projects/visual_bert/visualizing_image.py/0
{ "file_path": "transformers/examples/research_projects/visual_bert/visualizing_image.py", "repo_id": "transformers", "token_count": 8182 }
579
import { DataSource } from "typeorm"; import { OpenAI } from "@langchain/openai"; import { SqlDatabase } from "langchain/sql_db"; import { SqlDatabaseChain } from "langchain/chains/sql_db"; /** * This example uses Chinook database, which is a sample database available for SQL Server, Oracle, MySQL, etc. * To set it ...
langchainjs/examples/src/chains/sql_db_legacy.ts/0
{ "file_path": "langchainjs/examples/src/chains/sql_db_legacy.ts", "repo_id": "langchainjs", "token_count": 250 }
764
declare interface ParseOptions { filename?: string; startRule?: "Start"; tracer?: any; [key: string]: any; } declare type ParseFunction = <Options extends ParseOptions>( input: string, options?: Options ) => Options extends { startRule: infer StartRule } ? StartRule extends "Start" ? Start : Start...
langchainjs/libs/langchain-community/src/types/expression-parser.d.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/types/expression-parser.d.ts", "repo_id": "langchainjs", "token_count": 839 }
1,044
python_sources() python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/main_content_extractor/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/main_content_extractor/BUILD", "repo_id": "llama_index", "token_count": 24 }
1,390
// 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/indexnode/indexnode_service.go/0
{ "file_path": "milvus/internal/indexnode/indexnode_service.go", "repo_id": "milvus", "token_count": 4629 }
1,793
python_tests()
llama_index/llama-index-integrations/tools/llama-index-tools-tavily-research/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-tavily-research/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,457
"""CouchDB client.""" import json import logging from typing import Dict, List, Optional import couchdb3 from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class SimpleCouchDBReader(BaseReader): """Simple CouchDB reader. Concatenates each CouchDB doc into Docu...
llama_index/llama-index-integrations/readers/llama-index-readers-couchdb/llama_index/readers/couchdb/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-couchdb/llama_index/readers/couchdb/base.py", "repo_id": "llama_index", "token_count": 1238 }
1,279
import { ChatOpenAI } from "@langchain/openai"; import { ChatAnthropic } from "@langchain/anthropic"; // Use a fake model name that will always throw an error const fakeOpenAIModel = new ChatOpenAI({ modelName: "potato!", maxRetries: 0, }); const anthropicModel = new ChatAnthropic({}); const modelWithFallback = ...
langchainjs/examples/src/guides/fallbacks/model.ts/0
{ "file_path": "langchainjs/examples/src/guides/fallbacks/model.ts", "repo_id": "langchainjs", "token_count": 194 }
780
CREATE VIRTUAL TABLE embedding_fulltext_search USING fts5(string_value, tokenize='trigram'); INSERT INTO embedding_fulltext_search (rowid, string_value) SELECT rowid, string_value FROM embedding_metadata; DROP TABLE embedding_fulltext;
chroma/chromadb/migrations/metadb/00003-full-text-tokenize.sqlite.sql/0
{ "file_path": "chroma/chromadb/migrations/metadb/00003-full-text-tokenize.sqlite.sql", "repo_id": "chroma", "token_count": 73 }
17
"""Init file."""
llama_index/llama-index-core/tests/embeddings/__init__.py/0
{ "file_path": "llama_index/llama-index-core/tests/embeddings/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,185
<jupyter_start><jupyter_text>Using toolsYou can use any Tools with Runnables easily.<jupyter_code>%pip install --upgrade --quiet langchain langchain-openai duckduckgo-search from langchain.tools import DuckDuckGoSearchRun from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import Chat...
langchain/docs/docs/expression_language/cookbook/tools.ipynb/0
{ "file_path": "langchain/docs/docs/expression_language/cookbook/tools.ipynb", "repo_id": "langchain", "token_count": 216 }
84
from langchain.retrievers.document_compressors.base import DocumentCompressorPipeline from langchain.retrievers.document_compressors.chain_extract import ( LLMChainExtractor, ) from langchain.retrievers.document_compressors.chain_filter import ( LLMChainFilter, ) from langchain.retrievers.document_compressors.c...
langchain/libs/langchain/langchain/retrievers/document_compressors/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/document_compressors/__init__.py", "repo_id": "langchain", "token_count": 246 }
533
// 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/mq/msgstream/msgstream_util.go/0
{ "file_path": "milvus/pkg/mq/msgstream/msgstream_util.go", "repo_id": "milvus", "token_count": 738 }
2,099
"""Test object index.""" from llama_index.legacy.indices.list.base import SummaryIndex from llama_index.legacy.objects.base import ObjectIndex from llama_index.legacy.objects.base_node_mapping import SimpleObjectNodeMapping from llama_index.legacy.objects.tool_node_mapping import SimpleToolNodeMapping from llama_index...
llama_index/llama-index-legacy/tests/objects/test_base.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/objects/test_base.py", "repo_id": "llama_index", "token_count": 981 }
1,628
import * as url from "node:url"; import * as path from "node:path"; import * as fs from "node:fs/promises"; import { test, expect } from "@jest/globals"; import { Document } from "@langchain/core/documents"; import { JSONLoader } from "../fs/json.js"; test("Test JSON loader from blob", async () => { const filePath =...
langchainjs/langchain/src/document_loaders/tests/json-blob.test.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/json-blob.test.ts", "repo_id": "langchainjs", "token_count": 1146 }
908
python_sources()
llama_index/llama-index-core/llama_index/core/indices/list/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/list/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,179
#![allow(unused)] use anyhow::{Context, Result}; use std::io::Write; use std::path::PathBuf; struct KernelDirectories { kernel_glob: &'static str, rust_target: &'static str, include_dirs: &'static [&'static str], } const KERNEL_DIRS: [KernelDirectories; 1] = [KernelDirectories { kernel_glob: "examples...
candle/candle-examples/build.rs/0
{ "file_path": "candle/candle-examples/build.rs", "repo_id": "candle", "token_count": 391 }
42
[package] name = "text-generation-router" description = "Text Generation Webserver" build = "build.rs" version.workspace = true edition.workspace = true authors.workspace = true homepage.workspace = true [lib] path = "src/lib.rs" [[bin]] name = "text-generation-router" path = "src/main.rs" [dependencies] async-strea...
text-generation-inference/router/Cargo.toml/0
{ "file_path": "text-generation-inference/router/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 739 }
415
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.tables import ChainOfTablePack, MixSelfConsistencyPack def test_class(): names_of_base_classes = [b.__name__ for b in ChainOfTablePack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes names_of_base_classes = [b.__...
llama_index/llama-index-packs/llama-index-packs-tables/tests/test_packs_tables.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-tables/tests/test_packs_tables.py", "repo_id": "llama_index", "token_count": 157 }
1,690
"""Embeddings.""" from llama_index.core.callbacks.schema import CBEventType from llama_index.core.callbacks.token_counting import TokenCountingHandler TEST_PAYLOAD = {"chunks": ["one"], "formatted_prompt": "two", "response": "three"} TEST_ID = "my id" def test_on_event_start() -> None: """Test event start.""" ...
llama_index/llama-index-core/tests/callbacks/test_token_counter.py/0
{ "file_path": "llama_index/llama-index-core/tests/callbacks/test_token_counter.py", "repo_id": "llama_index", "token_count": 605 }
1,215
# cassandra-entomology-rag This template will perform RAG using Apache Cassandra® or Astra DB through CQL (`Cassandra` vector store class) ## Environment Setup For the setup, you will require: - an [Astra](https://astra.datastax.com) Vector Database. You must have a [Database Administrator token](https://awesome-as...
langchain/templates/cassandra-entomology-rag/README.md/0
{ "file_path": "langchain/templates/cassandra-entomology-rag/README.md", "repo_id": "langchain", "token_count": 887 }
702
<jupyter_start><jupyter_text>JSON EvaluatorsEvaluating [extraction](https://python.langchain.com/docs/use_cases/extraction) and function calling applications often comes down to validation that the LLM's string output can be parsed correctly and how it compares to a reference object. The following `JSON` validators pro...
langchain/docs/docs/guides/evaluation/string/json.ipynb/0
{ "file_path": "langchain/docs/docs/guides/evaluation/string/json.ipynb", "repo_id": "langchain", "token_count": 1483 }
94
from sql_research_assistant.chain import chain __all__ = ["chain"]
langchain/templates/sql-research-assistant/sql_research_assistant/__init__.py/0
{ "file_path": "langchain/templates/sql-research-assistant/sql_research_assistant/__init__.py", "repo_id": "langchain", "token_count": 21 }
686
from langchain.schema.vectorstore import __all__ EXPECTED_ALL = ["VectorStore", "VectorStoreRetriever", "VST"] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
langchain/libs/langchain/tests/unit_tests/schema/test_vectorstore.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/schema/test_vectorstore.py", "repo_id": "langchain", "token_count": 70 }
653
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "vectorstores/qdrant", }); export * from "@langchain/community/vectorstores/qdrant";
langchainjs/langchain/src/vectorstores/qdrant.ts/0
{ "file_path": "langchainjs/langchain/src/vectorstores/qdrant.ts", "repo_id": "langchainjs", "token_count": 74 }
983
<jupyter_start><jupyter_text>Multi-Modal Retrieval using GPT text embedding and CLIP image embedding for Wikipedia ArticlesIn this notebook, we show how to build a Multi-Modal retrieval system using LlamaIndex.Wikipedia Text embedding index: Generate GPT text embeddings from OpenAI for textsWikipedia Images embedding i...
llama_index/docs/examples/multi_modal/multi_modal_retrieval.ipynb/0
{ "file_path": "llama_index/docs/examples/multi_modal/multi_modal_retrieval.ipynb", "repo_id": "llama_index", "token_count": 3541 }
1,074
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-ollama-query-engine/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-ollama-query-engine/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,582
from llama_index.readers.snowflake.base import SnowflakeReader __all__ = ["SnowflakeReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-snowflake/llama_index/readers/snowflake/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-snowflake/llama_index/readers/snowflake/__init__.py", "repo_id": "llama_index", "token_count": 30 }
1,383
<!--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/loaders/single_file.md/0
{ "file_path": "diffusers/docs/source/en/api/loaders/single_file.md", "repo_id": "diffusers", "token_count": 479 }
176
// 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/accesslog/global.go/0
{ "file_path": "milvus/internal/proxy/accesslog/global.go", "repo_id": "milvus", "token_count": 1108 }
1,875
<script lang="ts"> export let classNames = ""; </script> <svg width="1em" height="1em" viewBox="0 0 15 6" class={classNames} fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M1.67236 1L7.67236 7L13.6724 1" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" ...
chat-ui/src/lib/components/icons/IconChevron.svelte/0
{ "file_path": "chat-ui/src/lib/components/icons/IconChevron.svelte", "repo_id": "chat-ui", "token_count": 156 }
94
import logging from dataclasses import dataclass from typing import Any, List, Optional, cast import llama_index.legacy from llama_index.legacy.bridge.pydantic import BaseModel from llama_index.legacy.callbacks.base import CallbackManager from llama_index.legacy.core.embeddings.base import BaseEmbedding from llama_ind...
llama_index/llama-index-legacy/llama_index/legacy/service_context.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/service_context.py", "repo_id": "llama_index", "token_count": 6690 }
1,601
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-gpt-repo/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-gpt-repo/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,327
// 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/querynodev2/metrics_info.go/0
{ "file_path": "milvus/internal/querynodev2/metrics_info.go", "repo_id": "milvus", "token_count": 2650 }
2,043
from llama_index.readers.hive.base import HiveReader __all__ = ["HiveReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-hive/llama_index/readers/hive/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-hive/llama_index/readers/hive/__init__.py", "repo_id": "llama_index", "token_count": 28 }
1,334
# SingleStoreDB >[SingleStoreDB](https://singlestore.com/) is a high-performance distributed SQL database that supports deployment both in the [cloud](https://www.singlestore.com/cloud/) and on-premises. It provides vector storage, and vector functions including [dot_product](https://docs.singlestore.com/managed-servi...
langchain/docs/docs/integrations/providers/singlestoredb.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/singlestoredb.mdx", "repo_id": "langchain", "token_count": 318 }
149
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.a...
transformers/src/transformers/benchmark/benchmark_tf.py/0
{ "file_path": "transformers/src/transformers/benchmark/benchmark_tf.py", "repo_id": "transformers", "token_count": 6063 }
556
// 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/meta_test.go/0
{ "file_path": "milvus/internal/datacoord/meta_test.go", "repo_id": "milvus", "token_count": 14175 }
1,963
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/vitmatte/image_processing_vitmatte.py/0
{ "file_path": "transformers/src/transformers/models/vitmatte/image_processing_vitmatte.py", "repo_id": "transformers", "token_count": 5615 }
712
# AI21 Labs This page covers how to use the AI21 ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific AI21 wrappers. ## Installation and Setup - Get an AI21 api key and set it as an environment variable (`AI21_API_KEY`) ## Wrappers ### LLM There exists an...
langchain/docs/docs/integrations/providers/ai21.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/ai21.mdx", "repo_id": "langchain", "token_count": 120 }
127
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/maskformer/test_modeling_maskformer.py/0
{ "file_path": "transformers/tests/models/maskformer/test_modeling_maskformer.py", "repo_id": "transformers", "token_count": 10413 }
721
// 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/mq/msgstream/mq_factory_test.go/0
{ "file_path": "milvus/pkg/mq/msgstream/mq_factory_test.go", "repo_id": "milvus", "token_count": 1552 }
1,897
import uuid from typing import Optional import pytest from langchain_core.documents import Document from langchain_community.vectorstores import Qdrant from tests.integration_tests.vectorstores.fake_embeddings import ( ConsistentFakeEmbeddings, ) from tests.integration_tests.vectorstores.qdrant.common import asse...
langchain/libs/community/tests/integration_tests/vectorstores/qdrant/test_add_texts.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/qdrant/test_add_texts.py", "repo_id": "langchain", "token_count": 1894 }
354
from langchain_community.document_loaders.s3_directory import S3DirectoryLoader __all__ = ["S3DirectoryLoader"]
langchain/libs/langchain/langchain/document_loaders/s3_directory.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/s3_directory.py", "repo_id": "langchain", "token_count": 33 }
515
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 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...
diffusers/examples/text_to_image/train_text_to_image_lora_sdxl.py/0
{ "file_path": "diffusers/examples/text_to_image/train_text_to_image_lora_sdxl.py", "repo_id": "diffusers", "token_count": 24509 }
222
// Default generic "any" values are for backwards compatibility. // Replace with "string" when we are comfortable with a breaking change. import { BaseStringPromptTemplate } from "./string.js"; import type { BasePromptTemplateInput, TypedPromptInputValues, } from "./base.js"; import { checkValidTemplate, parse...
langchainjs/langchain-core/src/prompts/prompt.ts/0
{ "file_path": "langchainjs/langchain-core/src/prompts/prompt.ts", "repo_id": "langchainjs", "token_count": 2688 }
929
# RexNet **Rank Expansion Networks** (ReXNets) follow a set of new design principles for designing bottlenecks in image classification models. Authors refine each layer by 1) expanding the input channel size of the convolution layer and 2) replacing the [ReLU6s](https://www.paperswithcode.com/method/relu6). ## How do...
pytorch-image-models/docs/models/rexnet.md/0
{ "file_path": "pytorch-image-models/docs/models/rexnet.md", "repo_id": "pytorch-image-models", "token_count": 3081 }
353
# Metric Card for Mean IoU ## Metric Description IoU (Intersection over Union) is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the ground truth. For binary (two classes) or multi-class segmentation, the *mean IoU* o...
datasets/metrics/mean_iou/README.md/0
{ "file_path": "datasets/metrics/mean_iou/README.md", "repo_id": "datasets", "token_count": 1803 }
127
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/es/perplexity.md/0
{ "file_path": "transformers/docs/source/es/perplexity.md", "repo_id": "transformers", "token_count": 3114 }
479
<jupyter_start><jupyter_text>Image super-resolution using Latent Diffusion This colab notebook shows how to use the Latent Diffusion image super-resolution model using 🧨 [diffusers](https://github.com/huggingface/diffusers) libray.The model was originally released in [Latent Diffusion repo](https://github.com/CompVis/...
notebooks/diffusers/latent_diffusion_upscaler.ipynb/0
{ "file_path": "notebooks/diffusers/latent_diffusion_upscaler.ipynb", "repo_id": "notebooks", "token_count": 656 }
300
package typeutil import ( "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/internal/proto/internalpb" "github.com/milv...
milvus/internal/util/typeutil/result_helper_test.go/0
{ "file_path": "milvus/internal/util/typeutil/result_helper_test.go", "repo_id": "milvus", "token_count": 3487 }
1,811
import { Fragment } from "react"; import { Dialog, Transition } from "@headlessui/react"; import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/outline"; export function Layout(props: { sidebarOpen: boolean; setSidebarOpen: (open: boolean) => void; sidebar: React.ReactNode; children: React.ReactNode; sub...
opengpts/frontend/src/components/Layout.tsx/0
{ "file_path": "opengpts/frontend/src/components/Layout.tsx", "repo_id": "opengpts", "token_count": 2528 }
1,990
from typing import Any, AsyncIterator, Dict, Iterator, List, Optional, cast from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_models.chat_models import ( BaseChatModel, agenerate_from_stream, generate_from_stream, ) from l...
langchain/libs/community/langchain_community/chat_models/anthropic.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/anthropic.py", "repo_id": "langchain", "token_count": 3391 }
242
import { BufferMemory } from "langchain/memory"; import { FirestoreChatMessageHistory } from "@langchain/community/stores/message/firestore"; import { ChatOpenAI } from "@langchain/openai"; import { ConversationChain } from "langchain/chains"; import admin from "firebase-admin"; const memory = new BufferMemory({ cha...
langchainjs/examples/src/memory/firestore_nested.ts/0
{ "file_path": "langchainjs/examples/src/memory/firestore_nested.ts", "repo_id": "langchainjs", "token_count": 447 }
859
<!--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/tasks/semantic_segmentation.md/0
{ "file_path": "transformers/docs/source/en/tasks/semantic_segmentation.md", "repo_id": "transformers", "token_count": 10076 }
529