text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
search_performance: collections: # - # milvus: # db_config.primary_path: /test/milvus/db_data_011/sift_1b_128_l2_sq8h # cache_config.cpu_cache_capacity: 150GB # engine_config.use_blas_threshold: 0 # engine_config.gpu...
milvus/tests/benchmark/milvus_benchmark/suites/011_gpu_search_debug.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/011_gpu_search_debug.yaml", "repo_id": "milvus", "token_count": 1767 }
2,145
"""Init file of Playground.""" # playground from llama_index.core.playground.base import ( DEFAULT_INDEX_CLASSES, DEFAULT_MODES, Playground, ) __all__ = ["Playground", "DEFAULT_INDEX_CLASSES", "DEFAULT_MODES"]
llama_index/llama-index-core/llama_index/core/playground/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/playground/__init__.py", "repo_id": "llama_index", "token_count": 87 }
1,282
# 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/pipelines/auto_pipeline.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/auto_pipeline.py", "repo_id": "diffusers", "token_count": 20558 }
235
# Unstructured.io URL Loader This loader extracts the text from URLs using [Unstructured.io](https://github.com/Unstructured-IO/unstructured). The partition_html function partitions an HTML document and returns a list of document Element objects. ## Usage ```python from llama_index import download_loader Unstructur...
llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/unstructured_web/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/unstructured_web/README.md", "repo_id": "llama_index", "token_count": 329 }
1,571
from typing import AsyncIterator, Iterator, List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader class MergedDataLoader(BaseLoader): """Merge documents from a list of loaders""" def __init__(self, loaders: List): """Initialize with a li...
langchain/libs/community/langchain_community/document_loaders/merge.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/merge.py", "repo_id": "langchain", "token_count": 444 }
259
use super::Cpu; use core::arch::wasm32::*; pub struct CurrentCpu {} const STEP: usize = 16; const EPR: usize = 4; const ARR: usize = STEP / EPR; impl Cpu<ARR> for CurrentCpu { type Unit = v128; type Array = [v128; ARR]; const STEP: usize = STEP; const EPR: usize = EPR; fn n() -> usize { ...
candle/candle-core/src/cpu/simd128.rs/0
{ "file_path": "candle/candle-core/src/cpu/simd128.rs", "repo_id": "candle", "token_count": 839 }
27
<jupyter_start><jupyter_text>PGVector>[PGVector](https://github.com/pgvector/pgvector) is a vector similarity search for Postgres.In the notebook, we'll demo the `SelfQueryRetriever` wrapped around a `PGVector` vector store. Creating a PGVector vector storeFirst we'll want to create a PGVector vector store and seed it...
langchain/docs/docs/integrations/retrievers/self_query/pgvector_self_query.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/self_query/pgvector_self_query.ipynb", "repo_id": "langchain", "token_count": 1636 }
158
"""Toolkit for interacting with a Power BI dataset.""" from __future__ import annotations from typing import TYPE_CHECKING, List, Optional, Union from langchain_core.callbacks import BaseCallbackManager from langchain_core.language_models import BaseLanguageModel from langchain_core.language_models.chat_models import...
langchain/libs/community/langchain_community/agent_toolkits/powerbi/toolkit.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/powerbi/toolkit.py", "repo_id": "langchain", "token_count": 1571 }
226
# Advanced Retrieval Strategies ## Main Advanced Retrieval Strategies There are a variety of more advanced retrieval strategies you may wish to try, each with different benefits: - {ref}`Reranking <cohere_rerank>` - [Recursive retrieval](/examples/query_engine/pdf_tables/recursive_retriever.ipynb) - [Embedded tables...
llama_index/docs/optimizing/advanced_retrieval/advanced_retrieval.md/0
{ "file_path": "llama_index/docs/optimizing/advanced_retrieval/advanced_retrieval.md", "repo_id": "llama_index", "token_count": 544 }
1,233
<!--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/zh/hpo_train.md/0
{ "file_path": "transformers/docs/source/zh/hpo_train.md", "repo_id": "transformers", "token_count": 2832 }
533
# Documents / Nodes ## Concept Document and Node objects are core abstractions within LlamaIndex. A **Document** is a generic container around any data source - for instance, a PDF, an API output, or retrieved data from a database. They can be constructed manually, or created automatically via our data loaders. By d...
llama_index/docs/module_guides/loading/documents_and_nodes/root.md/0
{ "file_path": "llama_index/docs/module_guides/loading/documents_and_nodes/root.md", "repo_id": "llama_index", "token_count": 553 }
1,142
# 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/dpt/image_processing_dpt.py/0
{ "file_path": "transformers/src/transformers/models/dpt/image_processing_dpt.py", "repo_id": "transformers", "token_count": 9556 }
664
import os import warnings from typing import Any, Dict, List, Optional, cast from langchain_core.agents import AgentAction, AgentFinish from langchain_core.callbacks import BaseCallbackHandler from langchain_core.outputs import LLMResult from packaging.version import parse class ArgillaCallbackHandler(BaseCallbackHa...
langchain/libs/community/langchain_community/callbacks/argilla_callback.py/0
{ "file_path": "langchain/libs/community/langchain_community/callbacks/argilla_callback.py", "repo_id": "langchain", "token_count": 7037 }
216
/****************************************************************************** * Copyright (c) 2023, Tri Dao. ******************************************************************************/ #pragma once #include "static_switch.h" #include "flash.h" #include "flash_fwd_kernel.h" template<typename Kernel_traits, bo...
candle/candle-flash-attn/kernels/flash_fwd_launch_template.h/0
{ "file_path": "candle/candle-flash-attn/kernels/flash_fwd_launch_template.h", "repo_id": "candle", "token_count": 7583 }
50
// 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/FieldDataInterface.h/0
{ "file_path": "milvus/internal/core/src/common/FieldDataInterface.h", "repo_id": "milvus", "token_count": 3815 }
1,863
# coding=utf-8 # Copyright 2022 Meta 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.0 # #...
transformers/src/transformers/models/esm/modeling_tf_esm.py/0
{ "file_path": "transformers/src/transformers/models/esm/modeling_tf_esm.py", "repo_id": "transformers", "token_count": 30031 }
631
""" Bilinear-Attention-Transform and Non-Local Attention Paper: `Non-Local Neural Networks With Grouped Bilinear Attentional Transforms` - https://openaccess.thecvf.com/content_CVPR_2020/html/Chi_Non-Local_Neural_Networks_With_Grouped_Bilinear_Attentional_Transforms_CVPR_2020_paper.html Adapted from original code:...
pytorch-image-models/timm/layers/non_local_attn.py/0
{ "file_path": "pytorch-image-models/timm/layers/non_local_attn.py", "repo_id": "pytorch-image-models", "token_count": 3028 }
390
//! Support for the GGUF file format. //! //! Spec: https://github.com/philpax/ggml/blob/gguf-spec/docs/gguf.md use super::{GgmlDType, QTensor}; use crate::{Device, Result}; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use std::collections::HashMap; pub const DEFAULT_ALIGNMENT: u64 = 32; #[derive(Debu...
candle/candle-core/src/quantized/gguf_file.rs/0
{ "file_path": "candle/candle-core/src/quantized/gguf_file.rs", "repo_id": "candle", "token_count": 9397 }
36
""" DropBlock, DropPath PyTorch implementations of DropBlock and DropPath (Stochastic Depth) regularization layers. Papers: DropBlock: A regularization method for convolutional networks (https://arxiv.org/abs/1810.12890) Deep Networks with Stochastic Depth (https://arxiv.org/abs/1603.09382) Code: DropBlock impl ins...
pytorch-image-models/timm/layers/drop.py/0
{ "file_path": "pytorch-image-models/timm/layers/drop.py", "repo_id": "pytorch-image-models", "token_count": 3016 }
353
"""Schemas for tracers.""" from __future__ import annotations import datetime import warnings from typing import Any, Dict, List, Optional, Type from uuid import UUID from langsmith.schemas import RunBase as BaseRunV2 from langsmith.schemas import RunTypeEnum as RunTypeEnumDep from langchain_core._api import depreca...
langchain/libs/core/langchain_core/tracers/schemas.py/0
{ "file_path": "langchain/libs/core/langchain_core/tracers/schemas.py", "repo_id": "langchain", "token_count": 1688 }
439
import { AudioSubtitleLoader } from "langchain/document_loaders/web/assemblyai"; // You can also use a local file path and the loader will upload it to AssemblyAI for you. const audioUrl = "https://storage.googleapis.com/aai-docs-samples/espn.m4a"; const loader = new AudioSubtitleLoader( { audio: audioUrl, ...
langchainjs/examples/src/document_loaders/assemblyai_subtitles.ts/0
{ "file_path": "langchainjs/examples/src/document_loaders/assemblyai_subtitles.ts", "repo_id": "langchainjs", "token_count": 217 }
852
use crate::{Result, Tensor, WithDType}; pub enum TensorScalar { Tensor(Tensor), Scalar(Tensor), } pub trait TensorOrScalar { fn to_tensor_scalar(self) -> Result<TensorScalar>; } impl TensorOrScalar for &Tensor { fn to_tensor_scalar(self) -> Result<TensorScalar> { Ok(TensorScalar::Tensor(self....
candle/candle-core/src/scalar.rs/0
{ "file_path": "candle/candle-core/src/scalar.rs", "repo_id": "candle", "token_count": 261 }
37
# coding=utf-8 # Copyright 2023 NllbMoe Authors and 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 requir...
transformers/src/transformers/models/nllb_moe/modeling_nllb_moe.py/0
{ "file_path": "transformers/src/transformers/models/nllb_moe/modeling_nllb_moe.py", "repo_id": "transformers", "token_count": 37590 }
700
# Inference Examples **The inference examples folder is deprecated and will be removed in a future version**. **Officially supported inference examples can be found in the [Pipelines folder](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines)**. - For `Image-to-Image text-guided generation wit...
diffusers/examples/inference/README.md/0
{ "file_path": "diffusers/examples/inference/README.md", "repo_id": "diffusers", "token_count": 252 }
207
<!--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/en/model_doc/phobert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/phobert.md", "repo_id": "transformers", "token_count": 776 }
451
<jupyter_start><jupyter_text>Search ToolsThis notebook shows off usage of various search tools.<jupyter_code>from langchain.agents import AgentType, initialize_agent, load_tools from langchain_openai import OpenAI llm = OpenAI(temperature=0)<jupyter_output><empty_output><jupyter_text>Google Serper API WrapperFirst, let...
langchain/docs/docs/integrations/tools/search_tools.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/search_tools.ipynb", "repo_id": "langchain", "token_count": 1969 }
186
export OPENAI_API_KEY="..." export ASTRA_DB_API_ENDPOINT="https://...-....apps.astra.datastax.com" export ASTRA_DB_APPLICATION_TOKEN="AstraCS:..." export ASTRA_DB_KEYSPACE="..." # Optional - falls back to default if not provided
langchain/templates/rag-astradb/.env.template/0
{ "file_path": "langchain/templates/rag-astradb/.env.template", "repo_id": "langchain", "token_count": 83 }
657
from llama_index.embeddings.google.gemini import GeminiEmbedding from llama_index.embeddings.google.palm import GooglePaLMEmbedding from llama_index.embeddings.google.univ_sent_encoder import ( GoogleUnivSentEncoderEmbedding, ) __all__ = ["GeminiEmbedding", "GooglePaLMEmbedding", "GoogleUnivSentEncoderEmbedding"]
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-google/llama_index/embeddings/google/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-google/llama_index/embeddings/google/__init__.py", "repo_id": "llama_index", "token_count": 115 }
1,240
# coding=utf-8 # Copyright 2010, The Microsoft Research Asia LayoutLM Team 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 # # Unles...
transformers/src/transformers/models/layoutlm/configuration_layoutlm.py/0
{ "file_path": "transformers/src/transformers/models/layoutlm/configuration_layoutlm.py", "repo_id": "transformers", "token_count": 3609 }
632
#!/usr/bin/env python # 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/L...
transformers/src/transformers/tools/agents.py/0
{ "file_path": "transformers/src/transformers/tools/agents.py", "repo_id": "transformers", "token_count": 12720 }
712
version: "3" services: test-exports-esbuild: image: node:18 environment: PUPPETEER_SKIP_DOWNLOAD: "true" PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true" working_dir: /app volumes: - ../yarn.lock:/root/yarn.lock - ../.yarnrc.yml:/root/.yarnrc.yml - ../.yarn:/root/.yarn - .....
langchainjs/environment_tests/docker-compose.yml/0
{ "file_path": "langchainjs/environment_tests/docker-compose.yml", "repo_id": "langchainjs", "token_count": 2540 }
773
from typing import Dict, List from langchain_community.graphs import Neo4jGraph graph = Neo4jGraph() def get_user_id() -> int: """ Placeholder for a function that would normally retrieve a user's ID """ return 1 def remove_lucene_chars(text: str) -> str: """Remove Lucene special characters...
langchain/templates/neo4j-semantic-ollama/neo4j_semantic_ollama/utils.py/0
{ "file_path": "langchain/templates/neo4j-semantic-ollama/neo4j_semantic_ollama/utils.py", "repo_id": "langchain", "token_count": 933 }
665
<jupyter_start><jupyter_text>Multi-Tenancy RAGThis notebook shows how to implement Multi-Tenancy RAG with MultiTenancyRAGPack. Setup<jupyter_code>import os os.environ["OPENAI_API_KEY"] = "YOUR OPENAI API KEY"<jupyter_output><empty_output><jupyter_text>Download data<jupyter_code>!wget --user-agent "Mozilla" "https://a...
llama_index/llama-index-packs/llama-index-packs-multi-tenancy-rag/examples/multi_tenancy_rag.ipynb/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-multi-tenancy-rag/examples/multi_tenancy_rag.ipynb", "repo_id": "llama_index", "token_count": 1190 }
1,799
<!--Copyright 2024 Custom Diffusion authors 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...
diffusers/docs/source/ko/training/custom_diffusion.md/0
{ "file_path": "diffusers/docs/source/ko/training/custom_diffusion.md", "repo_id": "diffusers", "token_count": 7052 }
194
"""Init params."""
llama_index/llama-index-legacy/tests/llm_predictor/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/llm_predictor/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,668
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 50278, "logprob": null, "text": "<|USER|>" }, { "id": 1276, "logprob": -4.5546875, "text": "What" }, { ...
text-generation-inference/integration-tests/models/__snapshots__/test_neox/test_neox.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_neox/test_neox.json", "repo_id": "text-generation-inference", "token_count": 1351 }
428
from __future__ import annotations from contextlib import contextmanager from contextvars import ContextVar from typing import ( TYPE_CHECKING, Any, Generator, List, Optional, Tuple, Type, Union, cast, ) from uuid import UUID from langsmith import utils as ls_utils from langsmith.r...
langchain/libs/core/langchain_core/tracers/context.py/0
{ "file_path": "langchain/libs/core/langchain_core/tracers/context.py", "repo_id": "langchain", "token_count": 3096 }
438
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-ai21/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-ai21/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,387
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 50278, "logprob": null, "text": "<|prompter|>" }, { "id": 1276, "logprob": -8.03125, "text": "What" }, { ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_neox_sharded/test_flash_neox.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_neox_sharded/test_flash_neox.json", "repo_id": "text-generation-inference", "token_count": 1970 }
401
import os from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain_community.document_loaders import UnstructuredFileLoader from langchain_community.embeddings import HuggingFaceEmbeddings from langchain_community.vectorstores import Redis from rag_redis.config import EMBED_MODEL, INDEX_NAME, ...
langchain/templates/rag-redis/ingest.py/0
{ "file_path": "langchain/templates/rag-redis/ingest.py", "repo_id": "langchain", "token_count": 588 }
665
# AWS All functionality related to [Amazon AWS](https://aws.amazon.com/) platform ## LLMs ### Bedrock See a [usage example](/docs/integrations/llms/bedrock). ```typescript import { Bedrock } from "langchain/llms/bedrock"; ``` ### SageMaker Endpoint > [Amazon SageMaker](https://aws.amazon.com/sagemaker/) is a sys...
langchainjs/docs/core_docs/docs/integrations/platforms/aws.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/platforms/aws.mdx", "repo_id": "langchainjs", "token_count": 712 }
765
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-microsoft-onedrive/llama_index/readers/microsoft_onedrive/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-microsoft-onedrive/llama_index/readers/microsoft_onedrive/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,337
# 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/manim_animations/big_model_inference/stage_3.py/0
{ "file_path": "accelerate/manim_animations/big_model_inference/stage_3.py", "repo_id": "accelerate", "token_count": 2891 }
8
// 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/mq/mqimpl/rocksmq/server/rocksmq_retention_test.go/0
{ "file_path": "milvus/internal/mq/mqimpl/rocksmq/server/rocksmq_retention_test.go", "repo_id": "milvus", "token_count": 7766 }
1,834
from langchain_community.utilities.metaphor_search import ( MetaphorSearchAPIWrapper, ) __all__ = ["MetaphorSearchAPIWrapper"]
langchain/libs/langchain/langchain/utilities/metaphor_search.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/metaphor_search.py", "repo_id": "langchain", "token_count": 46 }
596
# LlamaIndex Embeddings Integration: Openai
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-openai/README.md/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-openai/README.md", "repo_id": "llama_index", "token_count": 12 }
1,201
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/ingestion/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/ingestion/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,569
# coding=utf-8 # Copyright 2021 Microsoft 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/deberta/modeling_tf_deberta.py/0
{ "file_path": "transformers/src/transformers/models/deberta/modeling_tf_deberta.py", "repo_id": "transformers", "token_count": 30749 }
654
use crate::backend::BackendStorage; use crate::op::{self, CmpOp, CustomOp1, CustomOp2, CustomOp3, ReduceOp}; use crate::{CpuStorage, CudaStorage, DType, Device, Error, Layout, MetalStorage, Result, Shape}; // We do not want to implement Clone on Storage as cloning may fail because of // out of memory. Instead try_clon...
candle/candle-core/src/storage.rs/0
{ "file_path": "candle/candle-core/src/storage.rs", "repo_id": "candle", "token_count": 13775 }
33
/* eslint-disable no-process-env */ import { test } from "@jest/globals"; import { ChatOpenAI } from "@langchain/openai"; import { ChatPromptTemplate, MessagesPlaceholder, } from "@langchain/core/prompts"; import { AIMessage, BaseMessage, FunctionMessage, } from "@langchain/core/messages"; import { SerpAPI } ...
langchainjs/langchain/src/agents/tests/runnable.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/agents/tests/runnable.int.test.ts", "repo_id": "langchainjs", "token_count": 1423 }
854
import sys import traceback from importlib.machinery import SourceFileLoader if __name__ == "__main__": files = sys.argv[1:] has_failure = False for file in files: try: SourceFileLoader("x", file).load_module() except Exception: has_failure = True print(f...
langchain/libs/partners/robocorp/scripts/check_imports.py/0
{ "file_path": "langchain/libs/partners/robocorp/scripts/check_imports.py", "repo_id": "langchain", "token_count": 206 }
641
#include <torch/extension.h> #include <ATen/ATen.h> #include "cuda_launch.h" #include <vector> std::vector<at::Tensor> index_max( at::Tensor index_vals, at::Tensor indices, int A_num_block, int B_num_block ) { return index_max_kernel( index_vals, indices, A_num_block, B_num_block ); } at::...
transformers/src/transformers/kernels/mra/torch_extension.cpp/0
{ "file_path": "transformers/src/transformers/kernels/mra/torch_extension.cpp", "repo_id": "transformers", "token_count": 655 }
597
#!/usr/bin/env python """Example LangChain server exposes a conversational retrieval agent. Relevant LangChain documentation: * Creating a custom agent: https://python.langchain.com/docs/modules/agents/how_to/custom_agent * Streaming with agents: https://python.langchain.com/docs/modules/agents/how_to/streaming#custo...
langserve/examples/agent/server.py/0
{ "file_path": "langserve/examples/agent/server.py", "repo_id": "langserve", "token_count": 1258 }
1,079
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/pop2piano.md/0
{ "file_path": "transformers/docs/source/en/model_doc/pop2piano.md", "repo_id": "transformers", "token_count": 2624 }
499
# Add parent directory to python path to access lightning_base.py export PYTHONPATH="../":"${PYTHONPATH}" #creates the custom knowlegebase python use_own_knowledge_dataset.py # Start a single-node Ray cluster. ray start --head # A sample finetuning run, you need to specify data_dir, output_dir and model_name_or_pat...
transformers/examples/research_projects/rag-end2end-retriever/test_run/test_finetune.sh/0
{ "file_path": "transformers/examples/research_projects/rag-end2end-retriever/test_run/test_finetune.sh", "repo_id": "transformers", "token_count": 651 }
533
#!/usr/bin/env python # coding=utf-8 # 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-...
transformers/examples/pytorch/token-classification/run_ner.py/0
{ "file_path": "transformers/examples/pytorch/token-classification/run_ner.py", "repo_id": "transformers", "token_count": 11698 }
528
"""Graph Index Creator.""" from typing import Optional, Type from langchain_community.graphs.networkx_graph import NetworkxEntityGraph, parse_triples from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import BasePromptTemplate from langchain_core.pydantic_v1 import BaseModel from...
langchain/libs/langchain/langchain/indexes/graph.py/0
{ "file_path": "langchain/libs/langchain/langchain/indexes/graph.py", "repo_id": "langchain", "token_count": 676 }
508
"""Test Writer API wrapper.""" from langchain_community.llms.writer import Writer def test_writer_call() -> None: """Test valid call to Writer.""" llm = Writer() output = llm("Say foo:") assert isinstance(output, str)
langchain/libs/community/tests/integration_tests/llms/test_writer.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_writer.py", "repo_id": "langchain", "token_count": 80 }
361
from typing import Any, Callable, Optional, Sequence from typing_extensions import override from llama_index.legacy.bridge.pydantic import Field, PrivateAttr from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.constants import DEFAULT_NUM_OUTPUTS from llama_index.legacy.core.llms.types im...
llama_index/llama-index-legacy/llama_index/legacy/llms/gradient.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/gradient.py", "repo_id": "llama_index", "token_count": 2831 }
1,679
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/resnet/convert_resnet_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/resnet/convert_resnet_to_pytorch.py", "repo_id": "transformers", "token_count": 2997 }
714
import json import logging from typing import Any, Callable, Dict, List, Optional, Union from llama_index.core.base.base_query_engine import BaseQueryEngine from llama_index.core.base.response.schema import Response from llama_index.core.llms.llm import LLM from llama_index.core.prompts import BasePromptTemplate, Prom...
llama_index/llama-index-core/llama_index/core/indices/struct_store/json_query.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/struct_store/json_query.py", "repo_id": "llama_index", "token_count": 3514 }
1,182
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
transformers/src/transformers/models/albert/tokenization_albert_fast.py/0
{ "file_path": "transformers/src/transformers/models/albert/tokenization_albert_fast.py", "repo_id": "transformers", "token_count": 4570 }
616
from typing import Any from unittest.mock import MagicMock, patch import httpx from llama_index.llms.azure_openai import AzureOpenAI from openai.types.chat.chat_completion import ( ChatCompletion, ChatCompletionMessage, Choice, ) from openai.types.completion import CompletionUsage def mock_chat_completio...
llama_index/llama-index-integrations/llms/llama-index-llms-azure-openai/tests/test_azure_openai.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-azure-openai/tests/test_azure_openai.py", "repo_id": "llama_index", "token_count": 711 }
1,345
"""Test text splitters that require an integration.""" import pytest from langchain.text_splitter import ( CharacterTextSplitter, SentenceTransformersTokenTextSplitter, TokenTextSplitter, ) def test_huggingface_type_check() -> None: """Test that type checks are done properly on input.""" with py...
langchain/libs/langchain/tests/integration_tests/test_text_splitter.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/test_text_splitter.py", "repo_id": "langchain", "token_count": 1386 }
593
from __future__ import annotations import asyncio import threading from enum import Enum from typing import TYPE_CHECKING, Any, Optional from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.pydantic_v1 import Field from langchain_core.tools import BaseTool from langchain_community.tools...
langchain/libs/community/langchain_community/tools/ainetwork/base.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/ainetwork/base.py", "repo_id": "langchain", "token_count": 981 }
291
from typing import Callable, Tuple, Type, Union import torch LayerType = Union[str, Callable, Type[torch.nn.Module]] PadType = Union[str, int, Tuple[int, int]]
pytorch-image-models/timm/layers/typing.py/0
{ "file_path": "pytorch-image-models/timm/layers/typing.py", "repo_id": "pytorch-image-models", "token_count": 55 }
371
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "schema/output_parser", newEntrypointName: "output_parsers", newPackageName: "@langchain/core", }); export * from "@langchain/core/output_parsers";
langchainjs/langchain/src/schema/output_parser.ts/0
{ "file_path": "langchainjs/langchain/src/schema/output_parser.ts", "repo_id": "langchainjs", "token_count": 100 }
964
import { DocumentInterface } from "@langchain/core/documents"; import { ChatPromptTemplate } from "@langchain/core/prompts"; import { RunnablePassthrough, RunnableSequence, } from "@langchain/core/runnables"; import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { createSqlQueryChain } from "lang...
langchainjs/examples/src/use_cases/sql/large_db_high_cardinality.ts/0
{ "file_path": "langchainjs/examples/src/use_cases/sql/large_db_high_cardinality.ts", "repo_id": "langchainjs", "token_count": 1447 }
868
import textwrap import pyarrow as pa import pytest from datasets import Features, Value from datasets.packaged_modules.json.json import Json @pytest.fixture def jsonl_file(tmp_path): filename = tmp_path / "file.jsonl" data = textwrap.dedent( """\ {"col_1": -1} {"col_1": 1, "col_2": 2...
datasets/tests/packaged_modules/test_json.py/0
{ "file_path": "datasets/tests/packaged_modules/test_json.py", "repo_id": "datasets", "token_count": 1731 }
158
import type { SupabaseFilter, SupabaseFilterRPCCall, SupabaseMetadata, } from "@langchain/community/vectorstores/supabase"; import { Comparators, Comparison, Operation, Operators, StructuredQuery, } from "../../chains/query_constructor/ir.js"; type SupabaseFilterProps = keyof SupabaseFilter; /** * Ut...
langchainjs/langchain/src/retrievers/self_query/supabase_utils.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/self_query/supabase_utils.ts", "repo_id": "langchainjs", "token_count": 3608 }
944
from typing import Any, AsyncIterator, Dict, Iterator, List, Optional from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_models.chat_models import ( BaseChatModel, agenerate_from_stream, generate_from_stream, ) from langcha...
langchain/libs/community/langchain_community/chat_models/cohere.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/cohere.py", "repo_id": "langchain", "token_count": 3232 }
219
--- sidebar_position: 2 --- # Text embedding models :::info Head to [Integrations](/docs/integrations/text_embedding/) for documentation on built-in integrations with text embedding model providers. ::: The Embeddings class is a class designed for interfacing with text embedding models. There are lots of embedding mo...
langchain/docs/docs/modules/data_connection/text_embedding/index.mdx/0
{ "file_path": "langchain/docs/docs/modules/data_connection/text_embedding/index.mdx", "repo_id": "langchain", "token_count": 824 }
202
use candle::{Device, Tensor}; use candle_transformers::generation::LogitsProcessor; use candle_wasm_example_llama2::worker::{Model as M, ModelData}; use wasm_bindgen::prelude::*; #[wasm_bindgen] pub struct Model { inner: M, logits_processor: LogitsProcessor, tokens: Vec<u32>, repeat_penalty: f32, } im...
candle/candle-wasm-examples/llama2-c/src/bin/m.rs/0
{ "file_path": "candle/candle-wasm-examples/llama2-c/src/bin/m.rs", "repo_id": "candle", "token_count": 1807 }
74
from langchain_community.document_loaders.azure_blob_storage_container import ( AzureBlobStorageContainerLoader, ) __all__ = ["AzureBlobStorageContainerLoader"]
langchain/libs/langchain/langchain/document_loaders/azure_blob_storage_container.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/azure_blob_storage_container.py", "repo_id": "langchain", "token_count": 51 }
522
.. _Ref-Composability: Composability ============= Below we show the API reference for composable data structures. This contains both the `ComposableGraph` class as well as any builder classes that generate `ComposableGraph` objects. .. automodule:: llama_index.core.composability :members: :inherited-members:
llama_index/docs/api_reference/composability.rst/0
{ "file_path": "llama_index/docs/api_reference/composability.rst", "repo_id": "llama_index", "token_count": 93 }
1,157
<jupyter_start><jupyter_text>DocugamiThis notebook covers how to load documents from `Docugami`. It provides the advantages of using this system over alternative data loaders. Prerequisites1. Install necessary python packages.2. Grab an access token for your workspace, and make sure it is set as the `DOCUGAMI_API_KEY` ...
langchain/docs/docs/integrations/document_loaders/docugami.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/docugami.ipynb", "repo_id": "langchain", "token_count": 5203 }
97
# Airbyte Hubspot Loader The Airbyte Hubspot Loader allows you to access different Hubspot objects. ## Installation - Install llama_hub: `pip install llama_hub` - Install the hubspot source: `pip install airbyte-source-hubspot` ## Usage Here's an example usage of the AirbyteHubspotReader. ```python from llama_hub...
llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-hubspot/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-hubspot/README.md", "repo_id": "llama_index", "token_count": 871 }
1,399
"""Subclasses from base prompt.""" from llama_index.core.prompts.base import PromptTemplate # deprecated, kept for backward compatibility """Summary prompt. PromptTemplate to summarize the provided `context_str`. Required template variables: `context_str` """ SummaryPrompt = PromptTemplate """Tree Insert prompt. ...
llama_index/llama-index-core/llama_index/core/prompts/prompts.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/prompts/prompts.py", "repo_id": "llama_index", "token_count": 1054 }
1,141
package planparserv2 import ( "sync" "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/internal/proto/planpb" "github.com/milvus-io/milvus/pkg/common" "github.com/milvus-io/milvus/pkg/util/typeutil" ) func newTestSchema() *schem...
milvus/internal/parser/planparserv2/plan_parser_v2_test.go/0
{ "file_path": "milvus/internal/parser/planparserv2/plan_parser_v2_test.go", "repo_id": "milvus", "token_count": 14068 }
1,838
<jupyter_start><jupyter_text>Step-Back Prompting (Question-Answering)One prompting technique called "Step-Back" prompting can improve performance on complex questions by first asking a "step back" question. This can be combined with regular question-answering applications by then doing retrieval on both the original an...
langchain/cookbook/stepback-qa.ipynb/0
{ "file_path": "langchain/cookbook/stepback-qa.ipynb", "repo_id": "langchain", "token_count": 1376 }
82
"""Test MongoDB Atlas Vector Search functionality.""" from __future__ import annotations import os from time import sleep from typing import Any import pytest from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_community.vectorstores.mongodb_atlas import Mong...
langchain/libs/community/tests/integration_tests/vectorstores/test_mongodb_atlas.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_mongodb_atlas.py", "repo_id": "langchain", "token_count": 2313 }
386
python_sources() python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/storage/kvstore/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/storage/kvstore/BUILD", "repo_id": "llama_index", "token_count": 32 }
1,633
# langchain-anthropic
langchain/libs/partners/anthropic/README.md/0
{ "file_path": "langchain/libs/partners/anthropic/README.md", "repo_id": "langchain", "token_count": 7 }
660
"""Polygon IO tools.""" from langchain_community.tools.polygon.last_quote import PolygonLastQuote __all__ = [ "PolygonLastQuote", ]
langchain/libs/community/langchain_community/tools/polygon/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/polygon/__init__.py", "repo_id": "langchain", "token_count": 48 }
291
from langchain.embeddings.openai import OpenAIEmbeddings from langchain.text_splitter import CharacterTextSplitter from langchain_community.vectorstores import FAISS from langchain_community.document_loaders import TextLoader loader = TextLoader('../../../../../../examples/state_of_the_union.txt') documents = loader.l...
langchainjs/libs/langchain-community/src/vectorstores/tests/faiss.int.test.data/faiss.int.test.py/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/faiss.int.test.data/faiss.int.test.py", "repo_id": "langchainjs", "token_count": 211 }
971
"""Main server that exposes one or more chains as HTTP endpoints.""" from fastapi import FastAPI from langchain_openai import ChatOpenAI from langserve import add_routes app = FastAPI() # Let's add an example chain add_routes( app, ChatOpenAI(), path="/chat_model", ) if __name__ == "__main__": impor...
langserve/examples/multiple_servers/main_server.py/0
{ "file_path": "langserve/examples/multiple_servers/main_server.py", "repo_id": "langserve", "token_count": 142 }
1,083
# Copyright 2023 DDPO-pytorch authors (Kevin Black), The HuggingFace Team, metric-space. 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/lic...
trl/trl/models/modeling_sd_base.py/0
{ "file_path": "trl/trl/models/modeling_sd_base.py", "repo_id": "trl", "token_count": 11407 }
874
[tool.ruff] target-version = "py37" line-length = 119 [tool.ruff.lint] ignore = [ "B028", # warning without explicit stacklevel "C408", # dict() calls (stylistic) "C901", # function complexity "E501", ] extend-select = ["E", "F", "I", "W", "UP", "B", "T", "C"] [tool.ruff.lint.per-file-ignores] # Allow...
trl/pyproject.toml/0
{ "file_path": "trl/pyproject.toml", "repo_id": "trl", "token_count": 211 }
860
# CouchDB Loader This loader loads documents from CouchDB. The loader currently supports CouchDB 3.x using the CouchDB3 python wrapper from https://github.com/n-vlahovic/couchdb3 The user specifies a CouchDB instance to initialize the reader. They then specify the database name and query params to fetch the relevant d...
llama_index/llama-index-integrations/readers/llama-index-readers-couchdb/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-couchdb/README.md", "repo_id": "llama_index", "token_count": 324 }
1,335
import { Source } from "./SourceBubble"; export function InlineCitation(props: { source: Source; sourceNumber: number; highlighted: boolean; onMouseEnter: () => any; onMouseLeave: () => any; }) { const { source, sourceNumber, highlighted, onMouseEnter, onMouseLeave } = props; return ( <a hr...
weblangchain/nextjs/app/components/InlineCitation.tsx/0
{ "file_path": "weblangchain/nextjs/app/components/InlineCitation.tsx", "repo_id": "weblangchain", "token_count": 242 }
1,930
"""Test LLM PAL functionality.""" import pytest from langchain_experimental.pal_chain.base import PALChain, PALValidation from langchain_experimental.pal_chain.colored_object_prompt import COLORED_OBJECT_PROMPT from langchain_experimental.pal_chain.math_prompt import MATH_PROMPT from tests.unit_tests.fake_llm import F...
langchain/libs/experimental/tests/unit_tests/test_pal.py/0
{ "file_path": "langchain/libs/experimental/tests/unit_tests/test_pal.py", "repo_id": "langchain", "token_count": 3832 }
442
// 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/datanode/data_node.go/0
{ "file_path": "milvus/internal/datanode/data_node.go", "repo_id": "milvus", "token_count": 5427 }
1,699
<jupyter_start><jupyter_text>YouTube>[YouTube Search](https://github.com/joetats/youtube_search) package searches `YouTube` videos avoiding using their heavily rate-limited API.>>It uses the form on the `YouTube` homepage and scrapes the resulting page.This notebook shows how to use a tool to search YouTube.Adapted fro...
langchain/docs/docs/integrations/tools/youtube.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/youtube.ipynb", "repo_id": "langchain", "token_count": 221 }
178
from llama_index.vector_stores.deeplake.base import DeepLakeVectorStore __all__ = ["DeepLakeVectorStore"]
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-deeplake/llama_index/vector_stores/deeplake/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-deeplake/llama_index/vector_stores/deeplake/__init__.py", "repo_id": "llama_index", "token_count": 34 }
1,517
## Running Yolo Examples Here, we provide two examples of how to run YOLOv8 using a Candle-compiled WASM binary and runtimes. ### Pure Rust UI To build and test the UI made in Rust you will need [Trunk](https://trunkrs.dev/#install) From the `candle-wasm-examples/yolo` directory run: Download assets: ```bash wget ...
candle/candle-wasm-examples/yolo/README.md/0
{ "file_path": "candle/candle-wasm-examples/yolo/README.md", "repo_id": "candle", "token_count": 412 }
86
export { AutoGPTPrompt, type AutoGPTPromptInput } from "./prompt.js"; export { AutoGPTOutputParser, preprocessJsonInput } from "./output_parser.js"; export { AutoGPT, type AutoGPTInput } from "./agent.js"; export type { AutoGPTAction } from "./schema.js";
langchainjs/langchain/src/experimental/autogpt/index.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/autogpt/index.ts", "repo_id": "langchainjs", "token_count": 87 }
879
## Textual Inversion fine-tuning example for SDXL ``` export MODEL_NAME="stabilityai/stable-diffusion-xl-base-1.0" export DATA_DIR="./cat" accelerate launch textual_inversion_sdxl.py \ --pretrained_model_name_or_path=$MODEL_NAME \ --train_data_dir=$DATA_DIR \ --learnable_property="object" \ --placeholder_toke...
diffusers/examples/textual_inversion/README_sdxl.md/0
{ "file_path": "diffusers/examples/textual_inversion/README_sdxl.md", "repo_id": "diffusers", "token_count": 294 }
214
from langchain_community.document_loaders.college_confidential import ( CollegeConfidentialLoader, ) __all__ = ["CollegeConfidentialLoader"]
langchain/libs/langchain/langchain/document_loaders/college_confidential.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/college_confidential.py", "repo_id": "langchain", "token_count": 41 }
502
import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { Embeddings, EmbeddingsParams } from "@langchain/core/embeddings"; import { chunkArray } from "@langchain/core/utils/chunk_array"; /** * Interface that extends EmbeddingsParams and defines additional * parameters specific to the CohereEmbedd...
langchainjs/libs/langchain-community/src/embeddings/cohere.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/embeddings/cohere.ts", "repo_id": "langchainjs", "token_count": 1505 }
980
# LangSmith Client SDKs This repository contains the Python and Javascript SDK's for interacting with the [LangSmith platform](https://smith.langchain.com/). LangSmith helps your team debug, evaluate, and monitor your language models and intelligent agents. It works with any LLM Application, including a native integr...
langsmith-sdk/README.md/0
{ "file_path": "langsmith-sdk/README.md", "repo_id": "langsmith-sdk", "token_count": 883 }
1,143