text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from langchain_community.agent_toolkits.sql.toolkit import SQLDatabaseToolkit __all__ = ["SQLDatabaseToolkit"]
langchain/libs/langchain/langchain/agents/agent_toolkits/sql/toolkit.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/sql/toolkit.py", "repo_id": "langchain", "token_count": 34 }
438
from abc import abstractmethod import os from typing import ClassVar, Dict, Any import uuid import chromadb from chromadb.config import Component from pathlib import Path from enum import Enum TELEMETRY_WHITELISTED_SETTINGS = [ "chroma_api_impl", "is_persistent", "chroma_server_ssl_enabled", ] class Serv...
chroma/chromadb/telemetry/product/__init__.py/0
{ "file_path": "chroma/chromadb/telemetry/product/__init__.py", "repo_id": "chroma", "token_count": 1226 }
23
from typing import Dict from ..utils import add_end_docstrings from .base import GenericTensor, Pipeline, build_pipeline_init_args @add_end_docstrings( build_pipeline_init_args(has_tokenizer=True, supports_binary_output=False), r""" tokenize_kwargs (`dict`, *optional*): Additional dic...
transformers/src/transformers/pipelines/feature_extraction.py/0
{ "file_path": "transformers/src/transformers/pipelines/feature_extraction.py", "repo_id": "transformers", "token_count": 1276 }
685
pipeline { options { timestamps() } agent { kubernetes { label "milvus-test" defaultContainer 'main' yamlFile "build/ci/jenkins/pod/chaos-test.yaml" customWorkspace '/home/jenkins/agent/workspace' // idle 5 minutes to wait clean up ...
milvus/build/ci/jenkins/DeployTestKafkaMQ.groovy/0
{ "file_path": "milvus/build/ci/jenkins/DeployTestKafkaMQ.groovy", "repo_id": "milvus", "token_count": 10484 }
1,712
python_tests( interpreter_constraints=["==3.9.*", "==3.10.*"], )
llama_index/llama-index-integrations/readers/llama-index-readers-whatsapp/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-whatsapp/tests/BUILD", "repo_id": "llama_index", "token_count": 29 }
1,395
import logging from typing import List, Optional import requests from llama_index.legacy.callbacks.base import CallbackManager from llama_index.legacy.constants import DEFAULT_SIMILARITY_TOP_K from llama_index.legacy.core.base_retriever import BaseRetriever from llama_index.legacy.indices.managed.zilliz.base import Z...
llama_index/llama-index-legacy/llama_index/legacy/indices/managed/zilliz/retriever.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/managed/zilliz/retriever.py", "repo_id": "llama_index", "token_count": 1275 }
1,603
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-google/llama_index/readers/google/drive/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-google/llama_index/readers/google/drive/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,377
from llama_index.readers.patentsview.base import PatentsviewReader __all__ = ["PatentsviewReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-patentsview/llama_index/readers/patentsview/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-patentsview/llama_index/readers/patentsview/__init__.py", "repo_id": "llama_index", "token_count": 32 }
1,357
"""Test ForeFrontAI LLM""" from typing import cast from langchain_core.pydantic_v1 import SecretStr from pytest import CaptureFixture, MonkeyPatch from langchain_community.llms.forefrontai import ForefrontAI def test_forefrontai_api_key_is_secret_string() -> None: """Test that the API key is stored as a Secret...
langchain/libs/community/tests/unit_tests/llms/test_forefrontai.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/llms/test_forefrontai.py", "repo_id": "langchain", "token_count": 624 }
377
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/question_gen/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/question_gen/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,515
"""Llava Completion Pack.""" from typing import Any, Dict from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.llms.replicate import Replicate class LlavaCompletionPack(BaseLlamaPack): """Llava Completion pack.""" def __init__( self, image_url: str, **kwargs:...
llama_index/llama-index-packs/llama-index-packs-llava-completion/llama_index/packs/llava_completion/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-llava-completion/llama_index/packs/llava_completion/base.py", "repo_id": "llama_index", "token_count": 494 }
1,592
package utils import ( "os" "testing" ) const environmentVariable = "CHROMA_KUBERNETES_INTEGRATION" // ShouldRunTests checks if the tests should be run based on an environment variable. func ShouldRunIntegrationTests() bool { // Get the environment variable. envVarValue := os.Getenv(environmentVariable) // Retu...
chroma/go/coordinator/internal/utils/integration.go/0
{ "file_path": "chroma/go/coordinator/internal/utils/integration.go", "repo_id": "chroma", "token_count": 252 }
56
import { CharacterTextSplitter } from "langchain/text_splitter"; import { Document } from "@langchain/core/documents"; export const run = async () => { /* Split text */ const text = "foo bar baz 123"; const splitter = new CharacterTextSplitter({ separator: " ", chunkSize: 7, chunkOverlap: 3, }); ...
langchainjs/examples/src/indexes/text_splitter.ts/0
{ "file_path": "langchainjs/examples/src/indexes/text_splitter.ts", "repo_id": "langchainjs", "token_count": 173 }
824
<jupyter_start><jupyter_text>ClickHouse Vector StoreIn this notebook we are going to show a quick demo of using the ClickHouseVectorStore. If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>!pip install llama-index !pip install clickhouse_connect<jupyter_output><empt...
llama_index/docs/examples/vector_stores/ClickHouseIndexDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/ClickHouseIndexDemo.ipynb", "repo_id": "llama_index", "token_count": 1480 }
1,165
from llama_index.core.storage.chat_store.base import BaseChatStore from llama_index.storage.chat_store.redis import RedisChatStore def test_class(): names_of_base_classes = [b.__name__ for b in RedisChatStore.__mro__] assert BaseChatStore.__name__ in names_of_base_classes
llama_index/llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-redis/tests/test_chat_store_redis_chat_store.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-redis/tests/test_chat_store_redis_chat_store.py", "repo_id": "llama_index", "token_count": 98 }
1,411
# LlamaIndex Agent Integration: Openai
llama_index/llama-index-integrations/agent/llama-index-agent-openai/README.md/0
{ "file_path": "llama_index/llama-index-integrations/agent/llama-index-agent-openai/README.md", "repo_id": "llama_index", "token_count": 10 }
1,224
from pathlib import Path import pandas as pd from langchain.agents import AgentExecutor, OpenAIFunctionsAgent from langchain.tools.retriever import create_retriever_tool from langchain_community.chat_models import ChatOpenAI from langchain_community.embeddings import OpenAIEmbeddings from langchain_community.vectorsto...
langchain/templates/csv-agent/csv_agent/agent.py/0
{ "file_path": "langchain/templates/csv-agent/csv_agent/agent.py", "repo_id": "langchain", "token_count": 956 }
661
from llama_index.indices.managed.zilliz.base import ZillizCloudPipelineIndex from llama_index.indices.managed.zilliz.retriever import ZillizCloudPipelineRetriever __all__ = ["ZillizCloudPipelineIndex", "ZillizCloudPipelineRetriever"]
llama_index/llama-index-integrations/indices/llama-index-indices-managed-zilliz/llama_index/indices/managed/zilliz/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-zilliz/llama_index/indices/managed/zilliz/__init__.py", "repo_id": "llama_index", "token_count": 84 }
1,214
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/memory/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/memory/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,528
# Parts of the code are adapted from the snippets provided in the TorchAudio Wav2Vec forced alignment tutorial. # The full tutorial can be found here: https://pytorch.org/audio/stable/tutorials/forced_alignment_tutorial.html import argparse import os from dataclasses import dataclass import torch import torchaudio fr...
transformers/examples/research_projects/wav2vec2/alignment.py/0
{ "file_path": "transformers/examples/research_projects/wav2vec2/alignment.py", "repo_id": "transformers", "token_count": 4170 }
558
// Code generated by mockery v2.32.4. DO NOT EDIT. package segments import ( commonpb "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" mock "github.com/stretchr/testify/mock" querypb "github.com/milvus-io/milvus/internal/proto/querypb" ) // MockSegmentManager is an autogenerated mock type for the SegmentMa...
milvus/internal/querynodev2/segments/mock_segment_manager.go/0
{ "file_path": "milvus/internal/querynodev2/segments/mock_segment_manager.go", "repo_id": "milvus", "token_count": 8453 }
1,993
import { z } from "zod"; import { openAICompletionToTextGenerationStream } from "./openAICompletionToTextGenerationStream"; import { openAIChatToTextGenerationStream } from "./openAIChatToTextGenerationStream"; import { buildPrompt } from "$lib/buildPrompt"; import { OPENAI_API_KEY } from "$env/static/private"; import ...
chat-ui/src/lib/server/endpoints/openai/endpointOai.ts/0
{ "file_path": "chat-ui/src/lib/server/endpoints/openai/endpointOai.ts", "repo_id": "chat-ui", "token_count": 1047 }
89
from langchain_community.chat_models.everlyai import ( ChatEverlyAI, ) __all__ = ["ChatEverlyAI"]
langchain/libs/langchain/langchain/chat_models/everlyai.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_models/everlyai.py", "repo_id": "langchain", "token_count": 39 }
470
<!--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/squeezebert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/squeezebert.md", "repo_id": "transformers", "token_count": 1205 }
464
<jupyter_start><jupyter_text>Document LoadingLoad a blog post on agents.<jupyter_code>! pip install pdf2image<jupyter_output><empty_output><jupyter_text>Load academic papers -<jupyter_code>import arxiv from langchain_community.chat_models import ChatAnthropic from langchain_community.document_loaders import ArxivLoader...
langchain/templates/summarize-anthropic/summarize_anthropic.ipynb/0
{ "file_path": "langchain/templates/summarize-anthropic/summarize_anthropic.ipynb", "repo_id": "langchain", "token_count": 395 }
712
# coding=utf-8 # Copyright 2022 SHI Labs and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
transformers/src/transformers/models/oneformer/convert_to_hf_oneformer.py/0
{ "file_path": "transformers/src/transformers/models/oneformer/convert_to_hf_oneformer.py", "repo_id": "transformers", "token_count": 26214 }
639
"""Init params."""
llama_index/llama-index-legacy/llama_index/legacy/finetuning/embeddings/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/finetuning/embeddings/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,491
python_sources()
llama_index/llama-index-packs/llama-index-packs-agent-search-retriever/examples/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-agent-search-retriever/examples/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,767
<jupyter_start><jupyter_text>Tencent Cloud VectorDB>[Tencent Cloud VectorDB](https://cloud.tencent.com/document/product/1709) is a fully managed, self-developed, enterprise-level distributed database service designed for storing, retrieving, and analyzing multi-dimensional vector data. The database supports multiple in...
langchain/docs/docs/integrations/vectorstores/tencentvectordb.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/tencentvectordb.ipynb", "repo_id": "langchain", "token_count": 631 }
186
# Copyright 2024 PixArt-Alpha Authors and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
diffusers/src/diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py", "repo_id": "diffusers", "token_count": 19802 }
261
"""Tavily tool spec.""" from typing import List, Optional from llama_index.core.schema import Document from llama_index.core.tools.tool_spec.base import BaseToolSpec class TavilyToolSpec(BaseToolSpec): """Tavily tool spec.""" spec_functions = [ "search", ] def __init__(self, api_key: str) ...
llama_index/llama-index-integrations/tools/llama-index-tools-tavily-research/llama_index/tools/tavily_research/base.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-tavily-research/llama_index/tools/tavily_research/base.py", "repo_id": "llama_index", "token_count": 501 }
1,530
# coding=utf-8 # Copyright 2018 The Microsoft Research Asia LayoutLM Team Authors and the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/...
transformers/src/transformers/models/layoutlm/modeling_tf_layoutlm.py/0
{ "file_path": "transformers/src/transformers/models/layoutlm/modeling_tf_layoutlm.py", "repo_id": "transformers", "token_count": 31687 }
619
from importlib import metadata ## Create namespaces for pydantic v1 and v2. # This code must stay at the top of the file before other modules may # attempt to import pydantic since it adds pydantic_v1 and pydantic_v2 to sys.modules. # # This hack is done for the following reasons: # * Langchain will attempt to remain ...
langchain/libs/core/langchain_core/pydantic_v1/__init__.py/0
{ "file_path": "langchain/libs/core/langchain_core/pydantic_v1/__init__.py", "repo_id": "langchain", "token_count": 293 }
428
--- sidebar_label: Google Vertex AI --- import CodeBlock from "@theme/CodeBlock"; # ChatGoogleVertexAI LangChain.js supports Google Vertex AI chat models as an integration. It supports two different methods of authentication based on whether you're running in a Node environment or a web environment. ## Setup ### N...
langchainjs/docs/core_docs/docs/integrations/chat/google_vertex_ai.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/chat/google_vertex_ai.mdx", "repo_id": "langchainjs", "token_count": 962 }
753
# 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/tests/utils/test_file_utils.py/0
{ "file_path": "transformers/tests/utils/test_file_utils.py", "repo_id": "transformers", "token_count": 2005 }
769
# coding=utf-8 # Copyright 2023 IBM 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.org/licenses/LICENSE-2.0 # # Unle...
transformers/src/transformers/models/patchtsmixer/configuration_patchtsmixer.py/0
{ "file_path": "transformers/src/transformers/models/patchtsmixer/configuration_patchtsmixer.py", "repo_id": "transformers", "token_count": 4710 }
652
import { logVersion010MigrationWarning } from "../../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "tools/gmail", }); export * from "@langchain/community/tools/gmail";
langchainjs/langchain/src/tools/gmail/index.ts/0
{ "file_path": "langchainjs/langchain/src/tools/gmail/index.ts", "repo_id": "langchainjs", "token_count": 69 }
916
from langchain_community.retrievers.vespa_retriever import VespaRetriever __all__ = ["VespaRetriever"]
langchain/libs/langchain/langchain/retrievers/vespa_retriever.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/vespa_retriever.py", "repo_id": "langchain", "token_count": 37 }
572
{ "name": "test-exports-vercel", "version": "0.1.0", "workspaces": [ "libs/*" ], "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "test": "next lint" }, "dependencies": { "@langchain/anthropic": "workspace:*", "@langchain/communit...
langchainjs/environment_tests/test-exports-vercel/package.json/0
{ "file_path": "langchainjs/environment_tests/test-exports-vercel/package.json", "repo_id": "langchainjs", "token_count": 347 }
776
export { RemoteRetriever, type RemoteRetrieverParams, type RemoteRetrieverAuth, type RemoteRetrieverValues, } from "@langchain/community/retrievers/remote"; export { ChatGPTPluginRetriever, type ChatGPTPluginRetrieverFilter, type ChatGPTPluginRetrieverParams, } from "./chatgpt-plugin.js"; export { Remot...
langchainjs/langchain/src/retrievers/remote/index.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/remote/index.ts", "repo_id": "langchainjs", "token_count": 143 }
959
python_sources() python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/playground/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/playground/BUILD", "repo_id": "llama_index", "token_count": 32 }
1,810
import sys from io import StringIO from typing import Any, Dict, List, Tuple from llama_index.core.agent.types import BaseAgent from llama_index.core.llama_pack.base import BaseLlamaPack class Capturing(list): """To capture the stdout from `BaseAgent.stream_chat` with `verbose=True`. Taken from https://stack...
llama_index/llama-index-packs/llama-index-packs-gradio-agent-chat/llama_index/packs/gradio_agent_chat/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-gradio-agent-chat/llama_index/packs/gradio_agent_chat/base.py", "repo_id": "llama_index", "token_count": 2635 }
1,586
from rag_aws_kendra.chain import chain if __name__ == "__main__": query = "Does Kendra support table extraction?" print(chain.invoke(query)) # noqa: T201
langchain/templates/rag-aws-kendra/main.py/0
{ "file_path": "langchain/templates/rag-aws-kendra/main.py", "repo_id": "langchain", "token_count": 57 }
688
import type { BaseLanguageModelInterface, BaseLanguageModelInput, BaseFunctionCallOptions, } from "@langchain/core/language_models/base"; import type { StructuredToolInterface } from "@langchain/core/tools"; import type { BaseChatModel } from "@langchain/core/language_models/chat_models"; import { Runnable, R...
langchainjs/langchain/src/agents/openai_functions/index.ts/0
{ "file_path": "langchainjs/langchain/src/agents/openai_functions/index.ts", "repo_id": "langchainjs", "token_count": 3617 }
878
from llama_index.legacy.node_parser.text.code import CodeSplitter from llama_index.legacy.node_parser.text.langchain import LangchainNodeParser from llama_index.legacy.node_parser.text.semantic_splitter import ( SemanticSplitterNodeParser, ) from llama_index.legacy.node_parser.text.sentence import SentenceSplitter ...
llama_index/llama-index-legacy/llama_index/legacy/node_parser/text/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/node_parser/text/__init__.py", "repo_id": "llama_index", "token_count": 223 }
1,744
{ "modelname": "Template", "uppercase_modelname": "TEMPLATE", "lowercase_modelname": "template", "camelcase_modelname": "Template", "authors": "The HuggingFace Team", "checkpoint_identifier": "brand-new-bert-base-cased", "tokenizer_type": "Based on BERT", "generate_tensorflow_pytorch_and_flax": "PyTorch...
transformers/templates/adding_a_new_model/tests/encoder-bert-tokenizer.json/0
{ "file_path": "transformers/templates/adding_a_new_model/tests/encoder-bert-tokenizer.json", "repo_id": "transformers", "token_count": 148 }
762
import { expect, test } from "@jest/globals"; import { FewShotChatMessagePromptTemplate, FewShotPromptTemplate, } from "../few_shot.js"; import { ChatPromptTemplate } from "../index.js"; import { PromptTemplate } from "../prompt.js"; import { LengthBasedExampleSelector } from "../../example_selectors/length_based.j...
langchainjs/langchain-core/src/prompts/tests/few_shot.test.ts/0
{ "file_path": "langchainjs/langchain-core/src/prompts/tests/few_shot.test.ts", "repo_id": "langchainjs", "token_count": 3014 }
837
apiVersion: v1 kind: Service metadata: name: segment-server namespace: chroma spec: ports: - name: segment-server-port port: 50051 targetPort: 50051 selector: app: segment-server type: ClusterIP --- apiVersion: apps/v1 kind: Deployment metadata: name: segment-server namespace: chroma...
chroma/k8s/deployment/segment-server.yaml/0
{ "file_path": "chroma/k8s/deployment/segment-server.yaml", "repo_id": "chroma", "token_count": 883 }
57
## Examples > Searching for community contributions! Join the [#contributing](https://discord.com/channels/1073293645303795742/1074711539724058635) Discord Channel to discuss. This folder will contain an ever-growing set of examples. The key with examples is that they should *always* work. The failure mode of exampl...
chroma/examples/README.md/0
{ "file_path": "chroma/examples/README.md", "repo_id": "chroma", "token_count": 454 }
38
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/proxy/task_statistic_test.go/0
{ "file_path": "milvus/internal/proxy/task_statistic_test.go", "repo_id": "milvus", "token_count": 2753 }
2,025
use symphonia::core::audio::{AudioBufferRef, Signal}; use symphonia::core::codecs::{DecoderOptions, CODEC_TYPE_NULL}; use symphonia::core::conv::FromSample; fn conv<T>(samples: &mut Vec<f32>, data: std::borrow::Cow<symphonia::core::audio::AudioBuffer<T>>) where T: symphonia::core::sample::Sample, f32: symphoni...
candle/candle-examples/examples/whisper/pcm_decode.rs/0
{ "file_path": "candle/candle-examples/examples/whisper/pcm_decode.rs", "repo_id": "candle", "token_count": 1267 }
50
<jupyter_start><jupyter_text>WhyLabs>[WhyLabs](https://docs.whylabs.ai/docs/) is an observability platform designed to monitor data pipelines and ML applications for data quality regressions, data drift, and model performance degradation. Built on top of an open-source package called `whylogs`, the platform enables Dat...
langchain/docs/docs/integrations/providers/whylabs_profiling.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/providers/whylabs_profiling.ipynb", "repo_id": "langchain", "token_count": 1078 }
157
from copy import deepcopy __all__ = ['get_img_extensions', 'is_img_extension', 'set_img_extensions', 'add_img_extensions', 'del_img_extensions'] IMG_EXTENSIONS = ('.png', '.jpg', '.jpeg') # singleton, kept public for bwd compat use _IMG_EXTENSIONS_SET = set(IMG_EXTENSIONS) # set version, private, kept in sync de...
pytorch-image-models/timm/data/readers/img_extensions.py/0
{ "file_path": "pytorch-image-models/timm/data/readers/img_extensions.py", "repo_id": "pytorch-image-models", "token_count": 582 }
370
<!--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/tutorial/peft_model_config.md/0
{ "file_path": "peft/docs/source/tutorial/peft_model_config.md", "repo_id": "peft", "token_count": 2415 }
323
# 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/dependency_versions_check.py/0
{ "file_path": "transformers/src/transformers/dependency_versions_check.py", "repo_id": "transformers", "token_count": 759 }
593
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/convert_tf_hub_seq_to_seq_bert_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/convert_tf_hub_seq_to_seq_bert_to_pytorch.py", "repo_id": "transformers", "token_count": 1130 }
591
from __future__ import annotations from typing import TYPE_CHECKING, Tuple, Union from langchain.chains.query_constructor.ir import ( Comparator, Comparison, Operation, Operator, StructuredQuery, Visitor, ) if TYPE_CHECKING: from timescale_vector import client class TimescaleVectorTrans...
langchain/libs/langchain/langchain/retrievers/self_query/timescalevector.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/self_query/timescalevector.py", "repo_id": "langchain", "token_count": 1139 }
561
import base64 import json from langchain_community.chat_models import ChatOpenAI from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate, SystemMessagePromptTemplate from langchain_core.pydantic_v1 import Field from langserve import CustomUserType from .prompts ...
langchain/templates/plate-chain/plate_chain/chain.py/0
{ "file_path": "langchain/templates/plate-chain/plate_chain/chain.py", "repo_id": "langchain", "token_count": 1059 }
708
import random from sklearn import preprocessing import numpy as np import sys import json import time from utils import constant from utils.utils import gen_collection_name from utils.util_log import test_log as logger import pytest from base.testbase import TestBase from utils.utils import (get_data_by_payload, get_co...
milvus/tests/restful_client/testcases/test_vector_operations.py/0
{ "file_path": "milvus/tests/restful_client/testcases/test_vector_operations.py", "repo_id": "milvus", "token_count": 16876 }
1,985
from typing import List from langchain_core.chat_history import ( BaseChatMessageHistory, ) from langchain_core.messages import BaseMessage from langchain_core.pydantic_v1 import BaseModel, Field class ChatMessageHistory(BaseChatMessageHistory, BaseModel): """In memory implementation of chat message history....
langchain/libs/core/tests/unit_tests/fake/memory.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/fake/memory.py", "repo_id": "langchain", "token_count": 206 }
404
# Component Wise Evaluation To do more in-depth evaluation of your pipeline, it helps to break it down into an evaluation of individual components. For instance, a particular failure case may be due to a combination of not retrieving the right documents and also the LLM misunderstanding the context and hallucinating ...
llama_index/docs/optimizing/evaluation/component_wise_evaluation.md/0
{ "file_path": "llama_index/docs/optimizing/evaluation/component_wise_evaluation.md", "repo_id": "llama_index", "token_count": 638 }
1,108
from __future__ import annotations # allows pydantic model to reference itself import re from typing import Any, List, Optional, Union from langchain_community.graphs.networkx_graph import NetworkxEntityGraph from langchain_experimental.cpal.constants import Constant from langchain_experimental.pydantic_v1 import (...
langchain/libs/experimental/langchain_experimental/cpal/models.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/cpal/models.py", "repo_id": "langchain", "token_count": 3831 }
428
# Inception ResNet v2 **Inception-ResNet-v2** is a convolutional neural architecture that builds on the Inception family of architectures but incorporates [residual connections](https://paperswithcode.com/method/residual-connection) (replacing the filter concatenation stage of the Inception architecture). {% include ...
pytorch-image-models/docs/models/.templates/models/inception-resnet-v2.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/inception-resnet-v2.md", "repo_id": "pytorch-image-models", "token_count": 864 }
337
from __future__ import annotations import json import logging import uuid import warnings from itertools import repeat from typing import ( Any, Iterable, List, Optional, Tuple, Type, ) from langchain_core.embeddings import Embeddings from langchain_core.vectorstores import VectorStore from l...
langchain/libs/community/langchain_community/vectorstores/yellowbrick.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/yellowbrick.py", "repo_id": "langchain", "token_count": 5090 }
338
<jupyter_start><jupyter_text>PGVector>[PGVector](https://github.com/pgvector/pgvector) is an open-source vector similarity search for `Postgres`It supports:- exact and approximate nearest neighbor search- L2 distance, inner product, and cosine distanceThis notebook shows how to use the Postgres vector database (`PGVect...
langchain/docs/docs/integrations/vectorstores/pgvector.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/pgvector.ipynb", "repo_id": "langchain", "token_count": 1945 }
184
# Replicate This page covers how to run models on Replicate within LangChain. ## Installation and Setup - Create a [Replicate](https://replicate.com) account. Get your API key and set it as an environment variable (`REPLICATE_API_TOKEN`) - Install the [Replicate python client](https://github.com/replicate/replicate-py...
langchain/docs/docs/integrations/providers/replicate.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/replicate.mdx", "repo_id": "langchain", "token_count": 685 }
157
<jupyter_start><jupyter_text>Cap the max number of iterationsThis notebook walks through how to cap an agent at taking a certain number of steps. This can be useful to ensure that they do not go haywire and take too many steps.<jupyter_code>from langchain import hub from langchain.agents import AgentExecutor, create_re...
langchain/docs/docs/modules/agents/how_to/max_iterations.ipynb/0
{ "file_path": "langchain/docs/docs/modules/agents/how_to/max_iterations.ipynb", "repo_id": "langchain", "token_count": 1022 }
197
# coding=utf-8 # Copyright 2022 Meta Platforms, Inc. and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses...
transformers/src/transformers/models/regnet/modeling_regnet.py/0
{ "file_path": "transformers/src/transformers/models/regnet/modeling_regnet.py", "repo_id": "transformers", "token_count": 7184 }
651
# Frequently Asked Questions (FAQ) --- ##### [Large Language Models (LLM)](./faq/llms.md) Discover how to tailor LLMs, explore available models, understand cost implications, and switch between languages. ```{toctree} --- maxdepth: 1 hidden: true --- faq/llms.md ``` --- ##### [Embeddings](./faq/embeddings.md) H...
llama_index/docs/community/frequently_asked_questions.md/0
{ "file_path": "llama_index/docs/community/frequently_asked_questions.md", "repo_id": "llama_index", "token_count": 456 }
1,038
import hashlib from pathlib import Path from typing import Any, Dict, Iterable, Tuple, Union def import_spacy() -> Any: """Import the spacy python package and raise an error if it is not installed.""" try: import spacy except ImportError: raise ImportError( "This callback manag...
langchain/libs/community/langchain_community/callbacks/utils.py/0
{ "file_path": "langchain/libs/community/langchain_community/callbacks/utils.py", "repo_id": "langchain", "token_count": 3538 }
219
.PHONY: tests lint format tests: poetry run pytest tests/unit_tests tests_watch: poetry run ptw --now . -- -vv -x tests/unit_tests integration_tests: poetry run pytest -v --durations=10 --cov=langsmith --cov-report=term-missing --cov-report=html --cov-config=.coveragerc tests/integration_tests integration_tests...
langsmith-sdk/python/Makefile/0
{ "file_path": "langsmith-sdk/python/Makefile", "repo_id": "langsmith-sdk", "token_count": 258 }
1,148
import io import json from itertools import islice from typing import Any, Callable, Dict, List import numpy as np import pyarrow as pa import datasets logger = datasets.utils.logging.get_logger(__name__) class WebDataset(datasets.GeneratorBasedBuilder): DEFAULT_WRITER_BATCH_SIZE = 100 IMAGE_EXTENSIONS: L...
datasets/src/datasets/packaged_modules/webdataset/webdataset.py/0
{ "file_path": "datasets/src/datasets/packaged_modules/webdataset/webdataset.py", "repo_id": "datasets", "token_count": 4107 }
133
"""Test Zilliz functionality.""" from typing import List, Optional from langchain_core.documents import Document from langchain_community.vectorstores import Zilliz from tests.integration_tests.vectorstores.fake_embeddings import ( FakeEmbeddings, fake_texts, ) def _zilliz_from_texts( metadatas: Optiona...
langchain/libs/community/tests/integration_tests/vectorstores/test_zilliz.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_zilliz.py", "repo_id": "langchain", "token_count": 1254 }
380
import unittest import torch from torch import nn from diffusers.models.activations import get_activation class ActivationsTests(unittest.TestCase): def test_swish(self): act = get_activation("swish") self.assertIsInstance(act, nn.SiLU) self.assertEqual(act(torch.tensor(-100, dtype=tor...
diffusers/tests/models/test_activations.py/0
{ "file_path": "diffusers/tests/models/test_activations.py", "repo_id": "diffusers", "token_count": 845 }
264
# Microsoft All functionality related to `Microsoft Azure` and other `Microsoft` products. ## LLM ### Azure OpenAI > [Microsoft Azure](https://en.wikipedia.org/wiki/Microsoft_Azure), often referred to as `Azure` is a cloud computing platform run by `Microsoft`, which offers access, management, and development of ap...
langchainjs/docs/core_docs/docs/integrations/platforms/microsoft.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/platforms/microsoft.mdx", "repo_id": "langchainjs", "token_count": 1497 }
734
<jupyter_start><jupyter_text>Elasticsearch[](https://colab.research.google.com/github/langchain-ai/langchain/blob/master/docs/docs/use_cases/qa_structured/integrations/elasticsearch.ipynb)We can use LLMs to interact with Elasticsearch analytics databases in natural language.This chain builds search queries via the Elas...
langchain/cookbook/elasticsearch_db_qa.ipynb/0
{ "file_path": "langchain/cookbook/elasticsearch_db_qa.ipynb", "repo_id": "langchain", "token_count": 893 }
71
import type { AgentStep } from "@langchain/core/agents"; import { type BaseMessage, AIMessage, HumanMessage, } from "@langchain/core/messages"; import { renderTemplate } from "@langchain/core/prompts"; export function formatLogToMessage( intermediateSteps: AgentStep[], templateToolResponse = "{observation}" ...
langchainjs/langchain/src/agents/format_scratchpad/log_to_message.ts/0
{ "file_path": "langchainjs/langchain/src/agents/format_scratchpad/log_to_message.ts", "repo_id": "langchainjs", "token_count": 353 }
913
from langchain_community.agent_toolkits.spark_sql.toolkit import SparkSQLToolkit __all__ = ["SparkSQLToolkit"]
langchain/libs/langchain/langchain/agents/agent_toolkits/spark_sql/toolkit.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/spark_sql/toolkit.py", "repo_id": "langchain", "token_count": 38 }
463
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-awadb/llama_index/vector_stores/awadb/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-awadb/llama_index/vector_stores/awadb/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,544
import logging from pathlib import Path from langchain.retrievers.multi_vector import MultiVectorRetriever from langchain.storage import LocalFileStore from langchain_community.embeddings import OpenAIEmbeddings from langchain_community.vectorstores import Chroma logging.basicConfig(level=logging.INFO) logger = logg...
langchain/templates/propositional-retrieval/propositional_retrieval/storage.py/0
{ "file_path": "langchain/templates/propositional-retrieval/propositional_retrieval/storage.py", "repo_id": "langchain", "token_count": 404 }
678
# Semantic segmentation Semantic segmentation datasets are used to train a model to classify every pixel in an image. There are a wide variety of applications enabled by these datasets such as background removal from images, stylizing images, or scene understanding for autonomous driving. This guide will show you how ...
datasets/docs/source/semantic_segmentation.mdx/0
{ "file_path": "datasets/docs/source/semantic_segmentation.mdx", "repo_id": "datasets", "token_count": 2142 }
125
# SelecSLS **SelecSLS** uses novel selective long and short range skip connections to improve the information flow allowing for a drastically faster network without compromising accuracy. {% include 'code_snippets.md' %} ## How do I train this model? You can follow the [timm recipe scripts](https://rwightman.github...
pytorch-image-models/docs/models/.templates/models/selecsls.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/selecsls.md", "repo_id": "pytorch-image-models", "token_count": 1608 }
348
python_tests()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum-intel/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum-intel/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,262
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
diffusers/examples/instruct_pix2pix/train_instruct_pix2pix.py/0
{ "file_path": "diffusers/examples/instruct_pix2pix/train_instruct_pix2pix.py", "repo_id": "diffusers", "token_count": 19582 }
215
import { BaseMessage, HumanMessage } from "@langchain/core/messages"; /** * Contains the chunk of messages, along with the * users response, which is the next message after the chunk. */ export type MessageChunkResult = { chunkedMessages: BaseMessage[]; /** * User response can be undefined if the last messag...
langchainjs/langchain/src/experimental/chains/violation_of_expectations/types.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/chains/violation_of_expectations/types.ts", "repo_id": "langchainjs", "token_count": 759 }
894
<jupyter_start><jupyter_text>*Introducing Hugging Face's new library for diffusion models*Diffusion models proved themselves very effective in artificial synthesis, even beating GANs for images. Because of that, they gained traction in the machine learning community and play an important role for systems like [DALL-E 2...
notebooks/diffusers/diffusers_intro.ipynb/0
{ "file_path": "notebooks/diffusers/diffusers_intro.ipynb", "repo_id": "notebooks", "token_count": 6228 }
302
from langchain_community.retrievers.bedrock import ( AmazonKnowledgeBasesRetriever, RetrievalConfig, VectorSearchConfig, ) __all__ = ["VectorSearchConfig", "RetrievalConfig", "AmazonKnowledgeBasesRetriever"]
langchain/libs/langchain/langchain/retrievers/bedrock.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/bedrock.py", "repo_id": "langchain", "token_count": 74 }
532
#!/usr/bin/env python # 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/LI...
transformers/examples/research_projects/xtreme-s/run_xtreme_s.py/0
{ "file_path": "transformers/examples/research_projects/xtreme-s/run_xtreme_s.py", "repo_id": "transformers", "token_count": 16446 }
549
# 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 required by appl...
trl/examples/scripts/ppo.py/0
{ "file_path": "trl/examples/scripts/ppo.py", "repo_id": "trl", "token_count": 2729 }
788
import torch from diffusers import EulerDiscreteScheduler from diffusers.utils.testing_utils import torch_device from .test_schedulers import SchedulerCommonTest class EulerDiscreteSchedulerTest(SchedulerCommonTest): scheduler_classes = (EulerDiscreteScheduler,) num_inference_steps = 10 def get_schedul...
diffusers/tests/schedulers/test_scheduler_euler.py/0
{ "file_path": "diffusers/tests/schedulers/test_scheduler_euler.py", "repo_id": "diffusers", "token_count": 3093 }
292
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-make-com/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-make-com/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,331
import { ChatOpenAI } from "@langchain/openai"; import { ConversationChain } from "langchain/chains"; import { ZepMemory } from "@langchain/community/memory/zep"; import { randomUUID } from "crypto"; const sessionId = randomUUID(); // This should be unique for each user or each user's session. const zepURL = "http://l...
langchainjs/examples/src/memory/zep.ts/0
{ "file_path": "langchainjs/examples/src/memory/zep.ts", "repo_id": "langchainjs", "token_count": 413 }
818
"""S3 file and directory reader. A loader that fetches a file or iterates through a directory on AWS S3. """ import os import shutil import tempfile from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Union from llama_index.core.readers import SimpleDirectoryReader from llama_index.core....
llama_index/llama-index-integrations/readers/llama-index-readers-s3/llama_index/readers/s3/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-s3/llama_index/readers/s3/base.py", "repo_id": "llama_index", "token_count": 2606 }
1,453
from langchain_community.vectorstores.typesense import Typesense __all__ = ["Typesense"]
langchain/libs/langchain/langchain/vectorstores/typesense.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/typesense.py", "repo_id": "langchain", "token_count": 25 }
580
# 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/whisper/test_modeling_flax_whisper.py/0
{ "file_path": "transformers/tests/models/whisper/test_modeling_flax_whisper.py", "repo_id": "transformers", "token_count": 18549 }
796
from unittest.mock import AsyncMock, MagicMock, patch import numpy as np import pytest from llama_index.embeddings.huggingface.base import HuggingFaceInferenceAPIEmbedding from llama_index.embeddings.huggingface.pooling import Pooling STUB_MODEL_NAME = "placeholder_model" @pytest.fixture(name="hf_inference_api_embe...
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/tests/test_hf_inference.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/tests/test_hf_inference.py", "repo_id": "llama_index", "token_count": 1954 }
1,365
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/model_doc/convnext.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/convnext.md", "repo_id": "transformers", "token_count": 2141 }
542
"""Use to load blobs from the local file system.""" from pathlib import Path from typing import Callable, Iterable, Iterator, Optional, Sequence, TypeVar, Union from langchain_community.document_loaders.blob_loaders.schema import Blob, BlobLoader T = TypeVar("T") def _make_iterator( length_func: Callable[[], i...
langchain/libs/community/langchain_community/document_loaders/blob_loaders/file_system.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/blob_loaders/file_system.py", "repo_id": "langchain", "token_count": 2396 }
245
# flake8: noqa GET_ISSUES_PROMPT = """ This tool will fetch a list of the repository's issues. It will return the title, and issue number of 5 issues. It takes no input.""" GET_ISSUE_PROMPT = """ This tool will fetch the title, body, and comment thread of a specific issue. **VERY IMPORTANT**: You must specify the issu...
langchain/libs/community/langchain_community/tools/github/prompt.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/github/prompt.py", "repo_id": "langchain", "token_count": 1620 }
302
# coding=utf-8 # Copyright 2021 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/speech_to_text/test_modeling_tf_speech_to_text.py/0
{ "file_path": "transformers/tests/models/speech_to_text/test_modeling_tf_speech_to_text.py", "repo_id": "transformers", "token_count": 11904 }
824