text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# coding=utf-8 # Copyright 2022 Microsoft Research 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/LICENS...
transformers/src/transformers/models/x_clip/modeling_x_clip.py/0
{ "file_path": "transformers/src/transformers/models/x_clip/modeling_x_clip.py", "repo_id": "transformers", "token_count": 30325 }
742
# DeeBERT: Early Exiting for *BERT This is the code base for the paper [DeeBERT: Dynamic Early Exiting for Accelerating BERT Inference](https://www.aclweb.org/anthology/2020.acl-main.204/), modified from its [original code base](https://github.com/castorini/deebert). The original code base also has information for do...
transformers/examples/research_projects/deebert/README.md/0
{ "file_path": "transformers/examples/research_projects/deebert/README.md", "repo_id": "transformers", "token_count": 621 }
582
/* eslint-disable @typescript-eslint/no-explicit-any */ import weaviate, { ApiKey } from "weaviate-ts-client"; import { WeaviateStore } from "@langchain/weaviate"; import { OpenAIEmbeddings } from "@langchain/openai"; export async function run() { // Something wrong with the weaviate-ts-client types, so we need to d...
langchainjs/examples/src/indexes/vector_stores/weaviate_fromTexts.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/weaviate_fromTexts.ts", "repo_id": "langchainjs", "token_count": 351 }
855
import math import os import time import itertools import torch import torch.distributed import numpy as np from loguru import logger from dataclasses import dataclass from opentelemetry import trace from transformers import PreTrainedTokenizerBase from typing import Optional, Tuple, List, Type, Dict from text_gener...
text-generation-inference/server/text_generation_server/models/flash_causal_lm.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/flash_causal_lm.py", "repo_id": "text-generation-inference", "token_count": 23536 }
429
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/trainer.md/0
{ "file_path": "transformers/docs/source/en/trainer.md", "repo_id": "transformers", "token_count": 5997 }
531
"""LlamaPack class.""" from typing import Any, Dict, List from llama_index.core import ServiceContext, VectorStoreIndex from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.core.bridge.pydantic import PrivateAttr from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.c...
llama_index/llama-index-packs/llama-index-packs-ollama-query-engine/llama_index/packs/ollama_query_engine/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-ollama-query-engine/llama_index/packs/ollama_query_engine/base.py", "repo_id": "llama_index", "token_count": 2043 }
1,666
// 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/DiskFileManagerImpl.cpp/0
{ "file_path": "milvus/internal/core/src/storage/DiskFileManagerImpl.cpp", "repo_id": "milvus", "token_count": 14540 }
1,743
# 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/adaption_prompt/layer.py/0
{ "file_path": "peft/src/peft/tuners/adaption_prompt/layer.py", "repo_id": "peft", "token_count": 2240 }
348
import { google, calendar_v3 } from "googleapis"; import type { JWT, GaxiosResponse } from "googleapis-common"; import { PromptTemplate } from "@langchain/core/prompts"; import { CallbackManagerForToolRun } from "@langchain/core/callbacks/manager"; import { BaseLLM } from "@langchain/core/language_models/llms"; import ...
langchainjs/libs/langchain-community/src/tools/google_calendar/commands/run-create-events.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/google_calendar/commands/run-create-events.ts", "repo_id": "langchainjs", "token_count": 1090 }
1,040
from rewrite_retrieve_read.chain import chain if __name__ == "__main__": chain.invoke("man that sam bankman fried trial was crazy! what is langchain?")
langchain/templates/rewrite-retrieve-read/main.py/0
{ "file_path": "langchain/templates/rewrite-retrieve-read/main.py", "repo_id": "langchain", "token_count": 48 }
697
import type * as tiktoken from "js-tiktoken"; import { Document, BaseDocumentTransformer } from "@langchain/core/documents"; import { getEncoding } from "@langchain/core/utils/tiktoken"; export interface TextSplitterParams { chunkSize: number; chunkOverlap: number; keepSeparator: boolean; lengthFunction?: ...
langchainjs/langchain/src/text_splitter.ts/0
{ "file_path": "langchainjs/langchain/src/text_splitter.ts", "repo_id": "langchainjs", "token_count": 9391 }
928
# Image Captioning (vision-encoder-text-decoder model) training example The following example showcases how to finetune a vision-encoder-text-decoder model for image captioning using the JAX/Flax backend, leveraging 🤗 Transformers library's [FlaxVisionEncoderDecoderModel](https://huggingface.co/docs/transformers/mode...
transformers/examples/flax/image-captioning/README.md/0
{ "file_path": "transformers/examples/flax/image-captioning/README.md", "repo_id": "transformers", "token_count": 1079 }
573
"""Use a single chain to route an input to one of multiple llm chains.""" from __future__ import annotations from typing import Any, Dict, List, Optional from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import PromptTemplate from langchain.chains import ConversationChain from ...
langchain/libs/langchain/langchain/chains/router/multi_prompt.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/router/multi_prompt.py", "repo_id": "langchain", "token_count": 890 }
492
# coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/siglip/convert_siglip_to_hf.py/0
{ "file_path": "transformers/src/transformers/models/siglip/convert_siglip_to_hf.py", "repo_id": "transformers", "token_count": 8771 }
730
"""Callback Handler streams to stdout on new llm token.""" from langchain_core.callbacks import StreamingStdOutCallbackHandler __all__ = ["StreamingStdOutCallbackHandler"]
langchain/libs/langchain/langchain/callbacks/streaming_stdout.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/streaming_stdout.py", "repo_id": "langchain", "token_count": 46 }
450
from .agc import adaptive_clip_grad from .checkpoint_saver import CheckpointSaver from .clip_grad import dispatch_clip_grad from .cuda import ApexScaler, NativeScaler from .decay_batch import decay_batch_step, check_batch_size_retry from .distributed import distribute_bn, reduce_tensor, init_distributed_device,\ wo...
pytorch-image-models/timm/utils/__init__.py/0
{ "file_path": "pytorch-image-models/timm/utils/__init__.py", "repo_id": "pytorch-image-models", "token_count": 252 }
353
# Athena reader. Athena reader allow execute SQL with AWS Athena. We using SQLAlchemy and PyAthena under the hood. ## Permissions WE HIGHLY RECOMMEND USING THIS LOADER WITH AWS EC2 IAM ROLE. ## Usage Here's an example usage of the AthenaReader. ``` import os import dotenv from llama_index import SQLDatabase,Servi...
llama_index/llama-index-integrations/readers/llama-index-readers-athena/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-athena/README.md", "repo_id": "llama_index", "token_count": 520 }
1,334
export { Agent, type AgentArgs, BaseSingleActionAgent, BaseMultiActionAgent, RunnableAgent, LLMSingleActionAgent, type LLMSingleActionAgentInput, type OutputParserArgs, } from "./agent.js"; export { JsonToolkit, OpenApiToolkit, RequestsToolkit, type VectorStoreInfo, VectorStoreRouterToolkit, ...
langchainjs/langchain/src/agents/index.ts/0
{ "file_path": "langchainjs/langchain/src/agents/index.ts", "repo_id": "langchainjs", "token_count": 858 }
850
import { Document } from "@langchain/core/documents"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { BaseDocumentLoader } from "../base.js"; const NOTION_BASE_URL = "https://api.notion.com/v1"; /** * Interface representing the parameters for the NotionDBLoader class. It * includes the ...
langchainjs/langchain/src/document_loaders/web/notiondb.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/web/notiondb.ts", "repo_id": "langchainjs", "token_count": 2891 }
899
import argparse import importlib import inspect import json import logging import os import re from pathlib import Path logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) # Base URL for all class documentation _BASE_URL = "https://api.python.langchain.com/en/latest/" # Regular expression to ...
langchain/docs/scripts/generate_api_reference_links.py/0
{ "file_path": "langchain/docs/scripts/generate_api_reference_links.py", "repo_id": "langchain", "token_count": 2849 }
202
from langchain_community.utilities.outline import ( OutlineAPIWrapper, ) __all__ = ["OutlineAPIWrapper"]
langchain/libs/langchain/langchain/utilities/outline.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/outline.py", "repo_id": "langchain", "token_count": 39 }
567
# How to propose a Flax/JAX + Transformers project Great that you've opened this document! While we at 🤗 are proposing a couple of projects, we strongly believe that the community can come up with much more **creative**, **fun**, and **impactful** projects on their own. This being said, we are really looking forw...
transformers/examples/research_projects/jax-projects/HOW_TO_PROPOSE_PROJECT.md/0
{ "file_path": "transformers/examples/research_projects/jax-projects/HOW_TO_PROPOSE_PROJECT.md", "repo_id": "transformers", "token_count": 2070 }
587
python_tests()
llama_index/llama-index-integrations/tools/llama-index-tools-salesforce/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-salesforce/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,495
# Copyright (c) Microsoft Corporation and HuggingFace # Licensed under the MIT License. from typing import Any, Dict, List, Mapping import numpy as np import torch from ...utils import is_cython_available, requires_backends if is_cython_available(): import pyximport pyximport.install(setup_args={"include_...
transformers/src/transformers/models/graphormer/collating_graphormer.py/0
{ "file_path": "transformers/src/transformers/models/graphormer/collating_graphormer.py", "repo_id": "transformers", "token_count": 2694 }
616
reviewers: - congqixia approvers: - maintainers
milvus/internal/types/OWNERS/0
{ "file_path": "milvus/internal/types/OWNERS", "repo_id": "milvus", "token_count": 22 }
1,933
# 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/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_inpainting.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_inpainting.py", "repo_id": "diffusers", "token_count": 11058 }
258
{ "textPrompt": { "value": "What would be a good name for a company that makes {{30E275F8-0B60-4E71-843D-9865F4D4EFD4:product:​}}?", "variables": [ { "variableId": "30E275F8-0B60-4E71-843D-9865F4D4EFD4", "displayName": "product" } ] }, "runSettings": { "temperature": 0....
langchainjs/langchain/src/experimental/hubs/makersuite/tests/googlemakersuite-files/textPrompt.json/0
{ "file_path": "langchainjs/langchain/src/experimental/hubs/makersuite/tests/googlemakersuite-files/textPrompt.json", "repo_id": "langchainjs", "token_count": 722 }
896
package storage import ( "fmt" "testing" "github.com/apache/arrow/go/v12/parquet/file" "github.com/stretchr/testify/suite" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" ) type ReadDataFromAllRowGroupsSuite struct { suite.Suite size int logData []byte reader *PayloadReader } func (s *ReadDataFro...
milvus/internal/storage/payload_reader_test.go/0
{ "file_path": "milvus/internal/storage/payload_reader_test.go", "repo_id": "milvus", "token_count": 738 }
1,794
from llama_index.packs.tables.chain_of_table.base import ChainOfTablePack from llama_index.packs.tables.mix_self_consistency.base import MixSelfConsistencyPack __all__ = ["ChainOfTablePack", "MixSelfConsistencyPack"]
llama_index/llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/__init__.py", "repo_id": "llama_index", "token_count": 72 }
1,822
import json from typing import Any, Callable, Dict, Optional from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator class GraphQLAPIWrapper(BaseModel): """Wrapper around GraphQL API. To use, you should have the ``gql`` python package installed. This wrapper will use the GraphQL API to c...
langchain/libs/community/langchain_community/utilities/graphql.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/graphql.py", "repo_id": "langchain", "token_count": 822 }
301
<jupyter_start><jupyter_text>Ray Serve[Ray Serve](https://docs.ray.io/en/latest/serve/index.html) is a scalable model serving library for building online inference APIs. Serve is particularly well suited for system composition, enabling you to build a complex inference service consisting of multiple chains and business...
langchain/docs/docs/integrations/providers/ray_serve.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/providers/ray_serve.ipynb", "repo_id": "langchain", "token_count": 1086 }
147
# LlamaIndex Vector_Stores Integration: Tencentvectordb
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-tencentvectordb/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-tencentvectordb/README.md", "repo_id": "llama_index", "token_count": 17 }
1,478
import logging from datetime import datetime as dt from typing import Optional, Type from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.pydantic_v1 import BaseModel, Field from langchain_community.tools.slack.base import SlackBaseTool from langchain_community.tools.slack.utils import U...
langchain/libs/community/langchain_community/tools/slack/schedule_message.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/slack/schedule_message.py", "repo_id": "langchain", "token_count": 796 }
295
use clap::{Parser, ValueEnum}; use nix::sys::signal::{self, Signal}; use nix::unistd::Pid; use serde::Deserialize; use std::env; use std::ffi::OsString; use std::io::{BufRead, BufReader, Lines}; use std::os::unix::process::{CommandExt, ExitStatusExt}; use std::path::Path; use std::process::{Child, Command, ExitStatus, ...
text-generation-inference/launcher/src/main.rs/0
{ "file_path": "text-generation-inference/launcher/src/main.rs", "repo_id": "text-generation-inference", "token_count": 19919 }
409
# 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/ia3/model.py/0
{ "file_path": "peft/src/peft/tuners/ia3/model.py", "repo_id": "peft", "token_count": 7197 }
318
""" .. warning:: Beta Feature! **Cache** provides an optional caching layer for LLMs. Cache is useful for two reasons: - It can save you money by reducing the number of API calls you make to the LLM provider if you're often requesting the same completion multiple times. - It can speed up your application by redu...
langchain/libs/community/langchain_community/cache.py/0
{ "file_path": "langchain/libs/community/langchain_community/cache.py", "repo_id": "langchain", "token_count": 30860 }
228
"""Test Alibaba Tongyi Chat Model.""" from langchain_core.callbacks import CallbackManager from langchain_core.messages import AIMessage, BaseMessage, HumanMessage from langchain_core.outputs import ChatGeneration, LLMResult from langchain_core.pydantic_v1 import SecretStr from pytest import CaptureFixture from langc...
langchain/libs/community/tests/integration_tests/chat_models/test_tongyi.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/chat_models/test_tongyi.py", "repo_id": "langchain", "token_count": 1049 }
320
import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager"; import { LLM, type BaseLLMCallOptions, type BaseLLMParams, } from "@langchain/core/language_models/llms"; import { GenerationChunk } from "@langchain/core/outputs"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; imp...
langchainjs/libs/langchain-community/src/llms/togetherai.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/llms/togetherai.ts", "repo_id": "langchainjs", "token_count": 2890 }
987
"""Test the cohere reranker.""" from langchain.retrievers.document_compressors.cohere_rerank import CohereRerank def test_cohere_reranker_init() -> None: """Test the cohere reranker initializes correctly.""" CohereRerank()
langchain/libs/langchain/tests/integration_tests/retrievers/document_compressors/test_cohere_reranker.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/retrievers/document_compressors/test_cohere_reranker.py", "repo_id": "langchain", "token_count": 82 }
587
"""Test building the Zapier tool, not running it.""" from unittest.mock import MagicMock, patch import pytest import requests from langchain_community.tools.zapier.prompt import BASE_ZAPIER_TOOL_PROMPT from langchain_community.tools.zapier.tool import ZapierNLARunAction from langchain_community.utilities.zapier impor...
langchain/libs/community/tests/unit_tests/tools/test_zapier.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/tools/test_zapier.py", "repo_id": "langchain", "token_count": 4089 }
405
# coding=utf-8 # Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
transformers/tests/models/camembert/test_modeling_tf_camembert.py/0
{ "file_path": "transformers/tests/models/camembert/test_modeling_tf_camembert.py", "repo_id": "transformers", "token_count": 783 }
804
import { ChatOpenAI } from "@langchain/openai"; import { initializeAgentExecutorWithOptions } from "langchain/agents"; import { Calculator } from "langchain/tools/calculator"; import { BufferMemory } from "langchain/memory"; import { MessagesPlaceholder } from "@langchain/core/prompts"; export const run = async () => ...
langchainjs/examples/src/agents/structured_chat_with_memory.ts/0
{ "file_path": "langchainjs/examples/src/agents/structured_chat_with_memory.ts", "repo_id": "langchainjs", "token_count": 403 }
770
"""SQL Container builder.""" from typing import Any, Dict, List, Optional, Type from llama_index.legacy.indices.base import BaseIndex from llama_index.legacy.indices.common.struct_store.base import ( SQLDocumentContextBuilder, ) from llama_index.legacy.indices.common.struct_store.schema import SQLContextContainer...
llama_index/llama-index-legacy/llama_index/legacy/indices/struct_store/container_builder.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/struct_store/container_builder.py", "repo_id": "llama_index", "token_count": 2413 }
1,722
# coding=utf-8 # Copyright 2020 Google 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 re...
transformers/src/transformers/models/tapas/configuration_tapas.py/0
{ "file_path": "transformers/src/transformers/models/tapas/configuration_tapas.py", "repo_id": "transformers", "token_count": 4873 }
753
from langchain_community.storage.redis import RedisStore __all__ = ["RedisStore"]
langchain/libs/langchain/langchain/storage/redis.py/0
{ "file_path": "langchain/libs/langchain/langchain/storage/redis.py", "repo_id": "langchain", "token_count": 26 }
545
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,472
from langchain_community.tools.metaphor_search.tool import MetaphorSearchResults __all__ = ["MetaphorSearchResults"]
langchain/libs/langchain/langchain/tools/metaphor_search/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/metaphor_search/tool.py", "repo_id": "langchain", "token_count": 35 }
606
<!--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/schedulers/multistep_dpm_solver.md/0
{ "file_path": "diffusers/docs/source/en/api/schedulers/multistep_dpm_solver.md", "repo_id": "diffusers", "token_count": 599 }
192
"""monday.com reader.""" from typing import Dict, List import requests from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class MondayReader(BaseReader): """monday.com reader. Reads board's data by a GraphQL query. Args: api_key (str): monday.com API ke...
llama_index/llama-index-integrations/readers/llama-index-readers-mondaydotcom/llama_index/readers/mondaydotcom/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mondaydotcom/llama_index/readers/mondaydotcom/base.py", "repo_id": "llama_index", "token_count": 1381 }
1,405
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises"; afterAll(awaitAllCallbacks);
langchainjs/libs/langchain-openai/scripts/jest-setup-after-env.js/0
{ "file_path": "langchainjs/libs/langchain-openai/scripts/jest-setup-after-env.js", "repo_id": "langchainjs", "token_count": 32 }
1,104
from llama_index.llms.nvidia_triton.base import NvidiaTriton __all__ = ["NvidiaTriton"]
llama_index/llama-index-integrations/llms/llama-index-llms-nvidia-triton/llama_index/llms/nvidia_triton/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-nvidia-triton/llama_index/llms/nvidia_triton/__init__.py", "repo_id": "llama_index", "token_count": 36 }
1,307
from typing import TYPE_CHECKING, Optional, Type from langchain_core.callbacks import ( CallbackManagerForToolRun, ) from langchain_core.pydantic_v1 import BaseModel, Field from langchain_core.tools import BaseTool if TYPE_CHECKING: # This is for linting and IDE typehints import multion else: try: ...
langchain/libs/community/langchain_community/tools/multion/create_session.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/multion/create_session.py", "repo_id": "langchain", "token_count": 829 }
288
package storage import ( "context" "github.com/cockroachdb/errors" "github.com/milvus-io/milvus/pkg/util/paramtable" ) type ChunkManagerFactory struct { persistentStorage string config *config } func NewChunkManagerFactoryWithParam(params *paramtable.ComponentParam) *ChunkManagerFactory { if param...
milvus/internal/storage/factory.go/0
{ "file_path": "milvus/internal/storage/factory.go", "repo_id": "milvus", "token_count": 777 }
1,792
<!--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/ja/model_doc/altclip.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/altclip.md", "repo_id": "transformers", "token_count": 2400 }
516
# Adversarial Inception v3 **Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifer](https://paper...
pytorch-image-models/hfdocs/source/models/adversarial-inception-v3.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/adversarial-inception-v3.mdx", "repo_id": "pytorch-image-models", "token_count": 2247 }
359
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/pkg/util/interceptor/cluster_interceptor_test.go/0
{ "file_path": "milvus/pkg/util/interceptor/cluster_interceptor_test.go", "repo_id": "milvus", "token_count": 1649 }
1,973
{ "name": "@langchain/anthropic", "version": "0.0.10", "description": "Anthropic integrations for LangChain.js", "type": "module", "engines": { "node": ">=18" }, "main": "./index.js", "types": "./index.d.ts", "repository": { "type": "git", "url": "git@github.com:langchain-ai/langchainjs.gi...
langchainjs/libs/langchain-anthropic/package.json/0
{ "file_path": "langchainjs/libs/langchain-anthropic/package.json", "repo_id": "langchainjs", "token_count": 1690 }
987
# Xata [Xata](https://xata.io) is a serverless data platform, based on PostgreSQL. It provides a type-safe TypeScript/JavaScript SDK for interacting with your database, and a UI for managing your data. Xata has a native vector type, which can be added to any table, and supports similarity search. LangChain inserts ve...
langchainjs/docs/core_docs/docs/integrations/vectorstores/xata.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/vectorstores/xata.mdx", "repo_id": "langchainjs", "token_count": 748 }
777
#!/usr/bin/env python # coding: utf-8 # Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
transformers/scripts/fsmt/fsmt-make-tiny-model.py/0
{ "file_path": "transformers/scripts/fsmt/fsmt-make-tiny-model.py", "repo_id": "transformers", "token_count": 704 }
587
# Index Stores Index stores contains lightweight index metadata (i.e. additional state information created when building an index). See the [API Reference](/api_reference/storage/index_store.rst) for more details. ### Simple Index Store By default, LlamaIndex uses a simple index store backed by an in-memory key-val...
llama_index/docs/module_guides/storing/index_stores.md/0
{ "file_path": "llama_index/docs/module_guides/storing/index_stores.md", "repo_id": "llama_index", "token_count": 890 }
1,232
# Git >[Git](https://en.wikipedia.org/wiki/Git) is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers collaboratively developing source code during software development. ## Installation and Setup First, you need to install `GitP...
langchain/docs/docs/integrations/providers/git.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/git.mdx", "repo_id": "langchain", "token_count": 139 }
136
from typing import Any, Iterator, List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader class GeoDataFrameLoader(BaseLoader): """Load `geopandas` Dataframe.""" def __init__(self, data_frame: Any, page_content_column: str = "geometry"): "...
langchain/libs/community/langchain_community/document_loaders/geodataframe.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/geodataframe.py", "repo_id": "langchain", "token_count": 1126 }
232
# 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...
trl/trl/trainer/iterative_sft_trainer.py/0
{ "file_path": "trl/trl/trainer/iterative_sft_trainer.py", "repo_id": "trl", "token_count": 7430 }
865
# 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/src/diffusers/models/unets/unet_kandinsky3.py/0
{ "file_path": "diffusers/src/diffusers/models/unets/unet_kandinsky3.py", "repo_id": "diffusers", "token_count": 9647 }
216
from langchain_community.document_loaders import BiliBiliLoader def test_bilibili_loader() -> None: """Test Bilibili Loader.""" loader = BiliBiliLoader( [ "https://www.bilibili.com/video/BV1xt411o7Xu/", "https://www.bilibili.com/video/av330407025/", ] ) docs = l...
langchain/libs/community/tests/integration_tests/document_loaders/test_bilibili.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_bilibili.py", "repo_id": "langchain", "token_count": 243 }
322
import warnings from diffusers import StableDiffusionImg2ImgPipeline # noqa F401 warnings.warn( "The `image_to_image.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionImg2ImgPipeline` instead." )
diffusers/examples/inference/image_to_image.py/0
{ "file_path": "diffusers/examples/inference/image_to_image.py", "repo_id": "diffusers", "token_count": 84 }
193
from llama_index.readers.file.paged_csv.base import ( PagedCSVReader, ) __all__ = ["PagedCSVReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/paged_csv/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/paged_csv/__init__.py", "repo_id": "llama_index", "token_count": 45 }
1,439
# LlamaHub Our data connectors are offered through [LlamaHub](https://llamahub.ai/) 🦙. LlamaHub contains a registry of open-source data connectors that you can easily plug into any LlamaIndex application (+ Agent Tools, and Llama Packs). ![](/_static/data_connectors/llamahub.png) ## Usage Pattern Get started with:...
llama_index/docs/understanding/loading/llamahub.md/0
{ "file_path": "llama_index/docs/understanding/loading/llamahub.md", "repo_id": "llama_index", "token_count": 468 }
1,235
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
text-generation-inference/server/text_generation_server/models/custom_modeling/flash_mixtral_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_mixtral_modeling.py", "repo_id": "text-generation-inference", "token_count": 14039 }
440
# serializer version: 1 # name: test_person ''' { "lc": 1, "type": "constructor", "id": [ "tests", "unit_tests", "load", "test_dump", "Person" ], "kwargs": { "secret": { "lc": 1, "type": "secret", "id": [ "SECRET" ] ...
langchain/libs/langchain/tests/unit_tests/load/__snapshots__/test_dump.ambr/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/load/__snapshots__/test_dump.ambr", "repo_id": "langchain", "token_count": 3462 }
642
package funcutil /* type aggFunc[T constraints.Ordered] func(t1, t2 T) T func agg[T constraints.Ordered](op aggFunc[T], s ...T) T { l := len(s) if l <= 0 { var zero T return zero } m := s[0] for i := 1; i < l; i++ { m = op(s[i], m) } return m } func getMin[T constraints.Ordered](t1, t2 T) T { if t1 < t...
milvus/pkg/util/funcutil/aggregation.go/0
{ "file_path": "milvus/pkg/util/funcutil/aggregation.go", "repo_id": "milvus", "token_count": 352 }
2,050
"""Azure Cognitive Services Tools.""" from langchain_community.tools.azure_cognitive_services.form_recognizer import ( AzureCogsFormRecognizerTool, ) from langchain_community.tools.azure_cognitive_services.image_analysis import ( AzureCogsImageAnalysisTool, ) from langchain_community.tools.azure_cognitive_serv...
langchain/libs/community/langchain_community/tools/azure_cognitive_services/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/azure_cognitive_services/__init__.py", "repo_id": "langchain", "token_count": 279 }
278
import { Client as PlanetScaleClient, Config as PlanetScaleConfig, Connection as PlanetScaleConnection, } from "@planetscale/database"; import { BaseListChatMessageHistory } from "@langchain/core/chat_history"; import { BaseMessage, StoredMessage, StoredMessageData, mapChatMessagesToStoredMessages, mapS...
langchainjs/libs/langchain-community/src/stores/message/planetscale.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/stores/message/planetscale.ts", "repo_id": "langchainjs", "token_count": 2042 }
1,011
use std::collections::LinkedList; use tantivy::{ collector::{Collector, SegmentCollector}, DocId, }; pub struct LinkedListCollector; impl Collector for LinkedListCollector { type Fruit = LinkedList<DocId>; type Child = LinkedListChildCollector; fn for_segment( &self, _segment_lo...
milvus/internal/core/thirdparty/tantivy/tantivy-binding/src/linkedlist_collector.rs/0
{ "file_path": "milvus/internal/core/thirdparty/tantivy/tantivy-binding/src/linkedlist_collector.rs", "repo_id": "milvus", "token_count": 670 }
1,949
_type: prompt input_variables: ["adjective", "content"] template: Tell me a {adjective} joke about {content}.
langchain/docs/docs/modules/model_io/prompts/simple_prompt.yaml/0
{ "file_path": "langchain/docs/docs/modules/model_io/prompts/simple_prompt.yaml", "repo_id": "langchain", "token_count": 44 }
216
import pytest from text_generation import ( InferenceAPIClient, InferenceAPIAsyncClient, Client, AsyncClient, ) from text_generation.errors import NotSupportedError, NotFoundError from text_generation.inference_api import check_model_support, deployed_models def test_check_model_support(flan_t5_xxl, ...
text-generation-inference/clients/python/tests/test_inference_api.py/0
{ "file_path": "text-generation-inference/clients/python/tests/test_inference_api.py", "repo_id": "text-generation-inference", "token_count": 411 }
379
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base"; import { z } from "zod"; import { interpolateFString, PromptTemplate } from "@langchain/core/prompts"; import { MultiRouteChain, MultiRouteChainInput } from "./multi_route.js"; import { STRUCTURED_MULTI_PROMPT_ROUTER_TEMPLATE } from...
langchainjs/langchain/src/chains/router/multi_prompt.ts/0
{ "file_path": "langchainjs/langchain/src/chains/router/multi_prompt.ts", "repo_id": "langchainjs", "token_count": 2104 }
908
// 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/flowgraph/input_node_test.go/0
{ "file_path": "milvus/internal/util/flowgraph/input_node_test.go", "repo_id": "milvus", "token_count": 1728 }
2,071
"""Wikipedia API toolkit."""
langchain/libs/langchain/langchain/tools/wikipedia/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/wikipedia/__init__.py", "repo_id": "langchain", "token_count": 8 }
592
#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail set -o xtrace SCRIPT_DIR="$(cd "$(dirname "$0")"; pwd)" cd "${SCRIPT_DIR}" mkdir -p ../_dist rsync -ruv --exclude node_modules --exclude api_reference --exclude .venv --exclude .docusaurus . ../_dist cd ../_dist poetry run python scripts/model_feat_ta...
langchain/docs/.local_build.sh/0
{ "file_path": "langchain/docs/.local_build.sh", "repo_id": "langchain", "token_count": 279 }
83
diff --git a/lib/parser.js b/lib/parser.js index 43e4aff85acc56f5360f80b639062157e64b61c1..23d3e7b37004f6b8787d14cbe4704bc626ac526f 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -46,8 +46,7 @@ function parseTreeRecursive(context, request, options, output, resolve) { node.expression.kind === typescr...
langchainjs/.yarn/patches/dpdm-npm-3.12.0-0dfdd8e3b8.patch/0
{ "file_path": "langchainjs/.yarn/patches/dpdm-npm-3.12.0-0dfdd8e3b8.patch", "repo_id": "langchainjs", "token_count": 982 }
713
import argparse import os import torch from torchvision.datasets.utils import download_url from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, Transformer2DModel pretrained_models = {512: "DiT-XL-2-512x512.pt", 256: "DiT-XL-2-256x256.pt"} def download_model(model_name): """ Downloads a pre-tr...
diffusers/scripts/convert_dit_to_diffusers.py/0
{ "file_path": "diffusers/scripts/convert_dit_to_diffusers.py", "repo_id": "diffusers", "token_count": 3037 }
230
# Storing Once you have data [loaded](/understanding/loading/loading.md) and [indexed](/understanding/indexing/indexing.md), you will probably want to store it to avoid the time and cost of re-indexing it. By default, your indexed data is stored only in memory. ## Persisting to disk The simplest way to store your in...
llama_index/docs/understanding/storing/storing.md/0
{ "file_path": "llama_index/docs/understanding/storing/storing.md", "repo_id": "llama_index", "token_count": 1404 }
1,110
"""General node utils.""" import logging import uuid from typing import List, Optional, Protocol, runtime_checkable from llama_index.legacy.schema import ( BaseNode, Document, ImageDocument, ImageNode, NodeRelationship, TextNode, ) from llama_index.legacy.utils import truncate_text logger = l...
llama_index/llama-index-legacy/llama_index/legacy/node_parser/node_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/node_parser/node_utils.py", "repo_id": "llama_index", "token_count": 1507 }
1,743
mod utils; use tokenizers::models::bpe::{Vocab, BPE}; use tokenizers::Tokenizer; use wasm_bindgen::prelude::*; // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator. #[cfg(feature = "wee_alloc")] #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; #[was...
tokenizers/tokenizers/examples/unstable_wasm/src/lib.rs/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/src/lib.rs", "repo_id": "tokenizers", "token_count": 543 }
472
python_tests()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-azure-openai/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-azure-openai/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,353
export interface ConvSidebar { id: string; title: string; updatedAt: Date; model?: string; assistantId?: string; avatarHash?: string; }
chat-ui/src/lib/types/ConvSidebar.ts/0
{ "file_path": "chat-ui/src/lib/types/ConvSidebar.ts", "repo_id": "chat-ui", "token_count": 50 }
100
import json import hashlib class Env: """ { "_version": "0.1", "_type": "env", "server_config": dict, "OMP_NUM_THREADS": string, } """ def __init__(self, server_config=None, omp_num_threads=None): self._version = '0.1' self._type = 'env' sel...
milvus/tests/benchmark/milvus_benchmark/metrics/models/env.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/metrics/models/env.py", "repo_id": "milvus", "token_count": 271 }
2,134
# 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/mixed_model.py/0
{ "file_path": "peft/src/peft/mixed_model.py", "repo_id": "peft", "token_count": 6613 }
333
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/tools/llama-index-tools-python-file/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-python-file/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,433
<!--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/lora.md/0
{ "file_path": "diffusers/docs/source/en/api/loaders/lora.md", "repo_id": "diffusers", "token_count": 463 }
174
<jupyter_start><jupyter_text>Google SearchThis notebook goes over how to use the google search component.First, you need to set up the proper API keys and environment variables. To set it up, create the GOOGLE_API_KEY in the Google Cloud credential console (https://console.cloud.google.com/apis/credentials) and a GOOGL...
langchain/docs/docs/integrations/tools/google_search.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/google_search.ipynb", "repo_id": "langchain", "token_count": 578 }
174
<jupyter_start><jupyter_text>TwilioThis notebook goes over how to use the [Twilio](https://www.twilio.com) API wrapper to send a message through SMS or [Twilio Messaging Channels](https://www.twilio.com/docs/messaging/channels).Twilio Messaging Channels facilitates integrations with 3rd party messaging apps and lets yo...
langchain/docs/docs/integrations/tools/twilio.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/twilio.ipynb", "repo_id": "langchain", "token_count": 598 }
187
<script lang="ts"> export let classNames = ""; </script> <svg class={classNames} xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32" > <path d="M28,10V28H10V10H28m0-2H10a2,2...
chat-ui/src/lib/components/icons/IconCopy.svelte/0
{ "file_path": "chat-ui/src/lib/components/icons/IconCopy.svelte", "repo_id": "chat-ui", "token_count": 299 }
99
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/utils/update_tiny_models.py/0
{ "file_path": "transformers/utils/update_tiny_models.py", "repo_id": "transformers", "token_count": 3072 }
849
# 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/src/diffusers/models/unet_1d_blocks.py/0
{ "file_path": "diffusers/src/diffusers/models/unet_1d_blocks.py", "repo_id": "diffusers", "token_count": 3632 }
226
package datacoord import ( "fmt" "github.com/samber/lo" "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" "github.com/milvus-io/milvus/pkg/util/paramtable" ) // The LevelZeroSegments keeps the min group type LevelZeroSegmentsView struct { label *CompactionGroupLabel segments ...
milvus/internal/datacoord/compaction_l0_view.go/0
{ "file_path": "milvus/internal/datacoord/compaction_l0_view.go", "repo_id": "milvus", "token_count": 1614 }
1,790
# coding=utf-8 # Copyright 2023 The Intel Labs Team Authors, The Microsoft Research Team Authors and 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 a...
transformers/tests/models/bridgetower/test_modeling_bridgetower.py/0
{ "file_path": "transformers/tests/models/bridgetower/test_modeling_bridgetower.py", "repo_id": "transformers", "token_count": 11285 }
787
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-mangoapps-guides/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mangoapps-guides/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,517
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises"; await awaitAllCallbacks();
langchainjs/examples/src/callbacks/background_await.ts/0
{ "file_path": "langchainjs/examples/src/callbacks/background_await.ts", "repo_id": "langchainjs", "token_count": 30 }
787