text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
[build-system] build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] [tool.codespell] check-filenames = true check-hidden = true skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb" [tool.llamahub] classes = ["OpenMap"] contains_example = false import_path = "llama_index.readers.maps" [tool.mypy] ...
llama_index/llama-index-integrations/readers/llama-index-readers-maps/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-maps/pyproject.toml", "repo_id": "llama_index", "token_count": 689 }
1,347
<jupyter_start><jupyter_text>Nuclia Understanding>[Nuclia](https://nuclia.com) automatically indexes your unstructured data from any internal and external source, providing optimized search results and generative answers. It can handle video and audio transcription, image content extraction, and document parsing.The `N...
langchain/docs/docs/integrations/tools/nuclia.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/nuclia.ipynb", "repo_id": "langchain", "token_count": 817 }
185
diff --git a/dist/support/helpers.js b/dist/support/helpers.js index 4346548126fcf7e3687f243ee53fd0456778c29c..73cefe121e927285d305d57e89f3c87f8d2fe289 100644 --- a/dist/support/helpers.js +++ b/dist/support/helpers.js @@ -42,7 +42,12 @@ function getReflectionHeadingLevel(reflection, groupByReflections) { exports.getR...
langchainjs/.yarn/patches/typedoc-plugin-markdown-npm-4.0.0-next.6-96b4b47746.patch/0
{ "file_path": "langchainjs/.yarn/patches/typedoc-plugin-markdown-npm-4.0.0-next.6-96b4b47746.patch", "repo_id": "langchainjs", "token_count": 804 }
697
package indexparamcheck import "fmt" type raftBruteForceChecker struct { floatVectorBaseChecker } // raftBrustForceChecker checks if a Brute_Force index can be built. func (c raftBruteForceChecker) CheckTrain(params map[string]string) error { if err := c.floatVectorBaseChecker.CheckTrain(params); err != nil { re...
milvus/pkg/util/indexparamcheck/raft_brute_force_checker.go/0
{ "file_path": "milvus/pkg/util/indexparamcheck/raft_brute_force_checker.go", "repo_id": "milvus", "token_count": 193 }
1,939
// 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/indexnode/task_test.go/0
{ "file_path": "milvus/internal/indexnode/task_test.go", "repo_id": "milvus", "token_count": 4292 }
1,715
from typing import List, Tuple from ionic_langchain.tool import IonicTool from langchain.agents import AgentExecutor, create_openai_tools_agent from langchain_core.messages import AIMessage, SystemMessage from langchain_core.prompts import ( ChatPromptTemplate, HumanMessagePromptTemplate, MessagesPlacehold...
langchain/templates/shopping-assistant/shopping_assistant/agent.py/0
{ "file_path": "langchain/templates/shopping-assistant/shopping_assistant/agent.py", "repo_id": "langchain", "token_count": 471 }
683
from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.embeddings.huggingface_optimum import OptimumEmbedding def test_optimumembedding_class(): names_of_base_classes = [b.__name__ for b in OptimumEmbedding.__mro__] assert BaseEmbedding.__name__ in names_of_base_classes
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum/tests/test_embeddings_huggingface_optimum.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum/tests/test_embeddings_huggingface_optimum.py", "repo_id": "llama_index", "token_count": 110 }
1,311
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "tools/dadjokeapi", }); export * from "@langchain/community/tools/dadjokeapi";
langchainjs/langchain/src/tools/dadjokeapi.ts/0
{ "file_path": "langchainjs/langchain/src/tools/dadjokeapi.ts", "repo_id": "langchainjs", "token_count": 74 }
972
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.sentence_window_retriever import SentenceWindowRetrieverPack def test_class(): names_of_base_classes = [b.__name__ for b in SentenceWindowRetrieverPack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-sentence-window-retriever/tests/test_packs_sentence_window_retriever.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-sentence-window-retriever/tests/test_packs_sentence_window_retriever.py", "repo_id": "llama_index", "token_count": 107 }
1,594
from langchain_community.chat_models import ChatVertexAI from langchain_core.prompts import ChatPromptTemplate _prompt = ChatPromptTemplate.from_template( "Tell me a joke about Chuck Norris and {text}" ) _model = ChatVertexAI() # if you update this, you MUST also update ../pyproject.toml # with the new `tool.lang...
langchain/templates/vertexai-chuck-norris/vertexai_chuck_norris/chain.py/0
{ "file_path": "langchain/templates/vertexai-chuck-norris/vertexai_chuck_norris/chain.py", "repo_id": "langchain", "token_count": 116 }
707
from langchain_community.llms.sagemaker_endpoint import ( LLMContentHandler, SagemakerEndpoint, ) __all__ = ["SagemakerEndpoint", "LLMContentHandler"]
langchain/libs/langchain/langchain/llms/sagemaker_endpoint.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/sagemaker_endpoint.py", "repo_id": "langchain", "token_count": 57 }
551
# ChatGPT Plugin Tool This tool allows Agents to load a plugin using a ChatGPT manifest file, and have the Agent interact with it. ## Usage This tool has more extensive example usage documented in a Jupyter notebook [here](https://github.com/emptycrown/llama-hub/tree/main/llama_hub/tools/notebooks/chatgpt_plugin.ipy...
llama_index/llama-index-integrations/tools/llama-index-tools-chatgpt-plugin/README.md/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-chatgpt-plugin/README.md", "repo_id": "llama_index", "token_count": 546 }
1,507
# coding=utf-8 # Copyright 2022 BNRist (Tsinghua University), TKLNDST (Nankai University) 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 #...
transformers/src/transformers/models/deprecated/van/convert_van_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/deprecated/van/convert_van_to_pytorch.py", "repo_id": "transformers", "token_count": 4514 }
592
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/markuplm/tokenization_markuplm_fast.py/0
{ "file_path": "transformers/src/transformers/models/markuplm/tokenization_markuplm_fast.py", "repo_id": "transformers", "token_count": 20309 }
639
"""Test Deep Lake functionality.""" import pytest from langchain_core.documents import Document from pytest import FixtureRequest from langchain_community.vectorstores import DeepLake from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddings @pytest.fixture def deeplake_datastore() -> DeepLake:...
langchain/libs/community/tests/integration_tests/vectorstores/test_deeplake.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_deeplake.py", "repo_id": "langchain", "token_count": 3698 }
375
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-stock-market-data-query-engine/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-stock-market-data-query-engine/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,596
"""Tools for interacting with a GraphQL API"""
langchain/libs/langchain/langchain/tools/graphql/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/graphql/__init__.py", "repo_id": "langchain", "token_count": 11 }
604
import os from math import ceil from typing import Any, Dict, List, Optional class ArangoGraph: """ArangoDB wrapper for graph operations. *Security note*: Make sure that the database connection uses credentials that are narrowly-scoped to only include necessary permissions. Failure to do so m...
langchain/libs/community/langchain_community/graphs/arangodb_graph.py/0
{ "file_path": "langchain/libs/community/langchain_community/graphs/arangodb_graph.py", "repo_id": "langchain", "token_count": 2946 }
271
<clickhouse> <users> <default> <access_management>1</access_management> <named_collection_control>1</named_collection_control> <show_named_collections>1</show_named_collections> <show_named_collections_secrets>1</show_named_collections_secrets> </defau...
langsmith-sdk/js/src/cli/users.xml/0
{ "file_path": "langsmith-sdk/js/src/cli/users.xml", "repo_id": "langsmith-sdk", "token_count": 160 }
1,076
#![allow(dead_code)] use libc::{c_char, c_double, c_float, c_int}; mod ffi { use super::*; extern "C" { pub fn vsTanh(n: c_int, a: *const c_float, y: *mut c_float); pub fn vdTanh(n: c_int, a: *const c_double, y: *mut c_double); pub fn vsExp(n: c_int, a: *const c_float, y: *mut c_float);...
candle/candle-core/src/mkl.rs/0
{ "file_path": "candle/candle-core/src/mkl.rs", "repo_id": "candle", "token_count": 6463 }
34
<jupyter_start><jupyter_text>Classification de token (PyTorch) Installez les bibliothèques 🤗 *Datasets*, 🤗 *Transformers* et 🤗 *Accelerate* pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece] !pip install accelerate # Pour exécuter l'entraînement sur TPU, vous devrez décommen...
notebooks/course/fr/chapter7/section2_pt.ipynb/0
{ "file_path": "notebooks/course/fr/chapter7/section2_pt.ipynb", "repo_id": "notebooks", "token_count": 3899 }
287
"""Test ChatAI21 chat model.""" from langchain_core.messages import HumanMessage from langchain_core.outputs import ChatGeneration from langchain_ai21.chat_models import ChatAI21 def test_invoke() -> None: """Test invoke tokens from AI21.""" llm = ChatAI21(model="j2-ultra") result = llm.invoke("I'm Pick...
langchain/libs/partners/ai21/tests/integration_tests/test_chat_models.py/0
{ "file_path": "langchain/libs/partners/ai21/tests/integration_tests/test_chat_models.py", "repo_id": "langchain", "token_count": 522 }
621
import { ChatWindow } from "@/components/ChatWindow"; export default function AgentsPage() { const InfoCard = ( <div className="p-4 md:p-8 rounded bg-[#25252d] w-full max-h-[85%] overflow-hidden"> <h1 className="text-3xl md:text-4xl mb-4"> ▲ Next.js + LangChain.js Agents 🦜🔗 </h1> <ul>...
langchain-nextjs-template/app/agents/page.tsx/0
{ "file_path": "langchain-nextjs-template/app/agents/page.tsx", "repo_id": "langchain-nextjs-template", "token_count": 1442 }
68
import argparse import gc import json import logging import math import os from dataclasses import dataclass from datetime import datetime from pathlib import Path from random import randint from typing import Any, Dict, List, Union # datasets imports import datasets # metric imports import evaluate import numpy as n...
peft/examples/int8_training/peft_adalora_whisper_large_training.py/0
{ "file_path": "peft/examples/int8_training/peft_adalora_whisper_large_training.py", "repo_id": "peft", "token_count": 13081 }
341
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/postprocessor/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/postprocessor/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,584
from gemini_functions_agent.agent import agent_executor __all__ = ["agent_executor"]
langchain/templates/gemini-functions-agent/gemini_functions_agent/__init__.py/0
{ "file_path": "langchain/templates/gemini-functions-agent/gemini_functions_agent/__init__.py", "repo_id": "langchain", "token_count": 28 }
655
import json import logging from typing import List from langchain_core.chat_history import BaseChatMessageHistory from langchain_core.messages import ( BaseMessage, message_to_dict, messages_from_dict, ) logger = logging.getLogger(__name__) DEFAULT_CONNECTION_STRING = "postgresql://postgres:mypassword@lo...
langchain/libs/community/langchain_community/chat_message_histories/postgres.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_message_histories/postgres.py", "repo_id": "langchain", "token_count": 1116 }
223
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-openai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-openai/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,383
[build-system] build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] [tool.codespell] check-filenames = true check-hidden = true skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb" [tool.llamahub] classes = ["OpendalAzblobReader", "OpendalGcsReader", "OpendalReader", "OpendalS3Reader"] contains_ex...
llama_index/llama-index-integrations/readers/llama-index-readers-opendal/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-opendal/pyproject.toml", "repo_id": "llama_index", "token_count": 709 }
1,420
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-minio/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-minio/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,402
--- hide_table_of_contents: true sidebar_position: 1 --- # OpenAI tools :::tip Compatibility OpenAI tool calling is new and only available on [OpenAI's latest models](https://platform.openai.com/docs/guides/function-calling). ::: Certain OpenAI models have been finetuned to work with with tool calling. This is very ...
langchainjs/docs/core_docs/docs/modules/agents/agent_types/openai_tools_agent.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/agents/agent_types/openai_tools_agent.mdx", "repo_id": "langchainjs", "token_count": 1196 }
778
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/core/src/common/Vector.h/0
{ "file_path": "milvus/internal/core/src/common/Vector.h", "repo_id": "milvus", "token_count": 1416 }
1,781
import argparse from fairseq.checkpoint_utils import load_checkpoint_to_cpu from transformers import Kosmos2Config, Kosmos2ForConditionalGeneration KEYS_TO_MODIFY_MAPPING = { "gpt_model.decoder.output_projection": "text_model.lm_head", "gpt_model.decoder": "text_model.model", "img_connector": "image_to_...
transformers/src/transformers/models/kosmos2/convert_kosmos2_original_pytorch_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/kosmos2/convert_kosmos2_original_pytorch_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 1082 }
686
"""Test DeepInfra API wrapper.""" from langchain_community.llms.deepinfra import DeepInfra def test_deepinfra_call() -> None: """Test valid call to DeepInfra.""" llm = DeepInfra(model_id="meta-llama/Llama-2-7b-chat-hf") output = llm.invoke("What is 2 + 2?") assert isinstance(output, str) async def t...
langchain/libs/community/tests/integration_tests/llms/test_deepinfra.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_deepinfra.py", "repo_id": "langchain", "token_count": 434 }
337
[ { "suite_params": [ { "suite": "2_accuracy_ann_debug.yaml", "image_type": "cpu" } ] } ]
milvus/tests/benchmark/milvus_benchmark/scheduler/acc.json/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/scheduler/acc.json", "repo_id": "milvus", "token_count": 120 }
1,858
--- sidebar_position: 2 --- # Agents Chains are great when we know the specific sequence of tool usage needed for any user input. But for certain use cases, how many times we use tools depends on the input. In these cases, we want to let the model itself decide how many times to use tools and in what order. That's wh...
langchainjs/docs/core_docs/docs/use_cases/tool_use/agents.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/use_cases/tool_use/agents.mdx", "repo_id": "langchainjs", "token_count": 1461 }
770
class MyClass: def __init__(self, name): self.name = name def greet(self): print(f"Hello, {self.name}!") # noqa: T201 def main(): name = input("Enter your name: ") obj = MyClass(name) obj.greet() if __name__ == "__main__": main()
langchain/docs/docs/integrations/document_loaders/example_data/source_code/example.py/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/example_data/source_code/example.py", "repo_id": "langchain", "token_count": 125 }
102
from unittest.mock import MagicMock from langchain_community.tools.gmail.send_message import GmailSendMessage def test_send() -> None: """Test gmail send.""" mock_api_resource = MagicMock() # bypass pydantic validation as google-api-python-client is not a package dependency tool = GmailSendMessage.co...
langchain/libs/community/tests/unit_tests/tools/gmail/test_send.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/tools/gmail/test_send.py", "repo_id": "langchain", "token_count": 221 }
392
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-bilibili/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-bilibili/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,327
# LlamaIndex Vector_Stores Integration: Epsilla
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-epsilla/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-epsilla/README.md", "repo_id": "llama_index", "token_count": 13 }
1,526
from __future__ import annotations import logging from typing import Optional from langchain_core.callbacks import CallbackManagerForToolRun from langchain_community.tools.edenai.edenai_base_tool import EdenaiTool logger = logging.getLogger(__name__) class EdenAiParsingInvoiceTool(EdenaiTool): """Tool that qu...
langchain/libs/community/langchain_community/tools/edenai/ocr_invoiceparser.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/edenai/ocr_invoiceparser.py", "repo_id": "langchain", "token_count": 885 }
296
package dao import ( "github.com/chroma/chroma-coordinator/internal/metastore/db/dbmodel" "gorm.io/gorm" "gorm.io/gorm/clause" ) type collectionMetadataDb struct { db *gorm.DB } func (s *collectionMetadataDb) DeleteAll() error { return s.db.Where("1 = 1").Delete(&dbmodel.CollectionMetadata{}).Error } func (s *...
chroma/go/coordinator/internal/metastore/db/dao/collection_metadata.go/0
{ "file_path": "chroma/go/coordinator/internal/metastore/db/dao/collection_metadata.go", "repo_id": "chroma", "token_count": 291 }
50
from langchain import utils from tests.unit_tests import assert_all_importable EXPECTED_ALL = [ "StrictFormatter", "check_package_version", "comma_list", "convert_to_secret_str", "cosine_similarity", "cosine_similarity_top_k", "formatter", "get_bolded_text", "get_color_mapping", ...
langchain/libs/langchain/tests/unit_tests/utils/test_imports.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/utils/test_imports.py", "repo_id": "langchain", "token_count": 308 }
620
"""Test Google PaLM Chat API wrapper. Note: This test must be run with the GOOGLE_API_KEY environment variable set to a valid API key. """ from langchain_core.messages import BaseMessage, HumanMessage, SystemMessage from langchain_core.outputs import ChatGeneration, ChatResult, LLMResult from langchain_communi...
langchain/libs/community/tests/integration_tests/chat_models/test_google_palm.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/chat_models/test_google_palm.py", "repo_id": "langchain", "token_count": 955 }
343
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-pinecone/llama_index/vector_stores/pinecone/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-pinecone/llama_index/vector_stores/pinecone/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,532
import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { OpenAIEmbeddings } from "@langchain/openai"; // Create a vector store through any method, here from texts as an example const vectorStore = await HNSWLib.fromTexts( ["Hello world", "Bye bye", "hello nice world"], [{ id: 2 }, { id: 1 }, {...
langchainjs/examples/src/indexes/vector_stores/hnswlib_saveload.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/hnswlib_saveload.ts", "repo_id": "langchainjs", "token_count": 222 }
848
/* Hide search button */ .sidebar-search-container { display: none; } /* Hide the search wrapper window when hitting Ctrl+K */ .search-button__wrapper.show { display: none !important; } /* Make sure Algolia's search container is always on top */ .bd-article-container { z-index: 10; } @media (prefers-color-sche...
llama_index/docs/_static/css/algolia.css/0
{ "file_path": "llama_index/docs/_static/css/algolia.css", "repo_id": "llama_index", "token_count": 882 }
1,077
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/swin2sr/configuration_swin2sr.py/0
{ "file_path": "transformers/src/transformers/models/swin2sr/configuration_swin2sr.py", "repo_id": "transformers", "token_count": 2786 }
727
# Diffbot >[Diffbot](https://docs.diffbot.com/docs) is a service to read web pages. Unlike traditional web scraping tools, > `Diffbot` doesn't require any rules to read the content on a page. >It starts with computer vision, which classifies a page into one of 20 possible types. Content is then interpreted by a machi...
langchain/docs/docs/integrations/providers/diffbot.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/diffbot.mdx", "repo_id": "langchain", "token_count": 211 }
131
import numpy as np from pymilvus.orm.types import CONSISTENCY_STRONG, CONSISTENCY_BOUNDED, CONSISTENCY_SESSION, CONSISTENCY_EVENTUALLY from common.constants import * from utils.util_pymilvus import * from common.common_type import CaseLabel, CheckTasks from common import common_type as ct from common import common_func...
milvus/tests/python_client/testcases/test_search.py/0
{ "file_path": "milvus/tests/python_client/testcases/test_search.py", "repo_id": "milvus", "token_count": 266286 }
2,045
#!/usr/bin/env python import argparse import glob import logging import os import sys import time from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple import numpy as np import pytorch_lightning as pl import torch from callbacks import Seq2SeqLoggingCallback, get_checkpoin...
transformers/examples/research_projects/seq2seq-distillation/finetune.py/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/finetune.py", "repo_id": "transformers", "token_count": 8523 }
616
from langchain_core._api.deprecation import ( LangChainDeprecationWarning, LangChainPendingDeprecationWarning, deprecated, suppress_langchain_deprecation_warning, surface_langchain_deprecation_warnings, warn_deprecated, ) __all__ = [ "LangChainDeprecationWarning", "LangChainPendingDepre...
langchain/libs/langchain/langchain/_api/deprecation.py/0
{ "file_path": "langchain/libs/langchain/langchain/_api/deprecation.py", "repo_id": "langchain", "token_count": 175 }
455
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/pkg/mq/msgdispatcher/target.go/0
{ "file_path": "milvus/pkg/mq/msgdispatcher/target.go", "repo_id": "milvus", "token_count": 599 }
1,918
const fs = require("fs"); const semver = require("semver"); const currentPackageJson = JSON.parse(fs.readFileSync("./package.json")); if (currentPackageJson.dependencies["@langchain/core"]) { const minVersion = semver.minVersion( currentPackageJson.dependencies["@langchain/core"] ).version; currentPackageJs...
langchainjs/dependency_range_tests/scripts/node/update_resolutions_lowest.js/0
{ "file_path": "langchainjs/dependency_range_tests/scripts/node/update_resolutions_lowest.js", "repo_id": "langchainjs", "token_count": 345 }
687
use std::collections::VecDeque; use std::fmt::Display; use candle::{DType, Device, Error, Module, Result, Tensor, Var}; use candle_nn::{ func, linear, sequential::seq, Activation, AdamW, Optimizer, ParamsAdamW, Sequential, VarBuilder, VarMap, }; use rand::{distributions::Uniform, thread_rng, Rng}; use super::...
candle/candle-examples/examples/reinforcement-learning/ddpg.rs/0
{ "file_path": "candle/candle-examples/examples/reinforcement-learning/ddpg.rs", "repo_id": "candle", "token_count": 8524 }
42
# `tokenizers-linux-x64-musl` This is the **x86_64-unknown-linux-musl** binary for `tokenizers`
tokenizers/bindings/node/npm/linux-x64-musl/README.md/0
{ "file_path": "tokenizers/bindings/node/npm/linux-x64-musl/README.md", "repo_id": "tokenizers", "token_count": 38 }
415
# 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/downsampling.py/0
{ "file_path": "diffusers/src/diffusers/models/downsampling.py", "repo_id": "diffusers", "token_count": 5559 }
224
import { test } from "@jest/globals"; import { ChatOpenAI, OpenAI } from "@langchain/openai"; import { EntityMemory } from "../entity_memory.js"; import { LLMChain } from "../../chains/llm_chain.js"; import { ENTITY_MEMORY_CONVERSATION_TEMPLATE } from "../prompt.js"; test.skip("Test entity memory in a chain", async ()...
langchainjs/langchain/src/memory/tests/entity_memory.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/memory/tests/entity_memory.int.test.ts", "repo_id": "langchainjs", "token_count": 881 }
894
python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/response_synthesizers/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/response_synthesizers/BUILD", "repo_id": "llama_index", "token_count": 25 }
1,545
from typing import Any, Callable, Dict, Optional, Sequence from llama_index.legacy.bridge.pydantic import Field, PrivateAttr from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.core.llms.types import ( ChatMessage, ChatResponse, ChatResponseGen, CompletionResponse, Comp...
llama_index/llama-index-legacy/llama_index/legacy/llms/ai21.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/ai21.py", "repo_id": "llama_index", "token_count": 2059 }
1,572
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use clap::{Parser, ValueEnum}; use std::io::Write; use tokenizers::Tokenizer; use candle::quantized::{ggml_file, gguf_file}; use candle::Tensor; use candle_transformers::generation::LogitsProcessor; use c...
candle/candle-examples/examples/quantized/main.rs/0
{ "file_path": "candle/candle-examples/examples/quantized/main.rs", "repo_id": "candle", "token_count": 11119 }
49
from typing import Any, Dict, Optional, Sequence from llama_index.core.base.base_selector import ( BaseSelector, SelectorResult, SingleSelection, ) from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.core.indices.query.embedding_utils import get_top_k_embeddings from llama_inde...
llama_index/llama-index-core/llama_index/core/selectors/embedding_selectors.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/selectors/embedding_selectors.py", "repo_id": "llama_index", "token_count": 1275 }
1,201
from llama_index.core.readers.base import BaseReader from llama_index.readers.bagel import BagelReader def test_class(): names_of_base_classes = [b.__name__ for b in BagelReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-bagel/tests/test_readers_bagel.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-bagel/tests/test_readers_bagel.py", "repo_id": "llama_index", "token_count": 88 }
1,470
# 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 agreed to in writ...
diffusers/tests/pipelines/shap_e/test_shap_e.py/0
{ "file_path": "diffusers/tests/pipelines/shap_e/test_shap_e.py", "repo_id": "diffusers", "token_count": 3729 }
255
# 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/nat/test_modeling_nat.py/0
{ "file_path": "transformers/tests/models/nat/test_modeling_nat.py", "repo_id": "transformers", "token_count": 6241 }
759
// 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/MemFileManagerImpl.cpp/0
{ "file_path": "milvus/internal/core/src/storage/MemFileManagerImpl.cpp", "repo_id": "milvus", "token_count": 3237 }
1,892
import copy import os from functools import partial from itertools import groupby from typing import TYPE_CHECKING, Callable, Iterator, List, Optional, Tuple, TypeVar, Union import numpy as np import pyarrow as pa import pyarrow.compute as pc import pyarrow.types from . import config from .utils.logging import get_lo...
datasets/src/datasets/table.py/0
{ "file_path": "datasets/src/datasets/table.py", "repo_id": "datasets", "token_count": 40704 }
143
/* eslint-disable no-process-env */ import { test, expect } from "@jest/globals"; import { Client, ClientOptions } from "@elastic/elasticsearch"; import { OpenAIEmbeddings } from "@langchain/openai"; import { Document } from "@langchain/core/documents"; import { ElasticVectorSearch } from "../elasticsearch.js"; descri...
langchainjs/libs/langchain-community/src/vectorstores/tests/elasticsearch.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/elasticsearch.int.test.ts", "repo_id": "langchainjs", "token_count": 1689 }
982
# coding=utf-8 # Copyright 2023 The Salesforce Team Authors and The HuggingFace Team. All rights reserved. # # Licensed under the BSD-3-clause license (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://opensource.org/licenses/BSD...
transformers/src/transformers/models/blip/modeling_tf_blip_text.py/0
{ "file_path": "transformers/src/transformers/models/blip/modeling_tf_blip_text.py", "repo_id": "transformers", "token_count": 21856 }
575
reviewers: - aoiasd - bigsheeper - congqixia - yah01 approvers: - maintainers
milvus/internal/querynodev2/segments/OWNERS/0
{ "file_path": "milvus/internal/querynodev2/segments/OWNERS", "repo_id": "milvus", "token_count": 41 }
1,991
import candle print(f"mkl: {candle.utils.has_mkl()}") print(f"accelerate: {candle.utils.has_accelerate()}") print(f"num-threads: {candle.utils.get_num_threads()}") print(f"cuda: {candle.utils.cuda_is_available()}") t = candle.Tensor(42.0) print(t) print(t.shape, t.rank, t.device) print(t + t) t = can...
candle/candle-pyo3/test.py/0
{ "file_path": "candle/candle-pyo3/test.py", "repo_id": "candle", "token_count": 340 }
63
from langchain_community.document_loaders.image import UnstructuredImageLoader __all__ = ["UnstructuredImageLoader"]
langchain/libs/langchain/langchain/document_loaders/image.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/image.py", "repo_id": "langchain", "token_count": 32 }
507
# 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/stable_diffusion/pipeline_flax_stable_diffusion_inpaint.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_inpaint.py", "repo_id": "diffusers", "token_count": 11428 }
265
<jupyter_start><jupyter_text>Minimax[Minimax](https://api.minimax.chat) is a Chinese startup that provides natural language processing models for companies and individuals.This example demonstrates using Langchain to interact with Minimax. SetupTo run this notebook, you'll need a [Minimax account](https://api.minimax....
langchain/docs/docs/integrations/llms/minimax.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/minimax.ipynb", "repo_id": "langchain", "token_count": 499 }
131
import type { Tiktoken, TiktokenModel } from "js-tiktoken/lite"; import { type BaseCache, InMemoryCache } from "../caches.js"; import { type BasePromptValueInterface, StringPromptValue, ChatPromptValue, } from "../prompt_values.js"; import { type BaseMessage, type BaseMessageLike, type MessageContent, co...
langchainjs/langchain-core/src/language_models/base.ts/0
{ "file_path": "langchainjs/langchain-core/src/language_models/base.ts", "repo_id": "langchainjs", "token_count": 4333 }
832
# Copyright 2020 The HuggingFace Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
datasets/metrics/rouge/rouge.py/0
{ "file_path": "datasets/metrics/rouge/rouge.py", "repo_id": "datasets", "token_count": 2100 }
133
from langchain_community.llms.bedrock import ( Bedrock, BedrockBase, ) __all__ = [ "BedrockBase", "Bedrock", ]
langchain/libs/langchain/langchain/llms/bedrock.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/bedrock.py", "repo_id": "langchain", "token_count": 57 }
513
cmd: # Option: run/backup/rollback type: run runWithBackup: false config: sourceVersion: 2.1.0 targetVersion: 2.2.0 backupFilePath: /tmp/migration.bak metastore: type: etcd etcd: endpoints: - localhost:2379 rootPath: by-dev # The root path where data is stored in etcd metaSubPath: meta # meta...
milvus/cmd/tools/migration/example.yaml/0
{ "file_path": "milvus/cmd/tools/migration/example.yaml", "repo_id": "milvus", "token_count": 559 }
1,712
import asyncio import os import torch import time from grpc import aio from loguru import logger from grpc_reflection.v1alpha import reflection from pathlib import Path from typing import List, Optional from text_generation_server.cache import Cache from text_generation_server.interceptor import ExceptionInterceptor...
text-generation-inference/server/text_generation_server/server.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/server.py", "repo_id": "text-generation-inference", "token_count": 3834 }
432
<jupyter_start><jupyter_text>GraphSparqlQAChainGraph databases are an excellent choice for applications based on network-like models. To standardize the syntax and semantics of such graphs, the W3C recommends Semantic Web Technologies, cp. [Semantic Web](https://www.w3.org/standards/semanticweb/). [SPARQL](https://www....
langchain/docs/docs/use_cases/graph/graph_sparql_qa.ipynb/0
{ "file_path": "langchain/docs/docs/use_cases/graph/graph_sparql_qa.ipynb", "repo_id": "langchain", "token_count": 1524 }
198
// 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/storage/TencentCloudSTSClient.cpp/0
{ "file_path": "milvus/internal/core/src/storage/TencentCloudSTSClient.cpp", "repo_id": "milvus", "token_count": 2218 }
1,894
apiVersion: chaos-mesh.org/v1alpha1 kind: PodChaos metadata: name: test-etcd-pod-failure namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: app.kubernetes.io/instance: milvus-chaos app.kubernetes.io/name: etcd mode: fixed value: "1" action: pod-fai...
milvus/tests/python_client/chaos/chaos_objects/pod_failure/chaos_etcd_pod_failure.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/pod_failure/chaos_etcd_pod_failure.yaml", "repo_id": "milvus", "token_count": 151 }
2,168
from langsmith.wrappers._openai import wrap_openai __all__ = ["wrap_openai"]
langsmith-sdk/python/langsmith/wrappers/__init__.py/0
{ "file_path": "langsmith-sdk/python/langsmith/wrappers/__init__.py", "repo_id": "langsmith-sdk", "token_count": 27 }
1,070
version: '3.9' networks: net: services: zipkin: image: openzipkin/zipkin ports: - "9411:9411" # you can access Zipkin UI at http://localhost:9411 depends_on: [otel-collector] networks: - net otel-collector: image: otel/opentelemetry-collector-contrib command: ["--config=/etc/o...
chroma/examples/observability/docker-compose.local-observability.yml/0
{ "file_path": "chroma/examples/observability/docker-compose.local-observability.yml", "repo_id": "chroma", "token_count": 822 }
43
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,489
# LlamaIndex Readers Integration: Make-Com
llama_index/llama-index-integrations/readers/llama-index-readers-make-com/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-make-com/README.md", "repo_id": "llama_index", "token_count": 11 }
1,474
# Add parent directory to python path to access lightning_base.py export PYTHONPATH="../":"${PYTHONPATH}" # A sample finetuning run, you need to specify data_dir, output_dir and model_name_or_path # run ./examples/rag/finetune_rag.sh --help to see all the possible options python examples/rag/finetune_rag.py \ --d...
transformers/examples/research_projects/rag/finetune_rag.sh/0
{ "file_path": "transformers/examples/research_projects/rag/finetune_rag.sh", "repo_id": "transformers", "token_count": 440 }
572
import os from typing import Any, Callable, Dict, List, Literal, Optional, Type import numpy as np from llama_index.core.bridge.pydantic import Field, PrivateAttr from llama_index.core.evaluation.retrieval.metrics_base import ( BaseRetrievalMetric, RetrievalMetricResult, ) _AGG_FUNC: Dict[str, Callable] = {"m...
llama_index/llama-index-core/llama_index/core/evaluation/retrieval/metrics.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/evaluation/retrieval/metrics.py", "repo_id": "llama_index", "token_count": 2060 }
1,124
<!--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 at http://www.apache...
transformers/docs/source/ja/model_doc/bridgetower.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/bridgetower.md", "repo_id": "transformers", "token_count": 3672 }
515
# coding=utf-8 # Copyright 2023 Microsoft and the HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
transformers/tests/models/phi/test_modeling_phi.py/0
{ "file_path": "transformers/tests/models/phi/test_modeling_phi.py", "repo_id": "transformers", "token_count": 9169 }
762
<jupyter_start><jupyter_text>Llama Packs ExampleThis example shows you how to use a simple Llama Pack with VoyageAI. We show the following:- How to download a Llama Pack- How to inspect its modules- How to run it out of the box- How to customize it.You can find all packs on https://llamahub.ai Setup Data<jupyter_code>...
llama_index/docs/examples/llama_hub/llama_packs_example.ipynb/0
{ "file_path": "llama_index/docs/examples/llama_hub/llama_packs_example.ipynb", "repo_id": "llama_index", "token_count": 1227 }
1,111
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querynodev2/delegator/deletebuffer/list_delete_buffer_test.go/0
{ "file_path": "milvus/internal/querynodev2/delegator/deletebuffer/list_delete_buffer_test.go", "repo_id": "milvus", "token_count": 1054 }
1,848
<jupyter_start><jupyter_text>Async callbacksIf you are planning to use the async API, it is recommended to use `AsyncCallbackHandler` to avoid blocking the runloop. **Advanced** if you use a sync `CallbackHandler` while using an async method to run your LLM / Chain / Tool / Agent, it will still work. However, under the...
langchain/docs/docs/modules/callbacks/async_callbacks.ipynb/0
{ "file_path": "langchain/docs/docs/modules/callbacks/async_callbacks.ipynb", "repo_id": "langchain", "token_count": 968 }
184
import { test, expect, jest } from "@jest/globals"; import { HumanMessage, AIMessage } from "@langchain/core/messages"; import { MotorheadMemory } from "../motorhead_memory.js"; test("Test motörhead memory", async () => { global.fetch = jest.fn(() => Promise.resolve({ json: () => Promise.resolve({ ...
langchainjs/libs/langchain-community/src/memory/tests/motorhead_memory.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/memory/tests/motorhead_memory.test.ts", "repo_id": "langchainjs", "token_count": 673 }
1,065
import math import torch from torch.utils.data import Sampler import torch.distributed as dist class OrderedDistributedSampler(Sampler): """Sampler that restricts data loading to a subset of the dataset. It is especially useful in conjunction with :class:`torch.nn.parallel.DistributedDataParallel`. In suc...
pytorch-image-models/timm/data/distributed_sampler.py/0
{ "file_path": "pytorch-image-models/timm/data/distributed_sampler.py", "repo_id": "pytorch-image-models", "token_count": 2276 }
358
[build-system] build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] [tool.codespell] check-filenames = true check-hidden = true skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb" [tool.llamahub] classes = ["TwitterTweetReader"] contains_example = false import_path = "llama_index.readers.twitter"...
llama_index/llama-index-integrations/readers/llama-index-readers-twitter/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-twitter/pyproject.toml", "repo_id": "llama_index", "token_count": 655 }
1,562
[project] name = "chromadb-client" dynamic = ["version"] authors = [ { name="Jeff Huber", email="jeff@trychroma.com" }, { name="Anton Troynikov", email="anton@trychroma.com" } ] description = "Chroma Client." readme = "README.md" requires-python = ">=3.8" classifiers = [ "Programming Language :: Python :: 3", ...
chroma/clients/python/pyproject.toml/0
{ "file_path": "chroma/clients/python/pyproject.toml", "repo_id": "chroma", "token_count": 557 }
39
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querynodev2/tsafe/manager.go/0
{ "file_path": "milvus/internal/querynodev2/tsafe/manager.go", "repo_id": "milvus", "token_count": 1493 }
1,848
"""Gmail toolkit."""
langchain/libs/langchain/langchain/agents/agent_toolkits/gmail/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/gmail/__init__.py", "repo_id": "langchain", "token_count": 8 }
438
"""Azure OpenAI chat wrapper.""" from __future__ import annotations import logging import os import warnings from typing import Any, Callable, Dict, List, Union from langchain_core._api.deprecation import deprecated from langchain_core.outputs import ChatResult from langchain_core.pydantic_v1 import BaseModel, Field,...
langchain/libs/community/langchain_community/chat_models/azure_openai.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/azure_openai.py", "repo_id": "langchain", "token_count": 5206 }
237