text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# Copyright (c) 2022 Dominic Rampas MIT License # 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/licen...
diffusers/src/diffusers/pipelines/wuerstchen/modeling_paella_vq_model.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/wuerstchen/modeling_paella_vq_model.py", "repo_id": "diffusers", "token_count": 3046 }
262
<jupyter_start><jupyter_text>Analyze a single long documentThe AnalyzeDocumentChain takes in a single document, splits it up, and then runs it through a CombineDocumentsChain.<jupyter_code>with open("../docs/docs/modules/state_of_the_union.txt") as f: state_of_the_union = f.read() from langchain.chains import Analy...
langchain/cookbook/analyze_document.ipynb/0
{ "file_path": "langchain/cookbook/analyze_document.ipynb", "repo_id": "langchain", "token_count": 259 }
69
from __future__ import annotations import logging from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Optional from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models.llms import LLM from langchain_core.outputs import GenerationChunk from langchain_core.pydantic_v1 i...
langchain/libs/community/langchain_community/llms/replicate.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/replicate.py", "repo_id": "langchain", "token_count": 3618 }
273
# Opensearch Loader The Opensearch Loader returns a set of texts corresponding to documents retrieved from an Opensearch index. The user initializes the loader with an Opensearch index. They then pass in a field, and optionally a JSON query DSL object to fetch the fields they want. ## Usage Here's an example usage o...
llama_index/llama-index-integrations/readers/llama-index-readers-opensearch/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-opensearch/README.md", "repo_id": "llama_index", "token_count": 339 }
1,360
<!--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/pegasus.md/0
{ "file_path": "transformers/docs/source/en/model_doc/pegasus.md", "repo_id": "transformers", "token_count": 1966 }
513
# RetrievalQA This example shows how to expose a RetrievalQA chain as a ChatGPTPlugin. Step 1: Ingest documents. To run the example, run `python ingest.py` Step 2: Make any modifications to `chain.py` as you see fit (changing prompts, etc.) Step 3: Make any changes to `constants.py` as you see fit (this is where yo...
langchain-aiplugin/retrieval_qa/README.md/0
{ "file_path": "langchain-aiplugin/retrieval_qa/README.md", "repo_id": "langchain-aiplugin", "token_count": 105 }
65
from llama_index.llms.neutrino.base import Neutrino __all__ = ["Neutrino"]
llama_index/llama-index-integrations/llms/llama-index-llms-neutrino/llama_index/llms/neutrino/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-neutrino/llama_index/llms/neutrino/__init__.py", "repo_id": "llama_index", "token_count": 33 }
1,317
import logging from importlib.metadata import version from types import ModuleType from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Type import openai from packaging.version import parse from tenacity import ( before_sleep_log, retry, retry_if_exception_type, stop_after_attempt,...
llama_index/llama-index-legacy/llama_index/legacy/llms/konko_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/konko_utils.py", "repo_id": "llama_index", "token_count": 3160 }
1,574
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/perf_train_gpu_many.md/0
{ "file_path": "transformers/docs/source/ja/perf_train_gpu_many.md", "repo_id": "transformers", "token_count": 18207 }
551
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # 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 ag...
diffusers/tests/pipelines/kandinsky2_2/test_kandinsky_combined.py/0
{ "file_path": "diffusers/tests/pipelines/kandinsky2_2/test_kandinsky_combined.py", "repo_id": "diffusers", "token_count": 6108 }
290
engine-strict=true
chat-ui/.npmrc/0
{ "file_path": "chat-ui/.npmrc", "repo_id": "chat-ui", "token_count": 7 }
89
--- sidebar_position: 4 title: Adding memory hide_table_of_contents: true --- # Adding memory This shows how to add memory to an arbitrary chain. Right now, you can use the memory classes but need to hook them up manually. <details> <summary>Interactive tutorial</summary> The screencast below interactively walks...
langchainjs/docs/core_docs/docs/expression_language/cookbook/adding_memory.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/expression_language/cookbook/adding_memory.mdx", "repo_id": "langchainjs", "token_count": 304 }
724
<jupyter_start><jupyter_text>Efficient Large Language Model training with LoRA and Hugging FaceIn this sagemaker example, we are going to learn how to apply [Low-Rank Adaptation of Large Language Models (LoRA)](https://arxiv.org/abs/2106.09685) to fine-tune BLOOMZ (7 billion parameter version instruction tuned version ...
notebooks/sagemaker/24_train_bloom_peft_lora/sagemaker-notebook.ipynb/0
{ "file_path": "notebooks/sagemaker/24_train_bloom_peft_lora/sagemaker-notebook.ipynb", "repo_id": "notebooks", "token_count": 4824 }
315
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "prompts", newEntrypointName: "prompts", newPackageName: "@langchain/core", }); export { BasePromptTemplate, type BasePromptTemplateInput, StringPromptValue...
langchainjs/langchain/src/prompts/index.ts/0
{ "file_path": "langchainjs/langchain/src/prompts/index.ts", "repo_id": "langchainjs", "token_count": 507 }
900
from llama_index.extractors.marvin.base import MarvinMetadataExtractor __all__ = ["MarvinMetadataExtractor"]
llama_index/llama-index-integrations/extractors/llama-index-extractors-marvin/llama_index/extractors/marvin/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/extractors/llama-index-extractors-marvin/llama_index/extractors/marvin/__init__.py", "repo_id": "llama_index", "token_count": 35 }
1,262
<!--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...
peft/docs/source/install.md/0
{ "file_path": "peft/docs/source/install.md", "repo_id": "peft", "token_count": 436 }
335
from importlib import import_module from .logging import get_logger logger = get_logger(__name__) class _PatchedModuleObj: """Set all the modules components as attributes of the _PatchedModuleObj object.""" def __init__(self, module, attrs=None): attrs = attrs or [] if module is not None: ...
datasets/src/datasets/utils/patching.py/0
{ "file_path": "datasets/src/datasets/utils/patching.py", "repo_id": "datasets", "token_count": 2222 }
136
# rag-aws-bedrock This template is designed to connect with the AWS Bedrock service, a managed server that offers a set of foundation models. It primarily uses the `Anthropic Claude` for text generation and `Amazon Titan` for text embedding, and utilizes FAISS as the vectorstore. For additional context on the RAG p...
langchain/templates/rag-aws-bedrock/README.md/0
{ "file_path": "langchain/templates/rag-aws-bedrock/README.md", "repo_id": "langchain", "token_count": 804 }
725
import { NodeHandler } from "./base.js"; import { ArrayLiteralExpressionHandler } from "./array_literal_expression_handler.js"; import { BooleanLiteralHandler } from "./boolean_literal_handler.js"; import { CallExpressionHandler } from "./call_expression_handler.js"; import { NumericLiteralHandler } from "./numeric_lit...
langchainjs/langchain/src/output_parsers/expression_type_handlers/factory.ts/0
{ "file_path": "langchainjs/langchain/src/output_parsers/expression_type_handlers/factory.ts", "repo_id": "langchainjs", "token_count": 790 }
936
# coding=utf-8 # Copyright 2022 {{cookiecutter.authors}} 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/lice...
transformers/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/modeling_tf_{{cookiecutter.lowercase_modelname}}.py/0
{ "file_path": "transformers/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/modeling_tf_{{cookiecutter.lowercase_modelname}}.py", "repo_id": "transformers", "token_count": 57175 }
699
# 여러 GPU를 사용한 분산 추론 분산 설정에서는 여러 개의 프롬프트를 동시에 생성할 때 유용한 🤗 [Accelerate](https://huggingface.co/docs/accelerate/index) 또는 [PyTorch Distributed](https://pytorch.org/tutorials/beginner/dist_overview.html)를 사용하여 여러 GPU에서 추론을 실행할 수 있습니다. 이 가이드에서는 분산 추론을 위해 🤗 Accelerate와 PyTorch Distributed를 사용하는 방법을 보여드립니다. ## 🤗 Acceler...
diffusers/docs/source/ko/training/distributed_inference.md/0
{ "file_path": "diffusers/docs/source/ko/training/distributed_inference.md", "repo_id": "diffusers", "token_count": 2604 }
197
"""Test pydantic output parser.""" import pytest from llama_index.legacy.bridge.pydantic import BaseModel from llama_index.legacy.output_parsers.pydantic import PydanticOutputParser class AttrDict(BaseModel): test_attr: str foo: int class TestModel(BaseModel): __test__ = False title: str attr_d...
llama_index/llama-index-legacy/tests/output_parsers/test_pydantic.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/output_parsers/test_pydantic.py", "repo_id": "llama_index", "token_count": 527 }
1,674
"""Test BigQuery Vector Search. In order to run this test, you need to install Google Cloud BigQuery SDK pip install google-cloud-bigquery Your end-user credentials would be used to make the calls (make sure you've run `gcloud auth login` first). """ import os import uuid import pytest from langchain_community.vecto...
langchain/libs/community/tests/integration_tests/vectorstores/test_bigquery_vector_search.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_bigquery_vector_search.py", "repo_id": "langchain", "token_count": 1284 }
356
<jupyter_start><jupyter_text>OpenAI Agent + Query Engine Experimental CookbookIn this notebook, we try out the OpenAIAgent across a variety of query engine tools and datasets. We explore how OpenAIAgent can compare/replace existing workflows solved by our retrievers/query engines.- Auto retrieval - Joint SQL and vector...
llama_index/docs/examples/agent/openai_agent_query_cookbook.ipynb/0
{ "file_path": "llama_index/docs/examples/agent/openai_agent_query_cookbook.ipynb", "repo_id": "llama_index", "token_count": 5567 }
1,042
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datanode/syncmgr/task.go/0
{ "file_path": "milvus/internal/datanode/syncmgr/task.go", "repo_id": "milvus", "token_count": 4523 }
1,709
# Dual Path Network (DPN) A **Dual Path Network (DPN)** is a convolutional neural network which presents a new topology of connection paths internally. The intuition is that [ResNets](https://paperswithcode.com/method/resnet) enables feature re-usage while DenseNet enables new feature exploration, and both are importa...
pytorch-image-models/docs/models/.templates/models/dpn.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/dpn.md", "repo_id": "pytorch-image-models", "token_count": 2889 }
315
// 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/core/src/query/PlanProto.h/0
{ "file_path": "milvus/internal/core/src/query/PlanProto.h", "repo_id": "milvus", "token_count": 1838 }
1,792
from langchain_community.agent_toolkits.steam.toolkit import SteamToolkit __all__ = ["SteamToolkit"]
langchain/libs/langchain/langchain/agents/agent_toolkits/steam/toolkit.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/steam/toolkit.py", "repo_id": "langchain", "token_count": 32 }
470
# flake8: noqa from langchain_core.prompts import PromptTemplate SONG_DATA_SOURCE = """\ ```json {{ "content": "Lyrics of a song", "attributes": {{ "artist": {{ "type": "string", "description": "Name of the song artist" }}, "length": {{ "type": "integ...
langchain/libs/langchain/langchain/chains/query_constructor/prompt.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/query_constructor/prompt.py", "repo_id": "langchain", "token_count": 2273 }
488
# coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers/scripts/convert_original_audioldm_to_diffusers.py/0
{ "file_path": "diffusers/scripts/convert_original_audioldm_to_diffusers.py", "repo_id": "diffusers", "token_count": 19401 }
235
# coding=utf-8 # Copyright 2022 HuggingFace Inc. # # 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 ag...
transformers/tests/models/markuplm/test_feature_extraction_markuplm.py/0
{ "file_path": "transformers/tests/models/markuplm/test_feature_extraction_markuplm.py", "repo_id": "transformers", "token_count": 1485 }
736
from langchain_community.document_loaders.gutenberg import GutenbergLoader __all__ = ["GutenbergLoader"]
langchain/libs/langchain/langchain/document_loaders/gutenberg.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/gutenberg.py", "repo_id": "langchain", "token_count": 28 }
485
from typing import Dict, Tuple from langchain.chains.query_constructor.ir import ( Comparator, Comparison, Operation, Operator, StructuredQuery, ) from langchain.retrievers.self_query.elasticsearch import ElasticsearchTranslator DEFAULT_TRANSLATOR = ElasticsearchTranslator() def test_visit_compa...
langchain/libs/langchain/tests/unit_tests/retrievers/self_query/test_elasticsearch.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/retrievers/self_query/test_elasticsearch.py", "repo_id": "langchain", "token_count": 5859 }
630
import { PromptTemplate } from "@langchain/core/prompts"; const template = `You are assessing a submitted answer on a given task or input based on a set of criteria. Here is the data: [BEGIN DATA] *** [Input]: {input} *** [Submission]: {output} *** [Criteria]: {criteria} *** [END DATA] Does the submission meet the Cri...
langchainjs/langchain/src/evaluation/criteria/prompt.ts/0
{ "file_path": "langchainjs/langchain/src/evaluation/criteria/prompt.ts", "repo_id": "langchainjs", "token_count": 470 }
932
# Auto-fixing parser This output parser wraps another output parser, and in the event that the first one fails it calls out to another LLM to fix any errors. But we can do other things besides throw errors. Specifically, we can pass the misformatted output, along with the formatted instructions, to the model and ask ...
langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/types/output_fixing.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/types/output_fixing.mdx", "repo_id": "langchainjs", "token_count": 220 }
751
<jupyter_start><jupyter_text>RetrievalQA Chain[](https://colab.research.google.com/github/langchain-ai/langsmith-cookbook/blob/main/hub-examples/retrieval-qa-chain/retrieval-qa.ipynb)Developing a production-grade LLM application requires many refinements, but tracking multiple versions of prompts, models, and other com...
langsmith-cookbook/hub-examples/retrieval-qa-chain/retrieval-qa.ipynb/0
{ "file_path": "langsmith-cookbook/hub-examples/retrieval-qa-chain/retrieval-qa.ipynb", "repo_id": "langsmith-cookbook", "token_count": 2113 }
1,039
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/sam/image_processing_sam.py/0
{ "file_path": "transformers/src/transformers/models/sam/image_processing_sam.py", "repo_id": "transformers", "token_count": 29198 }
739
import argparse import glob import logging import os from argparse import Namespace from importlib import import_module import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from seqeval.metrics import accuracy_score, f1_score, precision_score, recall_score from to...
transformers/examples/legacy/pytorch-lightning/run_ner.py/0
{ "file_path": "transformers/examples/legacy/pytorch-lightning/run_ner.py", "repo_id": "transformers", "token_count": 4295 }
569
module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, }, };
langchainjs/docs/api_refs/postcss.config.js/0
{ "file_path": "langchainjs/docs/api_refs/postcss.config.js", "repo_id": "langchainjs", "token_count": 38 }
765
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/clap/configuration_clap.py/0
{ "file_path": "transformers/src/transformers/models/clap/configuration_clap.py", "repo_id": "transformers", "token_count": 7965 }
612
# 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/layoutlmv3/test_modeling_layoutlmv3.py/0
{ "file_path": "transformers/tests/models/layoutlmv3/test_modeling_layoutlmv3.py", "repo_id": "transformers", "token_count": 7600 }
808
from __future__ import annotations from typing import Any, Tuple from langchain_community.vectorstores.redis import Redis from langchain_community.vectorstores.redis.filters import ( RedisFilterExpression, RedisFilterField, RedisFilterOperator, RedisNum, RedisTag, RedisText, ) from langchain_c...
langchain/libs/langchain/langchain/retrievers/self_query/redis.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/self_query/redis.py", "repo_id": "langchain", "token_count": 1423 }
585
# LlamaIndex Llms Integration: Perplexity
llama_index/llama-index-integrations/llms/llama-index-llms-perplexity/README.md/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-perplexity/README.md", "repo_id": "llama_index", "token_count": 12 }
1,237
import logging from typing import List from langchain_core.callbacks import ( AsyncCallbackManagerForRetrieverRun, CallbackManagerForRetrieverRun, ) from langchain_core.documents import Document from langchain_core.language_models import BaseLLM from langchain_core.prompts.prompt import PromptTemplate from lan...
langchain/libs/langchain/langchain/retrievers/re_phraser.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/re_phraser.py", "repo_id": "langchain", "token_count": 1068 }
583
import { ChatCohere } from "@langchain/cohere"; import { ChatPromptTemplate } from "@langchain/core/prompts"; import { StringOutputParser } from "@langchain/core/output_parsers"; const model = new ChatCohere({ apiKey: process.env.COHERE_API_KEY, // Default model: "command", // Default }); const prompt = ChatPrompt...
langchainjs/examples/src/models/chat/cohere/chat_stream_cohere.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/cohere/chat_stream_cohere.ts", "repo_id": "langchainjs", "token_count": 375 }
832
from __future__ import annotations import json import logging import uuid from typing import Any, Iterable, List, Optional, Type from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.utils import get_from_dict_or_env from langchain_core.vectorstores import ...
langchain/libs/community/langchain_community/vectorstores/tair.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/tair.py", "repo_id": "langchain", "token_count": 4855 }
336
import json import os import unittest import tqdm from huggingface_hub import HfApi, cached_download, hf_hub_url from tokenizers import Tokenizer from .utils import albert_base, data_dir class TestSerialization: def test_full_serialization_albert(self, albert_base): # Check we can read this file. ...
tokenizers/bindings/python/tests/test_serialization.py/0
{ "file_path": "tokenizers/bindings/python/tests/test_serialization.py", "repo_id": "tokenizers", "token_count": 1251 }
454
package proxy import ( "context" "fmt" "strconv" "strings" "github.com/cockroachdb/errors" "github.com/golang/protobuf/proto" "github.com/samber/lo" "go.uber.org/zap" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" "github.com/milvus-io/milvus-...
milvus/internal/proxy/task_query.go/0
{ "file_path": "milvus/internal/proxy/task_query.go", "repo_id": "milvus", "token_count": 7806 }
1,968
from langchain_community.tools.gmail.get_thread import GetThreadSchema, GmailGetThread __all__ = ["GetThreadSchema", "GmailGetThread"]
langchain/libs/langchain/langchain/tools/gmail/get_thread.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/gmail/get_thread.py", "repo_id": "langchain", "token_count": 41 }
588
from langchain_core.vectorstores import VectorStore, VectorStoreRetriever __all__ = ["VectorStore", "VectorStoreRetriever"]
langchain/libs/langchain/langchain/vectorstores/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/base.py", "repo_id": "langchain", "token_count": 35 }
603
package predicates // PredicateTarget is enum for Predicate target type. type PredicateTarget int32 const ( // PredTargetValue is predicate target for key-value perid PredTargetValue PredicateTarget = iota + 1 ) type PredicateType int32 const ( PredTypeEqual PredicateType = iota + 1 ) // Predicate provides inte...
milvus/internal/kv/predicates/predicate.go/0
{ "file_path": "milvus/internal/kv/predicates/predicate.go", "repo_id": "milvus", "token_count": 459 }
1,718
python_sources()
llama_index/llama-index-core/llama_index/core/storage/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/storage/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,248
# Azure AI Search connection settings AZURE_AISEARCH_ENDPOINT= AZURE_AISEARCH_KEY= # If you're using Azure OpenAI API, you'll need to set these variables AZURE_OPENAI_API_KEY= AZURE_OPENAI_API_INSTANCE_NAME= AZURE_OPENAI_API_DEPLOYMENT_NAME= AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME= AZURE_OPENAI_API_VERSION= # Or ...
langchainjs/examples/src/indexes/vector_stores/azure_aisearch/.env.example/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/azure_aisearch/.env.example", "repo_id": "langchainjs", "token_count": 151 }
783
python_sources()
llama_index/llama-index-core/llama_index/core/agent/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/agent/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,195
/****************************************************************************** * Copyright (c) 2023, Tri Dao. ******************************************************************************/ #pragma once #include <assert.h> #include <stdint.h> #include <stdlib.h> #include <cuda_fp16.h> #if defined(__CUDA_ARCH__) ...
candle/candle-flash-attn/kernels/utils.h/0
{ "file_path": "candle/candle-flash-attn/kernels/utils.h", "repo_id": "candle", "token_count": 6965 }
55
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datanode/metacache/actions.go/0
{ "file_path": "milvus/internal/datanode/metacache/actions.go", "repo_id": "milvus", "token_count": 1288 }
1,841
"""Python agent.""" from typing import Any, Dict, Optional from langchain.agents.agent import AgentExecutor, BaseSingleActionAgent from langchain.agents.mrkl.base import ZeroShotAgent from langchain.agents.openai_functions_agent.base import OpenAIFunctionsAgent from langchain.agents.types import AgentType from langch...
langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/python/base.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/python/base.py", "repo_id": "langchain", "token_count": 855 }
424
from abc import ABC, abstractmethod from typing import Any, Dict, List, Optional from llama_index.legacy.bridge.pydantic import Field from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.core.query_pipeline.query_component import ( ChainableMixin, InputKeys, OutputKeys, Quer...
llama_index/llama-index-legacy/llama_index/legacy/postprocessor/types.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/postprocessor/types.py", "repo_id": "llama_index", "token_count": 1604 }
1,694
<!--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...
accelerate/docs/source/concept_guides/performance.md/0
{ "file_path": "accelerate/docs/source/concept_guides/performance.md", "repo_id": "accelerate", "token_count": 1463 }
3
"""ZHIPU AI chat models wrapper.""" from __future__ import annotations import asyncio import json import logging from functools import partial from typing import Any, Dict, Iterator, List, Optional, cast from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models.chat_models impo...
langchain/libs/community/langchain_community/chat_models/zhipuai.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/zhipuai.py", "repo_id": "langchain", "token_count": 4806 }
241
import pytest from text_generation.types import Parameters, Request from text_generation.errors import ValidationError def test_parameters_validation(): # Test best_of Parameters(best_of=1) with pytest.raises(ValidationError): Parameters(best_of=0) with pytest.raises(ValidationError): ...
text-generation-inference/clients/python/tests/test_types.py/0
{ "file_path": "text-generation-inference/clients/python/tests/test_types.py", "repo_id": "text-generation-inference", "token_count": 984 }
359
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/__init__.py/0
{ "file_path": "transformers/src/transformers/__init__.py", "repo_id": "transformers", "token_count": 164804 }
547
import os from typing import Dict, List, Generator import pytest from llama_index.core.schema import NodeRelationship, RelatedNodeInfo, TextNode from llama_index.vector_stores.chroma import ChromaVectorStore from llama_index.core.vector_stores.types import VectorStoreQuery ## # Run tests # cd tests/vector_stores # py...
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-chroma/tests/test_chromadb.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-chroma/tests/test_chromadb.py", "repo_id": "llama_index", "token_count": 2456 }
1,515
# 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...
transformers/tests/models/wav2vec2_bert/test_processor_wav2vec2_bert.py/0
{ "file_path": "transformers/tests/models/wav2vec2_bert/test_processor_wav2vec2_bert.py", "repo_id": "transformers", "token_count": 2700 }
850
# coding=utf-8 # Copyright 2023 The Mega 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/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/mega/configuration_mega.py/0
{ "file_path": "transformers/src/transformers/models/mega/configuration_mega.py", "repo_id": "transformers", "token_count": 4928 }
698
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "schema/storage", newEntrypointName: "stores", newPackageName: "@langchain/core", }); export * from "@langchain/core/stores";
langchainjs/langchain/src/schema/storage.ts/0
{ "file_path": "langchainjs/langchain/src/schema/storage.ts", "repo_id": "langchainjs", "token_count": 90 }
935
# coding=utf-8 # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
diffusers/utils/release.py/0
{ "file_path": "diffusers/utils/release.py", "repo_id": "diffusers", "token_count": 2306 }
277
import ReactDOM from "react-dom/client"; import App from "./App.tsx"; import dayjs from "dayjs"; import utc from "dayjs/plugin/utc"; import relativeDate from "dayjs/plugin/relativeTime"; dayjs.extend(relativeDate); dayjs.extend(utc); ReactDOM.createRoot(document.getElementById("root")!).render(<App />);
langserve/langserve/playground/src/main.tsx/0
{ "file_path": "langserve/langserve/playground/src/main.tsx", "repo_id": "langserve", "token_count": 106 }
1,087
# flake8: noqa from __future__ import annotations import re from typing import List from langchain.prompts.prompt import PromptTemplate from langchain.schema import BaseOutputParser, OutputParserException _PROMPT_TEMPLATE = """If someone asks you to perform a task, your job is to come up with a series of bash comman...
langchain/libs/experimental/langchain_experimental/llm_bash/prompt.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/llm_bash/prompt.py", "repo_id": "langchain", "token_count": 728 }
419
# Copyright 2021 The HuggingFace Datasets Authors and the current dataset script contributor. # # 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....
datasets/metrics/spearmanr/spearmanr.py/0
{ "file_path": "datasets/metrics/spearmanr/spearmanr.py", "repo_id": "datasets", "token_count": 1942 }
134
# Creating documents A document at its core is fairly simple. It consists of a piece of text and optional metadata. The piece of text is what we interact with the language model, while the optional metadata is useful for keeping track of metadata about the document (such as the source). ```typescript interface Docume...
langchainjs/docs/core_docs/docs/modules/data_connection/document_loaders/creating_documents.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/document_loaders/creating_documents.mdx", "repo_id": "langchainjs", "token_count": 201 }
730
"""Base object types.""" import pickle import warnings from typing import Any, Dict, Generic, List, Optional, Sequence, Type, TypeVar from llama_index.legacy.bridge.pydantic import Field from llama_index.legacy.callbacks.base import CallbackManager from llama_index.legacy.core.base_retriever import BaseRetriever from...
llama_index/llama-index-legacy/llama_index/legacy/objects/base.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/objects/base.py", "repo_id": "llama_index", "token_count": 2705 }
1,623
from typing import Iterator, List from langchain_core.language_models import BaseLanguageModel from langchain_core.messages import HumanMessage, SystemMessage from langchain_core.prompts.chat import ChatPromptTemplate, HumanMessagePromptTemplate from langchain_core.pydantic_v1 import BaseModel, Field from langchain.c...
langchain/libs/langchain/langchain/chains/openai_functions/citation_fuzzy_match.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/openai_functions/citation_fuzzy_match.py", "repo_id": "langchain", "token_count": 1380 }
485
package datacoord import ( "context" "testing" "time" "github.com/cockroachdb/errors" "github.com/samber/lo" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "go.uber.org/zap" "google.golang.org/grpc/codes" gr...
milvus/internal/datacoord/services_test.go/0
{ "file_path": "milvus/internal/datacoord/services_test.go", "repo_id": "milvus", "token_count": 18671 }
1,832
import { logVersion010MigrationWarning } from "../../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "stores/message/momento", }); export * from "@langchain/community/stores/message/momento";
langchainjs/langchain/src/stores/message/momento.ts/0
{ "file_path": "langchainjs/langchain/src/stores/message/momento.ts", "repo_id": "langchainjs", "token_count": 75 }
953
<!--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 to...
transformers/docs/source/en/llm_tutorial_optimization.md/0
{ "file_path": "transformers/docs/source/en/llm_tutorial_optimization.md", "repo_id": "transformers", "token_count": 14705 }
452
use crate::parallelism::*; use crate::tokenizer::{Encoding, Result}; use serde::{Deserialize, Serialize}; /// The various possible padding directions. #[derive(Debug, Clone, Copy, Serialize, Deserialize)] pub enum PaddingDirection { Left, Right, } impl std::convert::AsRef<str> for PaddingDirection { fn as...
tokenizers/tokenizers/src/utils/padding.rs/0
{ "file_path": "tokenizers/tokenizers/src/utils/padding.rs", "repo_id": "tokenizers", "token_count": 2049 }
459
# coding=utf-8 # Copyright 2022 Microsoft Research Asia 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/licen...
transformers/src/transformers/models/conditional_detr/modeling_conditional_detr.py/0
{ "file_path": "transformers/src/transformers/models/conditional_detr/modeling_conditional_detr.py", "repo_id": "transformers", "token_count": 55521 }
581
from llama_index.graph_stores.falkordb.base import FalkorDBGraphStore __all__ = ["FalkorDBGraphStore"]
llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-falkordb/llama_index/graph_stores/falkordb/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-falkordb/llama_index/graph_stores/falkordb/__init__.py", "repo_id": "llama_index", "token_count": 37 }
1,330
from llama_index.core.exec_utils import _contains_protected_access def test_contains_protected_access() -> None: assert not _contains_protected_access( "def _a(b): pass" ), "definition of dunder function" assert _contains_protected_access("a = _b(c)"), "call to protected function" assert not _...
llama_index/llama-index-core/tests/test_exec_utils.py/0
{ "file_path": "llama_index/llama-index-core/tests/test_exec_utils.py", "repo_id": "llama_index", "token_count": 337 }
1,245
# 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/text_to_video_synthesis/pipeline_text_to_video_synth_img2img.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth_img2img.py", "repo_id": "diffusers", "token_count": 17312 }
247
// 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/querycoordv2/task/executor.go/0
{ "file_path": "milvus/internal/querycoordv2/task/executor.go", "repo_id": "milvus", "token_count": 4854 }
1,765
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/storage/binlog_test.go/0
{ "file_path": "milvus/internal/storage/binlog_test.go", "repo_id": "milvus", "token_count": 18527 }
1,784
import { OpenAIEmbeddings } from "@langchain/openai"; export const run = async () => { /* Embed queries */ const embeddings = new OpenAIEmbeddings(); const res = await embeddings.embedQuery("Hello world"); console.log(res); /* Embed documents */ const documentRes = await embeddings.embedDocuments([ "He...
langchainjs/examples/src/models/embeddings/openai.ts/0
{ "file_path": "langchainjs/examples/src/models/embeddings/openai.ts", "repo_id": "langchainjs", "token_count": 127 }
809
"""Notion reader.""" import os from typing import Any, Dict, List, Optional import requests # type: ignore from llama_index.core.readers.base import BasePydanticReader from llama_index.core.schema import Document INTEGRATION_TOKEN_NAME = "NOTION_INTEGRATION_TOKEN" BLOCK_CHILD_URL_TMPL = "https://api.notion.com/v1/b...
llama_index/llama-index-integrations/readers/llama-index-readers-notion/llama_index/readers/notion/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-notion/llama_index/readers/notion/base.py", "repo_id": "llama_index", "token_count": 3264 }
1,435
#!/usr/bin/env python3 # coding=utf-8 # 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 #...
peft/tests/test_tuners_utils.py/0
{ "file_path": "peft/tests/test_tuners_utils.py", "repo_id": "peft", "token_count": 7312 }
339
from typing import List, Union from pydantic import BaseModel class ModerationPiiConfig(BaseModel): threshold: float = 0.5 """Threshold for PII confidence score, defaults to 0.5 i.e. 50%""" labels: List[str] = [] """ List of PII Universal Labels. Defaults to `list[]` """ redact: bo...
langchain/libs/experimental/langchain_experimental/comprehend_moderation/base_moderation_config.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/comprehend_moderation/base_moderation_config.py", "repo_id": "langchain", "token_count": 491 }
417
openapi: 3.0.2 info: title: LangSmith version: 0.1.0 paths: /runs/{run_id}: patch: tags: - run summary: Update Run description: Update a run. operationId: update_run_runs__run_id__patch parameters: - required: true schema: title: Run Id typ...
langsmith-sdk/openapi/openapi.yaml/0
{ "file_path": "langsmith-sdk/openapi/openapi.yaml", "repo_id": "langsmith-sdk", "token_count": 8181 }
1,019
import { test, expect } from "@jest/globals"; import { SerpAPI } from "../serpapi.js"; describe("serp api test suite", () => { class SerpApiUrlTester extends SerpAPI { testThisUrl(): string { return this.buildUrl("search", this.params, this.baseUrl); } } test("Test default url", async () => { ...
langchainjs/libs/langchain-community/src/tools/tests/serpapi.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/tests/serpapi.test.ts", "repo_id": "langchainjs", "token_count": 403 }
989
import json import os from typing import Dict, List, Optional import fsspec from llama_index.legacy.bridge.pydantic import Field from llama_index.legacy.llms import ChatMessage from llama_index.legacy.storage.chat_store.base import BaseChatStore class SimpleChatStore(BaseChatStore): """Simple chat store.""" ...
llama_index/llama-index-legacy/llama_index/legacy/storage/chat_store/simple_chat_store.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/storage/chat_store/simple_chat_store.py", "repo_id": "llama_index", "token_count": 1226 }
1,602
python_tests()
llama_index/llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-redis/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-redis/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,451
from langchain_community.document_loaders.blob_loaders.schema import ( Blob, BlobLoader, PathLike, ) __all__ = ["PathLike", "Blob", "BlobLoader"]
langchain/libs/langchain/langchain/document_loaders/blob_loaders/schema.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/blob_loaders/schema.py", "repo_id": "langchain", "token_count": 65 }
480
#!/usr/bin/env bash export PYTHONPATH="../":"${PYTHONPATH}" python distillation.py \ --teacher facebook/bart-large-xsum --data_dir xsum \ --tokenizer_name facebook/bart-large-xsum \ --student_decoder_layers 6 --student_encoder_layers 12 \ --freeze_encoder --freeze_embeds \ --learning_rate=3e-4 \ --do_train ...
transformers/examples/research_projects/seq2seq-distillation/train_distilbart_xsum.sh/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/train_distilbart_xsum.sh", "repo_id": "transformers", "token_count": 317 }
577
import uuid from itertools import islice from typing import ( Any, Callable, Dict, Generator, Iterable, List, Optional, Sequence, Tuple, cast, ) from langchain_core.callbacks import CallbackManagerForRetrieverRun from langchain_core.documents import Document from langchain_core....
langchain/libs/community/langchain_community/retrievers/qdrant_sparse_vector_retriever.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/qdrant_sparse_vector_retriever.py", "repo_id": "langchain", "token_count": 3534 }
274
# An implementation of https://en.wikipedia.org/wiki/Rendezvous_hashing from typing import Callable, List, cast import mmh3 Hasher = Callable[[str, str], int] Member = str Members = List[str] Key = str def assign(key: Key, members: Members, hasher: Hasher) -> Member: """Assigns a key to a member using the rendez...
chroma/chromadb/utils/rendezvous_hash.py/0
{ "file_path": "chroma/chromadb/utils/rendezvous_hash.py", "repo_id": "chroma", "token_count": 570 }
26
"""Read PDF files using PyMuPDF library.""" from pathlib import Path from typing import Dict, List, Optional, Union from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class PyMuPDFReader(BaseReader): """Read PDF files using PyMuPDF library.""" def load_data( ...
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/pymu_pdf/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/pymu_pdf/base.py", "repo_id": "llama_index", "token_count": 1306 }
1,318
from typing import Any, Dict, Sequence from llama_index.legacy.bridge.pydantic import Field from llama_index.legacy.constants import DEFAULT_CONTEXT_WINDOW, DEFAULT_NUM_OUTPUTS from llama_index.legacy.core.llms.types import ( ChatMessage, ChatResponse, ChatResponseGen, CompletionResponse, Completio...
llama_index/llama-index-legacy/llama_index/legacy/llms/replicate.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/replicate.py", "repo_id": "llama_index", "token_count": 1991 }
1,589
import { Runnable } from "../runnables/base.js"; import type { BaseCallbackConfig } from "../callbacks/manager.js"; import type { DocumentInterface } from "./document.js"; /** * Abstract base class for document transformation systems. * * A document transformation system takes an array of Documents and returns an ...
langchainjs/langchain-core/src/documents/transformers.ts/0
{ "file_path": "langchainjs/langchain-core/src/documents/transformers.ts", "repo_id": "langchainjs", "token_count": 544 }
824
@base <https://swapi.co/resource/>. @prefix voc: <https://swapi.co/vocabulary/> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . { <besalisk/71> a voc:Besalisk , voc:Character ; rdfs:label "Dexter Jettster" ; voc:eyeCo...
langchain/libs/community/tests/integration_tests/graphs/docker-compose-ontotext-graphdb/starwars-data.trig/0
{ "file_path": "langchain/libs/community/tests/integration_tests/graphs/docker-compose-ontotext-graphdb/starwars-data.trig", "repo_id": "langchain", "token_count": 526 }
331
/// <reference types="vite/client" />
opengpts/frontend/src/vite-env.d.ts/0
{ "file_path": "opengpts/frontend/src/vite-env.d.ts", "repo_id": "opengpts", "token_count": 12 }
2,206