text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
import type { KVNamespace } from "@cloudflare/workers-types"; import { BaseCache, getCacheKey, serializeGeneration, deserializeStoredGeneration, } from "@langchain/core/caches"; import { Generation } from "@langchain/core/outputs"; /** * Represents a specific implementation of a caching mechanism using Cloud...
langchainjs/libs/langchain-cloudflare/src/caches.ts/0
{ "file_path": "langchainjs/libs/langchain-cloudflare/src/caches.ts", "repo_id": "langchainjs", "token_count": 865 }
945
"""File Management Tools.""" from langchain_community.tools.file_management.copy import CopyFileTool from langchain_community.tools.file_management.delete import DeleteFileTool from langchain_community.tools.file_management.file_search import FileSearchTool from langchain_community.tools.file_management.list_dir impor...
langchain/libs/langchain/langchain/tools/file_management/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/file_management/__init__.py", "repo_id": "langchain", "token_count": 210 }
586
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "llms/raycast", }); export * from "@langchain/community/llms/raycast";
langchainjs/langchain/src/llms/raycast.ts/0
{ "file_path": "langchainjs/langchain/src/llms/raycast.ts", "repo_id": "langchainjs", "token_count": 72 }
945
#!/bin/bash # Exit immediately for non zero status set -e log_dir=${1:-"logs"} array=($(docker-compose ps -a|awk 'NR == 1 {next} {print $1}')) echo ${array[@]} if [ ! -d $log_dir ]; then mkdir -p $log_dir fi echo "export logs start" for container in ${array[*]} do if [[ $container == milvus-* ]]; then echo "e...
milvus/tests/scripts/export_log_docker.sh/0
{ "file_path": "milvus/tests/scripts/export_log_docker.sh", "repo_id": "milvus", "token_count": 184 }
2,047
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Chase" given-names: "Harrison" title: "LangChain" date-released: 2022-10-17 url: "https://github.com/langchain-ai/langchain"
langchain/CITATION.cff/0
{ "file_path": "langchain/CITATION.cff", "repo_id": "langchain", "token_count": 86 }
67
use candle::DType; use serde::Deserialize; pub const DTYPE: DType = DType::F32; #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)] #[serde(rename_all = "lowercase")] pub enum PositionEmbeddingType { Absolute, Alibi, } // https://github.com/huggingface/transformers/blob/main/src/transformers/models/per...
candle/candle-transformers/src/models/persimmon.rs/0
{ "file_path": "candle/candle-transformers/src/models/persimmon.rs", "repo_id": "candle", "token_count": 814 }
73
{ "candidates": [ { "content": { "parts": [ { "text": "1. Sock it to Me!\n2. Heel Yeah Socks\n3. Sole Mates\n4. Happy Soles\n5. Toe-tally Awesome Socks\n6. Sock Appeal\n7. Footsie Wootsies\n8. Thread Heads\n9. Sock Squad\n10. Sock-a-licious\n11. Darn Good Socks\n12. Sockcessori...
langchainjs/libs/langchain-google-common/src/tests/data/llm-1-mock.json/0
{ "file_path": "langchainjs/libs/langchain-google-common/src/tests/data/llm-1-mock.json", "repo_id": "langchainjs", "token_count": 866 }
978
<jupyter_start><jupyter_text>Entity Metadata ExtractionIn this demo, we use the new `EntityExtractor` to extract entities from each node, stored in metadata. The default model is `tomaarsen/span-marker-mbert-base-multinerd`, which is downloaded an run locally from [HuggingFace](https://huggingface.co/tomaarsen/span-mar...
llama_index/docs/examples/metadata_extraction/EntityExtractionClimate.ipynb/0
{ "file_path": "llama_index/docs/examples/metadata_extraction/EntityExtractionClimate.ipynb", "repo_id": "llama_index", "token_count": 2020 }
1,114
import { redirect, error } from "@sveltejs/kit"; import { getOIDCUserData, validateAndParseCsrfToken } from "$lib/server/auth"; import { z } from "zod"; import { base } from "$app/paths"; import { updateUser } from "./updateUser"; import { ALLOWED_USER_EMAILS } from "$env/static/private"; import JSON5 from "json5"; co...
chat-ui/src/routes/login/callback/+page.server.ts/0
{ "file_path": "chat-ui/src/routes/login/callback/+page.server.ts", "repo_id": "chat-ui", "token_count": 671 }
109
import { test, expect, jest } from "@jest/globals"; import * as uuid from "uuid"; import { Serialized } from "../../load/serializable.js"; import { Document } from "../../documents/document.js"; import { Run } from "../base.js"; import { HumanMessage } from "../../messages/index.js"; import { FakeTracer } from "../../u...
langchainjs/langchain-core/src/tracers/tests/tracer.test.ts/0
{ "file_path": "langchainjs/langchain-core/src/tracers/tests/tracer.test.ts", "repo_id": "langchainjs", "token_count": 5254 }
861
from __future__ import annotations import logging import uuid from typing import Any, List, Optional, Tuple import numpy as np from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.vectorstores import VectorStore from langchain_community.vectorstores.utils...
langchain/libs/community/langchain_community/vectorstores/vikngdb.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/vikngdb.py", "repo_id": "langchain", "token_count": 6378 }
316
"""Test Google GenerativeAI API wrapper. Note: This test must be run with the GOOGLE_API_KEY environment variable set to a valid API key. """ from typing import Generator import pytest from langchain_core.outputs import LLMResult from langchain_google_genai import GoogleGenerativeAI, HarmBlockThreshold, HarmC...
langchain/libs/partners/google-genai/tests/integration_tests/test_llms.py/0
{ "file_path": "langchain/libs/partners/google-genai/tests/integration_tests/test_llms.py", "repo_id": "langchain", "token_count": 1307 }
645
# Banana Banana provided serverless GPU inference for AI models, including a CI/CD build pipeline and a simple Python framework (Potassium) to server your models. This page covers how to use the [Banana](https://www.banana.dev) ecosystem within LangChain. It is broken into two parts: * installation and setup, * an...
langchain/docs/docs/integrations/providers/bananadev.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/bananadev.mdx", "repo_id": "langchain", "token_count": 911 }
127
package funcutil import ( "testing" "github.com/stretchr/testify/assert" ) /* func TestMin(t *testing.T) { assert.Equal(t, uint(0), Min[uint]()) assert.Equal(t, uint(1), Min[uint](100, 1)) assert.Equal(t, uint(1), Min[uint](100, 1, 1000)) assert.Equal(t, uint16(0), Min[uint16]()) assert.Equal(t, uint16(1), M...
milvus/pkg/util/funcutil/aggregation_test.go/0
{ "file_path": "milvus/pkg/util/funcutil/aggregation_test.go", "repo_id": "milvus", "token_count": 1899 }
1,965
// An implementation of LLaMA https://github.com/facebookresearch/llama // // This is based on nanoGPT in a similar way to: // https://github.com/Lightning-AI/lit-llama/blob/main/lit_llama/model.py // // The tokenizer config can be retrieved from: // https://huggingface.co/hf-internal-testing/llama-tokenizer/raw/main/t...
candle/candle-examples/examples/llama_multiprocess/main.rs/0
{ "file_path": "candle/candle-examples/examples/llama_multiprocess/main.rs", "repo_id": "candle", "token_count": 3470 }
42
"""Test Cassandra functionality.""" import time from typing import List, Optional, Type from langchain_core.documents import Document from langchain_community.vectorstores import Cassandra from tests.integration_tests.vectorstores.fake_embeddings import ( AngularTwoDimensionalEmbeddings, ConsistentFakeEmbeddi...
langchain/libs/community/tests/integration_tests/vectorstores/test_cassandra.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_cassandra.py", "repo_id": "langchain", "token_count": 2116 }
358
from typing import List, Optional import requests from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader from langchain_community.document_loaders.web_base import WebBaseLoader IFIXIT_BASE_URL = "https://www.ifixit.com/api/2.0" class IFixitLoader(BaseLoader):...
langchain/libs/community/langchain_community/document_loaders/ifixit.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/ifixit.py", "repo_id": "langchain", "token_count": 3534 }
249
<jupyter_start><jupyter_text><jupyter_code>%pip install llama-index-vector-stores-weaviate %pip install llama-index-embeddings-huggingface !pip install llama-index<jupyter_output><empty_output><jupyter_text>Advanced Ingestion PipelineIn this notebook, we implement an `IngestionPipeline` with the following features- Mon...
llama_index/docs/examples/ingestion/advanced_ingestion_pipeline.ipynb/0
{ "file_path": "llama_index/docs/examples/ingestion/advanced_ingestion_pipeline.ipynb", "repo_id": "llama_index", "token_count": 1546 }
1,063
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class OnnxStableDiffusionImg2ImgPipeline(metaclass=DummyObject): _backends = ["torch", "transformers", "onnx"] def __init__(self, *args, **kwargs): requires_backends(self, ["...
diffusers/src/diffusers/utils/dummy_torch_and_transformers_and_onnx_objects.py/0
{ "file_path": "diffusers/src/diffusers/utils/dummy_torch_and_transformers_and_onnx_objects.py", "repo_id": "diffusers", "token_count": 1270 }
244
"""Multi Modal Vector Store Index. An index that is built on top of multiple vector stores for different modalities. """ import logging from typing import Any, List, Optional, Sequence, cast from llama_index.legacy.core.base_query_engine import BaseQueryEngine from llama_index.legacy.core.base_retriever import Base...
llama_index/llama-index-legacy/llama_index/legacy/indices/multi_modal/base.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/multi_modal/base.py", "repo_id": "llama_index", "token_count": 7257 }
1,567
#!/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/LI...
alignment-handbook/scripts/run_dpo.py/0
{ "file_path": "alignment-handbook/scripts/run_dpo.py", "repo_id": "alignment-handbook", "token_count": 3359 }
20
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and i...
diffusers/src/diffusers/pipelines/pixart_alpha/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/pixart_alpha/__init__.py", "repo_id": "diffusers", "token_count": 519 }
263
export { JsonToolkit, createJsonAgent } from "./json/json.js"; export { RequestsToolkit, OpenApiToolkit, createOpenApiAgent, } from "./openapi/openapi.js"; export { type VectorStoreInfo, VectorStoreToolkit, VectorStoreRouterToolkit, createVectorStoreAgent, createVectorStoreRouterAgent, } from "./vectors...
langchainjs/langchain/src/agents/toolkits/index.ts/0
{ "file_path": "langchainjs/langchain/src/agents/toolkits/index.ts", "repo_id": "langchainjs", "token_count": 237 }
898
export * from "@langchain/core/utils/math";
langchainjs/langchain/src/util/math.ts/0
{ "file_path": "langchainjs/langchain/src/util/math.ts", "repo_id": "langchainjs", "token_count": 14 }
1,000
# coding=utf-8 # Copyright 2021 VinAI Research 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 # # Unless req...
transformers/src/transformers/models/bartpho/tokenization_bartpho.py/0
{ "file_path": "transformers/src/transformers/models/bartpho/tokenization_bartpho.py", "repo_id": "transformers", "token_count": 6062 }
646
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). ## Getting Started First, run the development server: ```bash npm run dev # or yarn dev # or pnpm dev ``` Open [http://localhost:3000](http://localhost:3000...
langchainjs/environment_tests/test-exports-vercel/README.md/0
{ "file_path": "langchainjs/environment_tests/test-exports-vercel/README.md", "repo_id": "langchainjs", "token_count": 530 }
784
from typing import Dict, Tuple from langchain.chains.query_constructor.ir import ( Comparator, Comparison, Operation, Operator, StructuredQuery, ) from langchain.retrievers.self_query.vectara import VectaraTranslator DEFAULT_TRANSLATOR = VectaraTranslator() def test_visit_comparison() -> None: ...
langchain/libs/langchain/tests/unit_tests/retrievers/self_query/test_vectara.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/retrievers/self_query/test_vectara.py", "repo_id": "langchain", "token_count": 939 }
612
module github.com/milvus-io/milvus/pkg go 1.20 require ( github.com/apache/pulsar-client-go v0.6.1-0.20210728062540-29414db801a7 github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b github.com/blang/semver/v4 v4.0.0 github.com/cockroachdb/errors v1.9.1 github.com/confluentinc/confluent-kafka-go v1...
milvus/pkg/go.mod/0
{ "file_path": "milvus/pkg/go.mod", "repo_id": "milvus", "token_count": 4269 }
2,032
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/zh/quicktour.md/0
{ "file_path": "diffusers/docs/source/zh/quicktour.md", "repo_id": "diffusers", "token_count": 8423 }
199
# LlamaIndex Vector_Stores Integration: Rocksetdb
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-rocksetdb/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-rocksetdb/README.md", "repo_id": "llama_index", "token_count": 14 }
1,474
from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.embeddings.text_embeddings_inference import TextEmbeddingsInference def test_text_inference_embedding_class(): names_of_base_classes = [b.__name__ for b in TextEmbeddingsInference.__mro__] assert BaseEmbedding.__name__ in names_o...
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-text-embeddings-inference/tests/test_embeddings_text_embeddings_inference.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-text-embeddings-inference/tests/test_embeddings_text_embeddings_inference.py", "repo_id": "llama_index", "token_count": 116 }
1,324
import logging import os from yaml import full_load from milvus_benchmark.chaos import utils logger = logging.getLogger("milvus_benchmark.chaos.base") class BaseChaos(object): cur_path = os.path.abspath(os.path.dirname(__file__)) def __init__(self, api_version, kind, metadata, spec): self.api_versio...
milvus/tests/benchmark/milvus_benchmark/chaos/chaos_mesh.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/chaos/chaos_mesh.py", "repo_id": "milvus", "token_count": 1044 }
1,988
from langchain_community.document_loaders.apify_dataset import ApifyDatasetLoader __all__ = ["ApifyDatasetLoader"]
langchain/libs/langchain/langchain/document_loaders/apify_dataset.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/apify_dataset.py", "repo_id": "langchain", "token_count": 39 }
508
[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 = ["OpenAI"] contains_example = false import_path = "llama_index.llms.openai" [tool.mypy] di...
llama_index/llama-index-integrations/llms/llama-index-llms-openai/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-openai/pyproject.toml", "repo_id": "llama_index", "token_count": 632 }
1,294
<jupyter_start><jupyter_text>Google Cloud Storage File>[Google Cloud Storage](https://en.wikipedia.org/wiki/Google_Cloud_Storage) is a managed service for storing unstructured data.This covers how to load document objects from an `Google Cloud Storage (GCS) file object (blob)`.<jupyter_code>%pip install --upgrade --qui...
langchain/docs/docs/integrations/document_loaders/google_cloud_storage_file.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/google_cloud_storage_file.ipynb", "repo_id": "langchain", "token_count": 435 }
104
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-bagel/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-bagel/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,340
# coding=utf-8 # Copyright 2022 Google 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....
transformers/src/transformers/models/audio_spectrogram_transformer/configuration_audio_spectrogram_transformer.py/0
{ "file_path": "transformers/src/transformers/models/audio_spectrogram_transformer/configuration_audio_spectrogram_transformer.py", "repo_id": "transformers", "token_count": 2129 }
580
# flake8: noqa from langchain_community.graphs.networkx_graph import KG_TRIPLE_DELIMITER from langchain_core.prompts.prompt import PromptTemplate _DEFAULT_KNOWLEDGE_TRIPLE_EXTRACTION_TEMPLATE = ( "You are a networked intelligence helping a human track knowledge triples" " about all relevant people, things, co...
langchain/libs/langchain/langchain/indexes/prompts/knowledge_triplet_extraction.py/0
{ "file_path": "langchain/libs/langchain/langchain/indexes/prompts/knowledge_triplet_extraction.py", "repo_id": "langchain", "token_count": 612 }
533
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/vision_encoder_decoder/modeling_flax_vision_encoder_decoder.py/0
{ "file_path": "transformers/src/transformers/models/vision_encoder_decoder/modeling_flax_vision_encoder_decoder.py", "repo_id": "transformers", "token_count": 17497 }
745
[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 = ["AzureOpenAIMultiModal"] contains_example = false import_path = "llama_index.multi_modal_l...
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-azure-openai/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-azure-openai/pyproject.toml", "repo_id": "llama_index", "token_count": 710 }
1,245
from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.embeddings.clip import ClipEmbedding def test_azure_openai_embedding_class(): names_of_base_classes = [b.__name__ for b in ClipEmbedding.__mro__] assert BaseEmbedding.__name__ in names_of_base_classes
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-clip/tests/test_embeddings_clip.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-clip/tests/test_embeddings_clip.py", "repo_id": "llama_index", "token_count": 106 }
1,193
# 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/fuyu/test_modeling_fuyu.py/0
{ "file_path": "transformers/tests/models/fuyu/test_modeling_fuyu.py", "repo_id": "transformers", "token_count": 6740 }
715
# (Legacy) SE-ResNet **SE ResNet** is a variant of a [ResNet](https://www.paperswithcode.com/method/resnet) 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. ## How do I use this mod...
pytorch-image-models/docs/models/legacy-se-resnet.md/0
{ "file_path": "pytorch-image-models/docs/models/legacy-se-resnet.md", "repo_id": "pytorch-image-models", "token_count": 3698 }
366
from dataclasses import dataclass, field from typing import List, Optional from ..core import flatten_dict @dataclass class ModelConfig: """ Arguments which define the model and tokenizer to load. """ model_name_or_path: Optional[str] = field( default=None, metadata={"help": ("The mo...
trl/trl/trainer/model_config.py/0
{ "file_path": "trl/trl/trainer/model_config.py", "repo_id": "trl", "token_count": 1246 }
827
# Advanced Cuda usage
candle/candle-book/src/cuda/README.md/0
{ "file_path": "candle/candle-book/src/cuda/README.md", "repo_id": "candle", "token_count": 6 }
27
<jupyter_start><jupyter_text>Embedding Documents using Optimized and Quantized EmbeddersEmbedding all documents using Quantized Embedders.The embedders are based on optimized models, created by using [optimum-intel](https://github.com/huggingface/optimum-intel.git) and [IPEX](https://github.com/intel/intel-extension-fo...
langchain/docs/docs/integrations/text_embedding/optimum_intel.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/optimum_intel.ipynb", "repo_id": "langchain", "token_count": 671 }
175
{ "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.codeActionsOnSave": { "source.fixAll": "explicit" }, "eslint.validate": ["javascript", "svelte"] }
chat-ui/.vscode/settings.json/0
{ "file_path": "chat-ui/.vscode/settings.json", "repo_id": "chat-ui", "token_count": 83 }
83
# 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 applicabl...
transformers/tests/models/blip_2/test_processor_blip_2.py/0
{ "file_path": "transformers/tests/models/blip_2/test_processor_blip_2.py", "repo_id": "transformers", "token_count": 2156 }
772
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-slack/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-slack/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,523
from langchain_community.embeddings.aleph_alpha import ( AlephAlphaAsymmetricSemanticEmbedding, AlephAlphaSymmetricSemanticEmbedding, ) __all__ = [ "AlephAlphaAsymmetricSemanticEmbedding", "AlephAlphaSymmetricSemanticEmbedding", ]
langchain/libs/langchain/langchain/embeddings/aleph_alpha.py/0
{ "file_path": "langchain/libs/langchain/langchain/embeddings/aleph_alpha.py", "repo_id": "langchain", "token_count": 94 }
495
// 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/Exception.h/0
{ "file_path": "milvus/internal/core/src/common/Exception.h", "repo_id": "milvus", "token_count": 1872 }
1,653
from langchain_community.document_loaders.parsers.audio import OpenAIWhisperParser from langchain_community.document_loaders.parsers.docai import DocAIParser from langchain_community.document_loaders.parsers.grobid import GrobidParser from langchain_community.document_loaders.parsers.html import BS4HTMLParser from lang...
langchain/libs/langchain/langchain/document_loaders/parsers/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/parsers/__init__.py", "repo_id": "langchain", "token_count": 289 }
520
import inspect import os from argparse import ArgumentParser import numpy as np import torch from muse import MaskGiTUViT, VQGANModel from muse import PipelineMuse as OldPipelineMuse from transformers import CLIPTextModelWithProjection, CLIPTokenizer from diffusers import VQModel from diffusers.models.attention_proce...
diffusers/scripts/convert_amused.py/0
{ "file_path": "diffusers/scripts/convert_amused.py", "repo_id": "diffusers", "token_count": 12883 }
216
# Conversation Buffer This notebook shows how to use `ConversationBufferMemory`. This memory allows for storing messages and then extracts the messages in a variable. We can first extract it as a string. ```python from langchain.memory import ConversationBufferMemory ``` ```python memory = ConversationBufferMemory...
langchain/docs/docs/modules/memory/types/buffer.mdx/0
{ "file_path": "langchain/docs/docs/modules/memory/types/buffer.mdx", "repo_id": "langchain", "token_count": 1138 }
195
<jupyter_start><jupyter_text>PubMed>[PubMed®](https://pubmed.ncbi.nlm.nih.gov/) by `The National Center for Biotechnology Information, National Library of Medicine` comprises more than 35 million citations for biomedical literature from `MEDLINE`, life science journals, and online books. Citations may include links to ...
langchain/docs/docs/integrations/document_loaders/pubmed.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/pubmed.ipynb", "repo_id": "langchain", "token_count": 162 }
120
# coding=utf-8 # Copyright 2022 The Salesforce authors, The Open AI Team Authors 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/l...
transformers/src/transformers/models/codegen/tokenization_codegen_fast.py/0
{ "file_path": "transformers/src/transformers/models/codegen/tokenization_codegen_fast.py", "repo_id": "transformers", "token_count": 4249 }
661
from langchain_community.document_loaders.weather import WeatherDataLoader __all__ = ["WeatherDataLoader"]
langchain/libs/langchain/langchain/document_loaders/weather.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/weather.py", "repo_id": "langchain", "token_count": 28 }
519
# 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/blip_2/test_modeling_blip_2.py/0
{ "file_path": "transformers/tests/models/blip_2/test_modeling_blip_2.py", "repo_id": "transformers", "token_count": 17529 }
786
from langchain_community.document_loaders.bilibili import BiliBiliLoader __all__ = ["BiliBiliLoader"]
langchain/libs/langchain/langchain/document_loaders/bilibili.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/bilibili.py", "repo_id": "langchain", "token_count": 34 }
523
// Code generated by mockery v2.32.4. DO NOT EDIT. package sessionutil import ( context "context" semver "github.com/blang/semver/v4" mock "github.com/stretchr/testify/mock" time "time" ) // MockSession is an autogenerated mock type for the SessionInterface type type MockSession struct { mock.Mock } type Moc...
milvus/internal/util/sessionutil/mock_session.go/0
{ "file_path": "milvus/internal/util/sessionutil/mock_session.go", "repo_id": "milvus", "token_count": 10670 }
1,944
from langchain_community.chat_models.litellm import ChatLiteLLM, ChatLiteLLMException __all__ = ["ChatLiteLLM", "ChatLiteLLMException"]
langchain/libs/langchain/langchain/chat_models/litellm.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_models/litellm.py", "repo_id": "langchain", "token_count": 48 }
505
// 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.go/0
{ "file_path": "milvus/internal/proxy/dummyreq.go", "repo_id": "milvus", "token_count": 499 }
2,015
from torch.nn.modules.batchnorm import BatchNorm2d from torchvision.ops.misc import FrozenBatchNorm2d import timm from timm.utils.model import freeze, unfreeze def test_freeze_unfreeze(): model = timm.create_model('resnet18') # Freeze all freeze(model) # Check top level module assert model.fc.we...
pytorch-image-models/tests/test_utils.py/0
{ "file_path": "pytorch-image-models/tests/test_utils.py", "repo_id": "pytorch-image-models", "token_count": 776 }
337
import copy import os from pathlib import Path from typing import List from unittest.mock import patch import fsspec import pytest from fsspec.registry import _registry as _fsspec_registry from fsspec.spec import AbstractFileSystem from datasets.data_files import ( DataFilesDict, DataFilesList, DataFilesP...
datasets/tests/test_data_files.py/0
{ "file_path": "datasets/tests/test_data_files.py", "repo_id": "datasets", "token_count": 12239 }
150
import { Client } from "typesense"; import { Document } from "@langchain/core/documents"; import { FakeEmbeddings } from "@langchain/core/utils/testing"; import { Typesense } from "../typesense.js"; test("documentsToTypesenseRecords should return the correct typesense records", async () => { const embeddings = new F...
langchainjs/libs/langchain-community/src/vectorstores/tests/typesense.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/typesense.test.ts", "repo_id": "langchainjs", "token_count": 1308 }
1,011
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/api/loaders/unet.md/0
{ "file_path": "diffusers/docs/source/en/api/loaders/unet.md", "repo_id": "diffusers", "token_count": 402 }
164
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/tuners_utils.py/0
{ "file_path": "peft/src/peft/tuners/tuners_utils.py", "repo_id": "peft", "token_count": 11219 }
322
# Feishu Doc Loader This loader takes in IDs of Feishu Docs and parses their text into `documents`. You can extract a Feishu Doc's ID directly from its URL. For example, the ID of `https://test-csl481dfkgqf.feishu.cn/docx/HIH2dHv21ox9kVxjRuwc1W0jnkf` is `HIH2dHv21ox9kVxjRuwc1W0jnkf`. As a prerequisite, you will need t...
llama_index/llama-index-integrations/readers/llama-index-readers-feishu-docs/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-feishu-docs/README.md", "repo_id": "llama_index", "token_count": 483 }
1,344
import { expect, test } from "@jest/globals"; import { PlaywrightWebBaseLoader } from "../web/playwright.js"; test("Test playwright web scraper loader", async () => { const loader = new PlaywrightWebBaseLoader("https://www.google.com/"); const result = await loader.load(); expect(result).toBeDefined(); expect...
langchainjs/langchain/src/document_loaders/tests/playwright_web.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/playwright_web.int.test.ts", "repo_id": "langchainjs", "token_count": 312 }
881
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/examples/community/pipeline_prompt2prompt.py/0
{ "file_path": "diffusers/examples/community/pipeline_prompt2prompt.py", "repo_id": "diffusers", "token_count": 17443 }
200
# Install example requirements pip install -r ../requirements.txt # Download glue data python3 ../../utils/download_glue_data.py export TASK=mrpc export DATA_DIR=./glue_data/MRPC/ export MAX_LENGTH=128 export LEARNING_RATE=2e-5 export BERT_MODEL=bert-base-cased export BATCH_SIZE=32 export NUM_EPOCHS=3 export SEED=2 e...
transformers/examples/legacy/pytorch-lightning/run_glue.sh/0
{ "file_path": "transformers/examples/legacy/pytorch-lightning/run_glue.sh", "repo_id": "transformers", "token_count": 360 }
578
pub(crate) mod config; pub(crate) mod sysdb;
chroma/rust/worker/src/sysdb/mod.rs/0
{ "file_path": "chroma/rust/worker/src/sysdb/mod.rs", "repo_id": "chroma", "token_count": 19 }
60
# this is the process of uploading the updated models to s3. As I can't upload them directly to the correct orgs, this script shows how this is done # 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 comp...
transformers/scripts/fsmt/s3-move.sh/0
{ "file_path": "transformers/scripts/fsmt/s3-move.sh", "repo_id": "transformers", "token_count": 2133 }
554
# CIP-5: Large Batch Handling Improvements Proposal ## Status Current Status: `Under Discussion` ## **Motivation** As users start putting Chroma in its paces and storing ever-increasing datasets, we must ensure that errors related to significant and potentially expensive batches are handled gracefully. This CIP pro...
chroma/docs/CIP_5_Large_Batch_Handling_Improvements.md/0
{ "file_path": "chroma/docs/CIP_5_Large_Batch_Handling_Improvements.md", "repo_id": "chroma", "token_count": 749 }
37
"""Notion tool spec.""" from typing import Any, Dict, List, Optional, Type import requests from llama_index.legacy.bridge.pydantic import BaseModel from llama_index.legacy.readers.notion import NotionPageReader from llama_index.legacy.tools.tool_spec.base import SPEC_FUNCTION_TYPE, BaseToolSpec SEARCH_URL = "https:...
llama_index/llama-index-legacy/llama_index/legacy/tools/tool_spec/notion/base.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/tools/tool_spec/notion/base.py", "repo_id": "llama_index", "token_count": 1334 }
1,543
from typing import Any, Callable, Dict, Optional, Sequence from llama_index.legacy.bridge.pydantic import Field, PrivateAttr from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.core.llms.types import ( ChatMessage, ChatResponse, ChatResponseAsyncGen, ChatResponseGen, Co...
llama_index/llama-index-legacy/llama_index/legacy/llms/sagemaker_llm_endpoint.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/sagemaker_llm_endpoint.py", "repo_id": "llama_index", "token_count": 4060 }
1,579
export * from "@langchain/core/memory"; export { getBufferString } from "@langchain/core/messages";
langchainjs/langchain/src/memory/base.ts/0
{ "file_path": "langchainjs/langchain/src/memory/base.ts", "repo_id": "langchainjs", "token_count": 29 }
932
/* eslint-disable no-instanceof/no-instanceof */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { ALL_VECTOR_METADATA, IVectorIndexClient, VectorIndexItem, CreateVectorIndex, VectorUpsertItemBatch, VectorDeleteItemBatch, VectorSearch, VectorSearchAndFetchVectors, } from "@gomomento/sdk-c...
langchainjs/libs/langchain-community/src/vectorstores/momento_vector_index.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/momento_vector_index.ts", "repo_id": "langchainjs", "token_count": 4653 }
1,003
# Azure Cognitive Search Loader The AzCognitiveSearchReader Loader returns a set of texts corresponding to documents retrieved from specific index of Azure Cognitive Search. The user initializes the loader with credentials (service name and key) and the index name. ## Usage Here's an example usage of the AzCognitive...
llama_index/llama-index-integrations/readers/llama-index-readers-azcognitive-search/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-azcognitive-search/README.md", "repo_id": "llama_index", "token_count": 657 }
1,325
""" Optimzier Tests These tests were adapted from PyTorch' optimizer tests. """ import math import pytest import functools from copy import deepcopy import torch from torch.testing._internal.common_utils import TestCase from torch.nn import Parameter from timm.scheduler import PlateauLRScheduler from timm.optim imp...
pytorch-image-models/tests/test_optim.py/0
{ "file_path": "pytorch-image-models/tests/test_optim.py", "repo_id": "pytorch-image-models", "token_count": 11722 }
325
// 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/metrics/querycoord_metrics.go/0
{ "file_path": "milvus/pkg/metrics/querycoord_metrics.go", "repo_id": "milvus", "token_count": 1423 }
2,091
"""OpenAI Finetuning.""" import logging import os import time from typing import Any, Optional import openai from openai import OpenAI as SyncOpenAI from openai.types.fine_tuning import FineTuningJob from llama_index.core.llms.llm import LLM from llama_index.finetuning.callbacks.finetuning_handler import OpenAIFineT...
llama_index/llama-index-finetuning/llama_index/finetuning/openai/base.py/0
{ "file_path": "llama_index/llama-index-finetuning/llama_index/finetuning/openai/base.py", "repo_id": "llama_index", "token_count": 1750 }
1,203
<!--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/perf_train_special.md/0
{ "file_path": "transformers/docs/source/en/perf_train_special.md", "repo_id": "transformers", "token_count": 933 }
522
"""Chain that makes API calls and summarizes the responses to answer a question."""
langchain/libs/langchain/langchain/chains/api/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/api/__init__.py", "repo_id": "langchain", "token_count": 17 }
461
"""Patentsview reader that reads patent abstract.""" from typing import List import requests from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document BASE_URL = "https://api.patentsview.org/patents/query" class PatentsviewReader(BaseReader): """Patentsview reader. R...
llama_index/llama-index-integrations/readers/llama-index-readers-patentsview/llama_index/readers/patentsview/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-patentsview/llama_index/readers/patentsview/base.py", "repo_id": "llama_index", "token_count": 576 }
1,535
// 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/segcore/load_field_data_c.cpp/0
{ "file_path": "milvus/internal/core/src/segcore/load_field_data_c.cpp", "repo_id": "milvus", "token_count": 1790 }
1,767
<jupyter_start><jupyter_text>**Best-of-n sampling as an alternative to RLHF**This notebook compares reward-model scores of prompt based responses from 1. a base model (`gpt2-imdb`)2. `RLHF` tuned model based on this base-model 3. the base-model again from which we sample n responses to each prompt, score them and take ...
trl/examples/notebooks/best_of_n.ipynb/0
{ "file_path": "trl/examples/notebooks/best_of_n.ipynb", "repo_id": "trl", "token_count": 1717 }
867
# coding=utf-8 # Copyright 2022 Meta Platforms, Inc. and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses...
transformers/src/transformers/models/mask2former/convert_mask2former_original_pytorch_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/mask2former/convert_mask2former_original_pytorch_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 24038 }
710
<jupyter_start><jupyter_text>Single-Turn Multi-Function Calling OpenAI Agents With the latest OpenAI API (v. 1.1.0+), users can now execute multiple function calls within a single turn of `User` and `Agent` dialogue. We've updated our library to enable this new feature as well, and in this notebook we'll show you how i...
llama_index/docs/examples/agent/openai_agent_parallel_function_calling.ipynb/0
{ "file_path": "llama_index/docs/examples/agent/openai_agent_parallel_function_calling.ipynb", "repo_id": "llama_index", "token_count": 1936 }
1,047
# Upstash Redis Upstash offers developers serverless databases and messaging platforms to build powerful applications without having to worry about the operational complexity of running databases at scale. This page covers how to use [Upstash Redis](https://upstash.com/redis) with LangChain. ## Installation and Setu...
langchain/docs/docs/integrations/providers/upstash.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/upstash.mdx", "repo_id": "langchain", "token_count": 484 }
151
# Pinecone You can use [Pinecone](https://www.pinecone.io/) vectorstores with LangChain. To get started, install the integration package and the official Pinecone SDK with: import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <IntegrationInstallTooltip></IntegrationInstallTooltip>...
langchainjs/docs/core_docs/docs/integrations/vectorstores/pinecone.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/vectorstores/pinecone.mdx", "repo_id": "langchainjs", "token_count": 436 }
796
from llama_index.core.llms.base import BaseLLM from llama_index.llms.gradient import GradientBaseModelLLM, GradientModelAdapterLLM def test_embedding_class(): names_of_base_classes = [b.__name__ for b in GradientModelAdapterLLM.__mro__] assert BaseLLM.__name__ in names_of_base_classes names_of_base_class...
llama_index/llama-index-integrations/llms/llama-index-llms-gradient/tests/test_llms_gradient.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-gradient/tests/test_llms_gradient.py", "repo_id": "llama_index", "token_count": 158 }
1,309
#!/usr/bin/env python # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unles...
accelerate/src/accelerate/commands/launch.py/0
{ "file_path": "accelerate/src/accelerate/commands/launch.py", "repo_id": "accelerate", "token_count": 17304 }
14
// 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/client/client_impl_test.go/0
{ "file_path": "milvus/internal/mq/mqimpl/rocksmq/client/client_impl_test.go", "repo_id": "milvus", "token_count": 4037 }
1,725
import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], server: { watch: { usePolling: true }, proxy: { "^/(assistants|threads|ingest|runs)": { target: process.env.VITE_BACKEND_URL...
opengpts/frontend/vite.config.ts/0
{ "file_path": "opengpts/frontend/vite.config.ts", "repo_id": "opengpts", "token_count": 207 }
2,000
from typing import Any from langchain_community.adapters import openai as lcopenai def _test_no_stream(**kwargs: Any) -> None: import openai result = openai.ChatCompletion.create(**kwargs) lc_result = lcopenai.ChatCompletion.create(**kwargs) if isinstance(lc_result, dict): if isinstance(resu...
langchain/libs/community/tests/integration_tests/adapters/test_openai.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/adapters/test_openai.py", "repo_id": "langchain", "token_count": 1424 }
316
import os import torch import torch.distributed from torch import nn from torch.nn import functional as F from typing import List from loguru import logger from functools import lru_cache HAS_BITS_AND_BYTES = True try: import bitsandbytes as bnb from bitsandbytes.nn import Int8Params, Params4bit except Import...
text-generation-inference/server/text_generation_server/utils/layers.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/layers.py", "repo_id": "text-generation-inference", "token_count": 18427 }
446
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/convnext/test_modeling_convnext.py/0
{ "file_path": "transformers/tests/models/convnext/test_modeling_convnext.py", "repo_id": "transformers", "token_count": 4658 }
791
"""Implements the ReAct paper from https://arxiv.org/pdf/2210.03629.pdf."""
langchain/libs/langchain/langchain/agents/react/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/react/__init__.py", "repo_id": "langchain", "token_count": 29 }
445
<!--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/distilbert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/distilbert.md", "repo_id": "transformers", "token_count": 4619 }
482