text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# CSP-ResNeXt **CSPResNeXt** is a convolutional neural network where we apply the Cross Stage Partial Network (CSPNet) approach to [ResNeXt](https://paperswithcode.com/method/resnext). The CSPNet partitions the feature map of the base layer into two parts and then merges them through a cross-stage hierarchy. The use o...
pytorch-image-models/docs/models/csp-resnext.md/0
{ "file_path": "pytorch-image-models/docs/models/csp-resnext.md", "repo_id": "pytorch-image-models", "token_count": 1722 }
351
use async_trait::async_trait; use figment::providers::{Env, Format, Serialized, Yaml}; use serde::Deserialize; use crate::errors::ChromaError; const DEFAULT_CONFIG_PATH: &str = "./chroma_config.yaml"; const ENV_PREFIX: &str = "CHROMA_"; #[derive(Deserialize)] /// # Description /// The RootConfig for all chroma servi...
chroma/rust/worker/src/config.rs/0
{ "file_path": "chroma/rust/worker/src/config.rs", "repo_id": "chroma", "token_count": 6460 }
59
# LangGraph # 🦜🕸️LangGraph.js ⚡ Building language agents as graphs ⚡ ## Overview LangGraph is a library for building stateful, multi-actor applications with LLMs, built on top of (and intended to be used with) [LangChain.js](https://github.com/langchain-ai/langchainjs). It extends the [LangChain Expression Langua...
langchainjs/docs/core_docs/docs/langgraph.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/langgraph.mdx", "repo_id": "langchainjs", "token_count": 5863 }
747
"""Question answering over a knowledge graph."""
langchain/libs/langchain/langchain/chains/graph_qa/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/graph_qa/__init__.py", "repo_id": "langchain", "token_count": 10 }
503
import type { Redis } from "ioredis"; import { BaseStore } from "@langchain/core/stores"; /** * Class that extends the BaseStore class to interact with a Redis * database. It provides methods for getting, setting, and deleting data, * as well as yielding keys from the database. * @example * ```typescript * cons...
langchainjs/libs/langchain-community/src/storage/ioredis.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/storage/ioredis.ts", "repo_id": "langchainjs", "token_count": 1705 }
1,034
import { describe, test, expect } from "@jest/globals"; import { Document } from "@langchain/core/documents"; import { GoogleCloudStorageDocstore } from "../gcs.js"; describe.skip("GoogleCloudStorageDocstore", () => { const bucket = "INSERT_BUCKET_HERE"; test("save", async () => { const name = "test1"; co...
langchainjs/langchain/src/stores/doc/tests/gcs.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/stores/doc/tests/gcs.int.test.ts", "repo_id": "langchainjs", "token_count": 749 }
1,018
# coding=utf-8 # Copyright 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 requir...
transformers/src/transformers/models/vision_text_dual_encoder/configuration_vision_text_dual_encoder.py/0
{ "file_path": "transformers/src/transformers/models/vision_text_dual_encoder/configuration_vision_text_dual_encoder.py", "repo_id": "transformers", "token_count": 1524 }
683
from llama_index.llms.localai.base import LocalAI __all__ = ["LocalAI"]
llama_index/llama-index-integrations/llms/llama-index-llms-localai/llama_index/llms/localai/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-localai/llama_index/llms/localai/__init__.py", "repo_id": "llama_index", "token_count": 27 }
1,286
import tempfile import numpy as np import torch from transformers import AutoTokenizer, T5EncoderModel from diffusers import DDPMScheduler, UNet2DConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloyd_if import IFWatermarker from diffusers.utils.testing...
diffusers/tests/pipelines/deepfloyd_if/__init__.py/0
{ "file_path": "diffusers/tests/pipelines/deepfloyd_if/__init__.py", "repo_id": "diffusers", "token_count": 4583 }
277
from functools import total_ordering import torch from abc import ABC, abstractmethod from dataclasses import dataclass from typing import List, Optional from transformers import PreTrainedTokenizerBase from text_generation_server.pb import generate_pb2 from text_generation_server.pb.generate_pb2 import FinishReason...
text-generation-inference/server/text_generation_server/models/types.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/types.py", "repo_id": "text-generation-inference", "token_count": 1183 }
448
import typing # It's currently impossible to support mypy for both pydantic v1 and v2 at once: # https://github.com/pydantic/pydantic/issues/6022 # # In the lint environment, pydantic is currently v1. # When we upgrade it to pydantic v2, we'll need # to replace this with `from pydantic.v1.main import *`. if typing.TYP...
langchain/libs/experimental/langchain_experimental/pydantic_v1/main.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/pydantic_v1/main.py", "repo_id": "langchain", "token_count": 194 }
447
python_sources()
llama_index/llama-index-core/llama_index/core/command_line/new_package/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/command_line/new_package/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,165
/* eslint-disable no-promise-executor-return */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { test } from "@jest/globals"; import { RunnableLambda } from "../base.js"; test("RunnableRetry invoke", async () => { let attemptCount = 0; const runnable = new RunnableLambda({ func: (_thing: unkno...
langchainjs/langchain-core/src/runnables/tests/runnable_retry.test.ts/0
{ "file_path": "langchainjs/langchain-core/src/runnables/tests/runnable_retry.test.ts", "repo_id": "langchainjs", "token_count": 857 }
859
<!--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/ja/model_doc/bark.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/bark.md", "repo_id": "transformers", "token_count": 3181 }
544
# # Ensemble Adversarial Inception ResNet v2 **Inception-ResNet-v2** is a convolutional neural architecture that builds on the Inception family of architectures but incorporates [residual connections](https://paperswithcode.com/method/residual-connection) (replacing the filter concatenation stage of the Inception arch...
pytorch-image-models/docs/models/ensemble-adversarial.md/0
{ "file_path": "pytorch-image-models/docs/models/ensemble-adversarial.md", "repo_id": "pytorch-image-models", "token_count": 2206 }
351
import pytest import logging import hypothesis.strategies as st from hypothesis import given from typing import Dict, Set, cast, Union, DefaultDict, Any, List from dataclasses import dataclass from chromadb.api.types import ID, Include, IDs, validate_embeddings import chromadb.errors as errors from chromadb.api import ...
chroma/chromadb/test/property/test_embeddings.py/0
{ "file_path": "chroma/chromadb/test/property/test_embeddings.py", "repo_id": "chroma", "token_count": 7767 }
25
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/utils/notification_service.py/0
{ "file_path": "transformers/utils/notification_service.py", "repo_id": "transformers", "token_count": 21515 }
778
# 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/tests/models/regnet/test_modeling_flax_regnet.py/0
{ "file_path": "transformers/tests/models/regnet/test_modeling_flax_regnet.py", "repo_id": "transformers", "token_count": 3717 }
746
<!--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/pt/quicktour.md/0
{ "file_path": "transformers/docs/source/pt/quicktour.md", "repo_id": "transformers", "token_count": 6106 }
508
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_flax_available, is_torch_available, is_transformers_available, ) _dummy_objects = {} _additional_imports = {} _import_structure = {"pipel...
diffusers/src/diffusers/pipelines/stable_diffusion_xl/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion_xl/__init__.py", "repo_id": "diffusers", "token_count": 1202 }
246
import { ChainValues } from "@langchain/core/utils/types"; import { CallbackManagerForChainRun, Callbacks, } from "@langchain/core/callbacks/manager"; import { BaseChain, ChainInputs } from "../../chains/base.js"; /** * A type that represents the inputs for the MultiRouteChain. It is a * recursive type that can ...
langchainjs/langchain/src/chains/router/multi_route.ts/0
{ "file_path": "langchainjs/langchain/src/chains/router/multi_route.ts", "repo_id": "langchainjs", "token_count": 1246 }
866
# coding=utf-8 # Copyright 2018 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/convert_slow_tokenizers_checkpoints_to_fast.py/0
{ "file_path": "transformers/src/transformers/convert_slow_tokenizers_checkpoints_to_fast.py", "repo_id": "transformers", "token_count": 1993 }
592
apiVersion: chaos-mesh.org/v1alpha1 kind: NetworkChaos metadata: name: test-etcd-network-partition namespace: chaos-testing spec: action: partition mode: all selector: namespaces: - chaos-testing labelSelectors: app.kubernetes.io/instance: chaos-testing app.kubernetes.io/name: milvus...
milvus/tests/python_client/chaos/chaos_objects/network_partition/chaos_etcd_network_partition.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/network_partition/chaos_etcd_network_partition.yaml", "repo_id": "milvus", "token_count": 228 }
2,023
# Copyright 2022 Meta Platforms authors and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
transformers/src/transformers/models/flava/__init__.py/0
{ "file_path": "transformers/src/transformers/models/flava/__init__.py", "repo_id": "transformers", "token_count": 1213 }
606
// 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/mqwrapper/nmq/nmq_client_test.go/0
{ "file_path": "milvus/pkg/mq/msgstream/mqwrapper/nmq/nmq_client_test.go", "repo_id": "milvus", "token_count": 2785 }
2,096
<!--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/es/tasks/multiple_choice.md/0
{ "file_path": "transformers/docs/source/es/tasks/multiple_choice.md", "repo_id": "transformers", "token_count": 4153 }
505
import { BaseRun, Run } from "langsmith/schemas"; import { BaseTracer } from "./base.js"; /** * A callback handler that collects traced runs and makes it easy to fetch the traced run object from calls through any langchain object. * For instance, it makes it easy to fetch the run ID and then do things with that, suc...
langchainjs/langchain-core/src/tracers/run_collector.ts/0
{ "file_path": "langchainjs/langchain-core/src/tracers/run_collector.ts", "repo_id": "langchainjs", "token_count": 350 }
883
import { defineConfig, Options } from 'tsup' import fs from 'fs' export default defineConfig((options: Options) => { const commonOptions: Partial<Options> = { entry: { chromadb: 'src/index.ts' }, sourcemap: true, dts: true, ...options } return [ { ...commonOptions, form...
chroma/clients/js/tsup.config.ts/0
{ "file_path": "chroma/clients/js/tsup.config.ts", "repo_id": "chroma", "token_count": 327 }
36
[build-system] build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] [tool.codespell] check-filenames = true check-hidden = true skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb" [tool.llamahub] classes = ["AzureAISearchVectorStore", "CognitiveSearchVectorStore", "IndexManagement"] contains_exam...
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/pyproject.toml", "repo_id": "llama_index", "token_count": 674 }
1,545
# Copyright 2024 Stanford University Team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
diffusers/src/diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_img2img.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_img2img.py", "repo_id": "diffusers", "token_count": 21123 }
259
# Copyright 2023 EleutherAI 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 # # Unless r...
transformers/src/transformers/models/deprecated/open_llama/__init__.py/0
{ "file_path": "transformers/src/transformers/models/deprecated/open_llama/__init__.py", "repo_id": "transformers", "token_count": 1041 }
590
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/bloom.md/0
{ "file_path": "transformers/docs/source/en/model_doc/bloom.md", "repo_id": "transformers", "token_count": 1158 }
499
<jupyter_start><jupyter_text>Cohere Reranker>[Cohere](https://cohere.ai/about) is a Canadian startup that provides natural language processing models that help companies improve human-machine interactions.This notebook shows how to use [Cohere's rerank endpoint](https://docs.cohere.com/docs/reranking) in a retriever. T...
langchain/docs/docs/integrations/retrievers/cohere-reranker.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/cohere-reranker.ipynb", "repo_id": "langchain", "token_count": 1380 }
167
use super::{super::OrderedVocabIter, trainer::BpeTrainer, Error, Pair, Word}; use crate::tokenizer::{Model, Result, Token}; use crate::utils::cache::{Cache, DEFAULT_CACHE_CAPACITY}; use crate::utils::iter::ResultShunt; use serde_json::Value; use std::borrow::Cow; use std::{ collections::HashMap, fs::File, i...
tokenizers/tokenizers/src/models/bpe/model.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/bpe/model.rs", "repo_id": "tokenizers", "token_count": 15137 }
452
python_sources()
llama_index/llama-index-core/llama_index/core/readers/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/readers/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,138
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-pdb/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-pdb/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,359
from typing import Any, List, Optional from langchain_core.language_models.chat_models import BaseChatModel from langchain_core.messages import AIMessage, BaseMessage from langchain_core.outputs import ChatGeneration, ChatResult from pytest_mock import MockerFixture from syrupy import SnapshotAssertion from langchain...
langchain/libs/langchain/tests/unit_tests/runnables/test_openai_functions.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/runnables/test_openai_functions.py", "repo_id": "langchain", "token_count": 1568 }
639
#! /bin/bash GO_DIFF_FILES="" while read -r line; do export GO_DIFF_FILES="$GO_DIFF_FILES $line" done <<< "$(git diff --name-only --diff-filter=d HEAD "*.go")" make fmt
milvus/githooks/pre-commit/fmt/0
{ "file_path": "milvus/githooks/pre-commit/fmt", "repo_id": "milvus", "token_count": 77 }
1,635
#!/usr/bin/env python """Example LangChain Server that runs a local llm. **Attention** This is OK for prototyping / dev usage, but should not be used for production cases when there might be concurrent requests from different users. As of the time of writing, Ollama is designed for single user and cannot handle concur...
langserve/examples/local_llm/server.py/0
{ "file_path": "langserve/examples/local_llm/server.py", "repo_id": "langserve", "token_count": 333 }
998
# SPNASNet **Single-Path NAS** is a novel differentiable NAS method for designing hardware-efficient ConvNets in less than 4 hours. ## How do I use this model on an image? To load a pretrained model: ```python import timm model = timm.create_model('spnasnet_100', pretrained=True) model.eval() ``` To load and prepro...
pytorch-image-models/docs/models/spnasnet.md/0
{ "file_path": "pytorch-image-models/docs/models/spnasnet.md", "repo_id": "pytorch-image-models", "token_count": 1505 }
369
from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.embeddings.adapter import AdapterEmbeddingModel def test_class(): names_of_base_classes = [b.__name__ for b in AdapterEmbeddingModel.__mro__] assert BaseEmbedding.__name__ in names_of_base_classes
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-adapter/tests/test_embeddings_adapter.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-adapter/tests/test_embeddings_adapter.py", "repo_id": "llama_index", "token_count": 100 }
1,300
# EARNING CALL TRANSCRIPTS LOADER This loader fetches the earning call transcripts of US based companies from the website [discountingcashflows.com](https://discountingcashflows.com/). It is not available for commercial purposes Install the required dependencies ``` pip install -r requirements.txt ``` The Earning c...
llama_index/llama-index-integrations/readers/llama-index-readers-earnings-call-transcript/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-earnings-call-transcript/README.md", "repo_id": "llama_index", "token_count": 636 }
1,360
<jupyter_start><jupyter_text>If you're opening this Notebook on colab, you will probably need to install the most recent versions of 🤗 Transformers and 🤗 Datasets. We will also need `scipy` and `scikit-learn` for some of the metrics. Uncomment the following cell and run it.<jupyter_code>#! pip install transformers #!...
notebooks/examples/text_classification-tf.ipynb/0
{ "file_path": "notebooks/examples/text_classification-tf.ipynb", "repo_id": "notebooks", "token_count": 8177 }
313
// 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/VectorTrait.h/0
{ "file_path": "milvus/internal/core/src/common/VectorTrait.h", "repo_id": "milvus", "token_count": 1289 }
1,747
"""Util that calls OpenWeatherMap using PyOWM.""" from typing import Any, Dict, Optional from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator from langchain_core.utils import get_from_dict_or_env class OpenWeatherMapAPIWrapper(BaseModel): """Wrapper for OpenWeatherMap API using PyOWM. Doc...
langchain/libs/community/langchain_community/utilities/openweathermap.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/openweathermap.py", "repo_id": "langchain", "token_count": 1100 }
307
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-google/llama_index/tools/google/calendar/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-google/llama_index/tools/google/calendar/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,424
apiVersion: v1 kind: Pod metadata: labels: app: milvus componet: testframework spec: containers: - name: milvus-testframework image: registry.milvus.io/milvus/milvus-test:v0.2 command: - cat tty: true
milvus/tests/benchmark/ci/pod_containers/milvus-testframework.yaml/0
{ "file_path": "milvus/tests/benchmark/ci/pod_containers/milvus-testframework.yaml", "repo_id": "milvus", "token_count": 101 }
1,922
"""Program utils.""" import warnings from typing import Any, List, Type from llama_index.core.bridge.pydantic import BaseModel, Field, create_model from llama_index.core.llms.llm import LLM from llama_index.core.output_parsers.pydantic import PydanticOutputParser from llama_index.core.prompts.base import PromptTempla...
llama_index/llama-index-core/llama_index/core/program/utils.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/program/utils.py", "repo_id": "llama_index", "token_count": 1710 }
1,206
// 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/rootcoord/undo.go/0
{ "file_path": "milvus/internal/rootcoord/undo.go", "repo_id": "milvus", "token_count": 688 }
1,924
# Optimum-intel All functionality related to the [optimum-intel](https://github.com/huggingface/optimum-intel.git) and [IPEX](https://github.com/intel/intel-extension-for-pytorch). ## Installation Install using optimum-intel and ipex using: ```bash pip install optimum[neural-compressor] pip install intel_extension_...
langchain/docs/docs/integrations/providers/optimum_intel.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/optimum_intel.mdx", "repo_id": "langchain", "token_count": 300 }
145
interactions: - request: body: '{"input": [[8134], [2308], [43673]], "encoding_format": "base64"}' headers: Accept: - '*/*' Accept-Encoding: - gzip, deflate Connection: - keep-alive Content-Length: - '65' Content-Type: - application/json User-Age...
langchain/libs/community/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search_by_vector.yaml/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/cassettes/test_weaviate/TestWeaviate.test_max_marginal_relevance_search_by_vector.yaml", "repo_id": "langchain", "token_count": 30055 }
348
from typing import Any, Callable, List, Protocol, Tuple, runtime_checkable from llama_index.legacy.vector_stores.types import VectorStoreQueryResult SparseEncoderCallable = Callable[[List[str]], Tuple[List[List[int]], List[List[float]]]] @runtime_checkable class HybridFusionCallable(Protocol): """Hybrid fusion ...
llama_index/llama-index-legacy/llama_index/legacy/vector_stores/qdrant_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/vector_stores/qdrant_utils.py", "repo_id": "llama_index", "token_count": 2485 }
1,787
import { base } from "$app/paths"; import { ENABLE_ASSISTANTS } from "$env/static/private"; import { collections } from "$lib/server/database.js"; import type { Assistant } from "$lib/types/Assistant"; import type { User } from "$lib/types/User"; import { error, redirect } from "@sveltejs/kit"; import type { Filter } f...
chat-ui/src/routes/assistants/+page.server.ts/0
{ "file_path": "chat-ui/src/routes/assistants/+page.server.ts", "repo_id": "chat-ui", "token_count": 603 }
102
<script lang="ts"> import { enhance } from "$app/forms"; import { base } from "$app/paths"; import { page } from "$app/stores"; import { PUBLIC_ORIGIN, PUBLIC_SHARE_PREFIX } from "$env/static/public"; import { useSettingsStore } from "$lib/stores/settings"; import type { PageData } from "./$types"; import Carbo...
chat-ui/src/routes/settings/assistants/[assistantId]/+page.svelte/0
{ "file_path": "chat-ui/src/routes/settings/assistants/[assistantId]/+page.svelte", "repo_id": "chat-ui", "token_count": 2186 }
105
import json import mimetypes import os from string import Template from typing import Sequence, Type from fastapi.responses import Response from langchain.schema.runnable import Runnable from langserve.pydantic_v1 import BaseModel class PlaygroundTemplate(Template): delimiter = "____" def _get_mimetype(path: ...
langserve/langserve/playground.py/0
{ "file_path": "langserve/langserve/playground.py", "repo_id": "langserve", "token_count": 1313 }
1,027
// 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/tracer/stack_trace.go/0
{ "file_path": "milvus/pkg/tracer/stack_trace.go", "repo_id": "milvus", "token_count": 436 }
1,926
from llama_index.readers.file.image_deplot.base import ( ImageTabularChartReader, ) __all__ = ["ImageTabularChartReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image_deplot/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image_deplot/__init__.py", "repo_id": "llama_index", "token_count": 45 }
1,490
import multiprocessing import re from typing import Any, Callable, Dict, Union from chromadb.types import Metadata Validator = Callable[[Union[str, int, float]], bool] param_validators: Dict[str, Validator] = { "hnsw:space": lambda p: bool(re.match(r"^(l2|cosine|ip)$", str(p))), "hnsw:construction_ef": lamb...
chroma/chromadb/segment/impl/vector/hnsw_params.py/0
{ "file_path": "chroma/chromadb/segment/impl/vector/hnsw_params.py", "repo_id": "chroma", "token_count": 1289 }
19
import { ChatMinimax } from "@langchain/community/chat_models/minimax"; import { ChatPromptTemplate, HumanMessagePromptTemplate, } from "@langchain/core/prompts"; import { HumanMessage } from "@langchain/core/messages"; const model = new ChatMinimax({ modelName: "abab5.5-chat", botSetting: [ { bot_na...
langchainjs/examples/src/models/chat/minimax_glyph.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/minimax_glyph.ts", "repo_id": "langchainjs", "token_count": 1237 }
826
// 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/numpy_adapter_test.go/0
{ "file_path": "milvus/internal/util/importutil/numpy_adapter_test.go", "repo_id": "milvus", "token_count": 9441 }
2,019
# Copyright 2023 Mistral AI 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 # # Unless r...
transformers/src/transformers/models/mistral/convert_mistral_weights_to_hf.py/0
{ "file_path": "transformers/src/transformers/models/mistral/convert_mistral_weights_to_hf.py", "repo_id": "transformers", "token_count": 4616 }
693
"""Web scraper.""" import logging from typing import Any, Callable, Dict, List, Optional, Tuple import requests from llama_index.legacy.bridge.pydantic import PrivateAttr from llama_index.legacy.readers.base import BasePydanticReader from llama_index.legacy.schema import Document logger = logging.getLogger(__name__...
llama_index/llama-index-legacy/llama_index/legacy/readers/web.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/web.py", "repo_id": "llama_index", "token_count": 4210 }
1,708
from typing import cast, ClassVar from chromadb.telemetry.product import ProductTelemetryEvent from chromadb.utils.embedding_functions import get_builtins class ClientStartEvent(ProductTelemetryEvent): def __init__(self) -> None: super().__init__() class ClientCreateCollectionEvent(ProductTelemetryEvent...
chroma/chromadb/telemetry/product/events.py/0
{ "file_path": "chroma/chromadb/telemetry/product/events.py", "repo_id": "chroma", "token_count": 3453 }
21
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/composability/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/composability/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,695
from __future__ import annotations from io import IOBase from typing import TYPE_CHECKING, Any, List, Optional, Union from langchain_experimental.agents.agent_toolkits.pandas.base import ( create_pandas_dataframe_agent, ) if TYPE_CHECKING: from langchain.agents.agent import AgentExecutor from langchain_c...
langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/csv/base.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/csv/base.py", "repo_id": "langchain", "token_count": 1006 }
453
// 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/dummyreq_test.go/0
{ "file_path": "milvus/internal/proxy/dummyreq_test.go", "repo_id": "milvus", "token_count": 2765 }
1,960
--- sidebar_class_name: hidden --- # XML Agent :::caution This is a legacy chain, it is not recommended for use. Instead, see docs for the [LCEL version](/docs/modules/agents/agent_types/xml). ::: Some language models (like Anthropic's Claude) are particularly good at reasoning/writing XML. The below example shows h...
langchainjs/docs/core_docs/docs/modules/agents/agent_types/xml_legacy.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/agents/agent_types/xml_legacy.mdx", "repo_id": "langchainjs", "token_count": 216 }
723
# Conclusion [[conclusion]] Congrats on finishing this unit and the tutorial. You've just trained your first virtual robots 🥳. **Take time to grasp the material before continuing**. You can also look at the additional reading materials we provided in the *additional reading* section. Finally, we would love **to hea...
deep-rl-class/units/en/unit6/conclusion.mdx/0
{ "file_path": "deep-rl-class/units/en/unit6/conclusion.mdx", "repo_id": "deep-rl-class", "token_count": 145 }
167
"""Relevancy evaluation.""" from __future__ import annotations from typing import Any, List, Sequence, Union from llama_index.core.evaluation.base import BaseEvaluator, EvaluationResult from llama_index.core.multi_modal_llms.base import MultiModalLLM from llama_index.core.prompts import BasePromptTemplate, PromptTem...
llama_index/llama-index-core/llama_index/core/evaluation/multi_modal/relevancy.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/evaluation/multi_modal/relevancy.py", "repo_id": "llama_index", "token_count": 3306 }
1,123
"""Image parser. Contains parsers for image files. """ import re from pathlib import Path from typing import Dict, List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document, ImageDocument from llama_index.core.utils import infer_torch_device class ImageReader...
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image/base.py", "repo_id": "llama_index", "token_count": 1881 }
1,401
<!--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/main_classes/output.md/0
{ "file_path": "transformers/docs/source/en/main_classes/output.md", "repo_id": "transformers", "token_count": 2777 }
468
<jupyter_start><jupyter_text>MistralAIEmbeddingsThis notebook explains how to use MistralAIEmbeddings, which is included in the langchain_mistralai package, to embed texts in langchain.<jupyter_code># pip install -U langchain-mistralai<jupyter_output><empty_output><jupyter_text>import the library<jupyter_code>from lang...
langchain/libs/partners/mistralai/docs/embeddings.ipynb/0
{ "file_path": "langchain/libs/partners/mistralai/docs/embeddings.ipynb", "repo_id": "langchain", "token_count": 276 }
631
<jupyter_start><jupyter_text>Chat Engine - Condense Plus Context Mode This is a multi-step chat mode built on top of a retriever over your data. For each chat interaction:* First condense a conversation and latest user message to a standalone question* Then build a context for the standalone question from a retriever,*...
llama_index/docs/examples/chat_engine/chat_engine_condense_plus_context.ipynb/0
{ "file_path": "llama_index/docs/examples/chat_engine/chat_engine_condense_plus_context.ipynb", "repo_id": "llama_index", "token_count": 1866 }
1,094
import typing # It's currently impossible to support mypy for both pydantic v1 and v2 at once: # https://github.com/pydantic/pydantic/issues/6022 # # In the lint environment, pydantic is currently v1. # When we upgrade it to pydantic v2, we'll need to # replace this with `from pydantic.v1.dataclasses import *`. if typ...
langchain/libs/experimental/langchain_experimental/pydantic_v1/dataclasses.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/pydantic_v1/dataclasses.py", "repo_id": "langchain", "token_count": 202 }
453
""" MLP module w/ dropout and configurable activation layer Hacked together by / Copyright 2020 Ross Wightman """ from functools import partial from torch import nn as nn from .grn import GlobalResponseNorm from .helpers import to_2tuple class Mlp(nn.Module): """ MLP as used in Vision Transformer, MLP-Mixer an...
pytorch-image-models/timm/layers/mlp.py/0
{ "file_path": "pytorch-image-models/timm/layers/mlp.py", "repo_id": "pytorch-image-models", "token_count": 4251 }
394
# Lint as: python3 """ HuggingFace/Datasets is an open library of datasets. Note: VERSION needs to be formatted following the MAJOR.MINOR.PATCH convention (we need to follow this convention to be able to retrieve versioned scripts) Simple check list for release from AllenNLP repo: https://github.com/allenai/al...
datasets/setup.py/0
{ "file_path": "datasets/setup.py", "repo_id": "datasets", "token_count": 4179 }
133
# Chain-of-Note (Wikipedia) Implements Chain-of-Note as described in https://arxiv.org/pdf/2311.09210.pdf by Yu, et al. Uses Wikipedia for retrieval. Check out the prompt being used here https://smith.langchain.com/hub/bagatur/chain-of-note-wiki. ## Environment Setup Uses Anthropic claude-2 chat model. Set Anthropi...
langchain/templates/chain-of-note-wiki/README.md/0
{ "file_path": "langchain/templates/chain-of-note-wiki/README.md", "repo_id": "langchain", "token_count": 680 }
630
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-mistralai/llama_index/llms/mistralai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-mistralai/llama_index/llms/mistralai/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,404
from __future__ import annotations import json from typing import Dict, List, Optional import aiohttp import requests from langchain_core.callbacks import ( AsyncCallbackManagerForRetrieverRun, CallbackManagerForRetrieverRun, ) from langchain_core.documents import Document from langchain_core.pydantic_v1 impo...
langchain/libs/community/langchain_community/retrievers/azure_cognitive_search.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/azure_cognitive_search.py", "repo_id": "langchain", "token_count": 1718 }
295
// 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/storage/ChunkCache.h/0
{ "file_path": "milvus/internal/core/src/storage/ChunkCache.h", "repo_id": "milvus", "token_count": 875 }
1,663
# Bitbucket Loader This loader utilizes the Bitbucket API to load the files inside a Bitbucket repository as Documents in an index. ## Usage To use this loader, you need to provide as environment variables the `BITBUCKET_API_KEY` and the `BITBUCKET_USERNAME`. ```python import os from llama_index import VectorStoreI...
llama_index/llama-index-integrations/readers/llama-index-readers-bitbucket/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-bitbucket/README.md", "repo_id": "llama_index", "token_count": 429 }
1,343
Pandas Query Engine ======================= .. automodule:: llama_index.core.query_engine.pandas.pandas_query_engine :members: :inherited-members:
llama_index/docs/api_reference/query/query_engines/pandas_query_engine.rst/0
{ "file_path": "llama_index/docs/api_reference/query/query_engines/pandas_query_engine.rst", "repo_id": "llama_index", "token_count": 54 }
1,161
# coding=utf-8 # Copyright 2018 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/longformer/convert_longformer_original_pytorch_lightning_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/longformer/convert_longformer_original_pytorch_lightning_to_pytorch.py", "repo_id": "transformers", "token_count": 1071 }
651
# coding=utf-8 # Copyright 2022 Meta Platforms 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/LICEN...
transformers/src/transformers/models/data2vec/modeling_data2vec_vision.py/0
{ "file_path": "transformers/src/transformers/models/data2vec/modeling_data2vec_vision.py", "repo_id": "transformers", "token_count": 22669 }
618
import { loadQARefineChain } from "langchain/chains"; import { OpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { TextLoader } from "langchain/document_loaders/fs/text"; import { MemoryVectorStore } from "langchain/vectorstores/memory"; // Create the models and chain const embeddings = new OpenAIEmbeddings(...
langchainjs/examples/src/chains/qa_refine.ts/0
{ "file_path": "langchainjs/examples/src/chains/qa_refine.ts", "repo_id": "langchainjs", "token_count": 442 }
790
python_tests()
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-azure-openai/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-azure-openai/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,427
import boto3 import json import subprocess import os import re def b64text(txt): """Generate Base 64 encoded CF json for a multiline string, subbing in values where appropriate""" lines = [] for line in txt.splitlines(True): if "${" in line: lines.append({"Fn::Sub": line}) else...
chroma/bin/generate_cloudformation.py/0
{ "file_path": "chroma/bin/generate_cloudformation.py", "repo_id": "chroma", "token_count": 3118 }
11
# LlamaIndex Vector_Stores Integration: Dynamodb
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-dynamodb/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-dynamodb/README.md", "repo_id": "llama_index", "token_count": 14 }
1,524
import inspect from typing import Any, Dict, List, Optional, Union import torch import torch.nn as nn from transformers import AutoModel, AutoTokenizer, CLIPImageProcessor from diffusers import DiffusionPipeline from diffusers.image_processor import VaeImageProcessor from diffusers.loaders import LoraLoaderMixin from...
diffusers/examples/community/gluegen.py/0
{ "file_path": "diffusers/examples/community/gluegen.py", "repo_id": "diffusers", "token_count": 17627 }
198
from langchain_community.tools.google_scholar.tool import GoogleScholarQueryRun __all__ = ["GoogleScholarQueryRun"]
langchain/libs/langchain/langchain/tools/google_scholar/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/google_scholar/tool.py", "repo_id": "langchain", "token_count": 34 }
590
"""Test tools.""" import json from typing import List, Optional import pytest from llama_index.core.bridge.pydantic import BaseModel from llama_index.core.tools.function_tool import FunctionTool try: import langchain except ImportError: langchain = None # type: ignore def tmp_function(x: int) -> str: r...
llama_index/llama-index-core/tests/tools/test_base.py/0
{ "file_path": "llama_index/llama-index-core/tests/tools/test_base.py", "repo_id": "llama_index", "token_count": 2586 }
1,279
from llama_index.core.readers.base import BaseReader from llama_index.readers.wikipedia import WikipediaReader def test_class(): names_of_base_classes = [b.__name__ for b in WikipediaReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-wikipedia/tests/test_readers_wikipedia.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-wikipedia/tests/test_readers_wikipedia.py", "repo_id": "llama_index", "token_count": 85 }
1,398
# 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/timesformer/configuration_timesformer.py/0
{ "file_path": "transformers/src/transformers/models/timesformer/configuration_timesformer.py", "repo_id": "transformers", "token_count": 2112 }
739
"""Azure AI Search vector store.""" import enum import json import logging from enum import auto from typing import Any, Callable, Dict, List, Optional, Tuple, Union, cast from llama_index.core.schema import BaseNode, MetadataMode, TextNode from llama_index.core.vector_stores.types import ( ExactMatchFilter, M...
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/llama_index/vector_stores/azureaisearch/base.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/llama_index/vector_stores/azureaisearch/base.py", "repo_id": "llama_index", "token_count": 13632 }
1,646
# (Gluon) SENet A **SENet** is a convolutional neural network architecture that employs [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) to enable the network to perform dynamic channel-wise feature recalibration. The weights from this model were ported from [Gluon](http...
pytorch-image-models/docs/models/gloun-senet.md/0
{ "file_path": "pytorch-image-models/docs/models/gloun-senet.md", "repo_id": "pytorch-image-models", "token_count": 1559 }
365
from langchain_community.document_loaders.confluence import ( ConfluenceLoader, ContentFormat, ) __all__ = ["ContentFormat", "ConfluenceLoader"]
langchain/libs/langchain/langchain/document_loaders/confluence.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/confluence.py", "repo_id": "langchain", "token_count": 48 }
487
<jupyter_start><jupyter_text>Chat Executor: with function callingThis notebook walks through an example creating a chat executor that uses function calling.This is useful for getting started quickly.However, it is highly likely you will want to customize the logic - for information on that, check out the other examples...
langgraph/examples/chat_agent_executor_with_function_calling/high-level.ipynb/0
{ "file_path": "langgraph/examples/chat_agent_executor_with_function_calling/high-level.ipynb", "repo_id": "langgraph", "token_count": 624 }
989
"""Test Output parsers.""" import pytest from llama_index.legacy.output_parsers.langchain import LangchainOutputParser try: import langchain from llama_index.legacy.bridge.langchain import ( BaseOutputParser as LCOutputParser, ) from llama_index.legacy.bridge.langchain import ( Respons...
llama_index/llama-index-legacy/tests/output_parsers/test_base.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/output_parsers/test_base.py", "repo_id": "llama_index", "token_count": 686 }
1,751
# TODO: Consolidate all these scripts into a single script # This is ugly import argparse from langchain.chat_models import ChatAnthropic, ChatOpenAI from langchain.smith import RunEvalConfig from langsmith import Client # Ugly. Requires PYTHONATH=$(PWD) to run from main import create_chain, get_retriever _PROVIDER_...
chat-langchain/_scripts/evaluate_chat_langchain.py/0
{ "file_path": "chat-langchain/_scripts/evaluate_chat_langchain.py", "repo_id": "chat-langchain", "token_count": 702 }
5
// 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/segments/result_test.go/0
{ "file_path": "milvus/internal/querynodev2/segments/result_test.go", "repo_id": "milvus", "token_count": 16150 }
1,855