text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
__version__ = "0.27.0.dev0" from typing import TYPE_CHECKING from .utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_k_diffusion_available, is_librosa_available, is_note_seq_available, is_onnx_available, is_scipy_available, ...
diffusers/src/diffusers/__init__.py/0
{ "file_path": "diffusers/src/diffusers/__init__.py", "repo_id": "diffusers", "token_count": 13685 }
208
import type { EmbeddingsInterface } from "./embeddings.js"; import type { DocumentInterface } from "./documents/document.js"; import { BaseRetriever, BaseRetrieverInterface, type BaseRetrieverInput, } from "./retrievers.js"; import { Serializable } from "./load/serializable.js"; import { CallbackManagerForRetri...
langchainjs/langchain-core/src/vectorstores.ts/0
{ "file_path": "langchainjs/langchain-core/src/vectorstores.ts", "repo_id": "langchainjs", "token_count": 3919 }
837
<jupyter_start><jupyter_text>FalkorDBQAChain This notebook shows how to use LLMs to provide a natural language interface to FalkorDB database.FalkorDB is a low latency property graph database management system. You can simply run its docker locally:```bashdocker run -p 6379:6379 -it --rm falkordb/falkordb:edge```Once l...
langchain/docs/docs/use_cases/graph/graph_falkordb_qa.ipynb/0
{ "file_path": "langchain/docs/docs/use_cases/graph/graph_falkordb_qa.ipynb", "repo_id": "langchain", "token_count": 1029 }
202
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-memos/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-memos/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,426
<jupyter_start><jupyter_text>---sidebar_position: 0.5title: Why use LCEL---import { ColumnContainer, Column } from \"@theme/Columns\";<jupyter_code>:::tip We recommend reading the LCEL [Get started](/docs/expression_language/get_started) section first. ::: LCEL makes it easy to build complex chains from basic componen...
langchain/docs/docs/expression_language/why.ipynb/0
{ "file_path": "langchain/docs/docs/expression_language/why.ipynb", "repo_id": "langchain", "token_count": 6548 }
86
include timm/models/_pruned/*.txt include timm/data/_info/*.txt include timm/data/_info/*.json
pytorch-image-models/MANIFEST.in/0
{ "file_path": "pytorch-image-models/MANIFEST.in", "repo_id": "pytorch-image-models", "token_count": 34 }
342
from llama_index.readers.s3.base import S3Reader __all__ = ["S3Reader"]
llama_index/llama-index-integrations/readers/llama-index-readers-s3/llama_index/readers/s3/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-s3/llama_index/readers/s3/__init__.py", "repo_id": "llama_index", "token_count": 29 }
1,516
from typing import List from unittest.mock import Mock from langchain_core.embeddings import Embeddings from langchain_astradb.vectorstores import AstraDBVectorStore class SomeEmbeddings(Embeddings): """ Turn a sentence into an embedding vector in some way. Not important how. It is deterministic is all ...
langchain/libs/partners/astradb/tests/unit_tests/test_vectorstores.py/0
{ "file_path": "langchain/libs/partners/astradb/tests/unit_tests/test_vectorstores.py", "repo_id": "langchain", "token_count": 566 }
623
# coding=utf-8 # Copyright 2021 Google Research 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-...
transformers/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py/0
{ "file_path": "transformers/src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py", "repo_id": "transformers", "token_count": 66863 }
571
import * as uuid from "uuid"; import type { EmbeddingsInterface } from "@langchain/core/embeddings"; import { VectorStore } from "@langchain/core/vectorstores"; import { Document } from "@langchain/core/documents"; /** * Type definition for the arguments required to initialize a * TigrisVectorStore instance. */ ex...
langchainjs/libs/langchain-community/src/vectorstores/tigris.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tigris.ts", "repo_id": "langchainjs", "token_count": 2008 }
987
# coding=utf-8 # Copyright Iz Beltagy, Matthew E. Peters, Arman Cohan 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.ap...
transformers/tests/models/led/test_modeling_tf_led.py/0
{ "file_path": "transformers/tests/models/led/test_modeling_tf_led.py", "repo_id": "transformers", "token_count": 6455 }
791
import traceback import copy import os from utils.util_log import test_log as log # enable_traceback = os.getenv('ENABLE_TRACEBACK', "True") # log.info(f"enable_traceback:{enable_traceback}") class Error: def __init__(self, error): self.code = getattr(error, 'code', -1) self.message = getattr(err...
milvus/tests/python_client/utils/api_request.py/0
{ "file_path": "milvus/tests/python_client/utils/api_request.py", "repo_id": "milvus", "token_count": 1125 }
1,983
# 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/models/dpr/__init__.py/0
{ "file_path": "transformers/src/transformers/models/dpr/__init__.py", "repo_id": "transformers", "token_count": 2002 }
654
import streamlit as st from pathlib import Path from langchain.llms.openai import OpenAI from langchain.agents import create_sql_agent from langchain.sql_database import SQLDatabase from langchain.agents.agent_types import AgentType from langchain.callbacks import StreamlitCallbackHandler from langchain.agents.agent_to...
streamlit-agent/streamlit_agent/chat_with_sql_db.py/0
{ "file_path": "streamlit-agent/streamlit_agent/chat_with_sql_db.py", "repo_id": "streamlit-agent", "token_count": 1140 }
2,062
""" Github API client for the LlamaIndex library. This module contains the Github API client for the LlamaIndex library. It is used by the Github readers to retrieve the data from Github. """ import os from dataclasses import dataclass from typing import Any, Dict, List, Optional from dataclasses_json import DataCla...
llama_index/llama-index-legacy/llama_index/legacy/readers/github_readers/github_api_client.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/github_readers/github_api_client.py", "repo_id": "llama_index", "token_count": 5438 }
1,704
from llama_index.llms.cohere.base import Cohere __all__ = ["Cohere"]
llama_index/llama-index-integrations/llms/llama-index-llms-cohere/llama_index/llms/cohere/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-cohere/llama_index/llms/cohere/__init__.py", "repo_id": "llama_index", "token_count": 27 }
1,393
from langchain_community.document_loaders.base import BaseBlobParser, BaseLoader __all__ = ["BaseLoader", "BaseBlobParser"]
langchain/libs/langchain/langchain/document_loaders/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/base.py", "repo_id": "langchain", "token_count": 37 }
479
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querycoordv2/balance/rowcount_based_balancer_test.go/0
{ "file_path": "milvus/internal/querycoordv2/balance/rowcount_based_balancer_test.go", "repo_id": "milvus", "token_count": 16675 }
1,750
# 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/perceiver/test_modeling_perceiver.py/0
{ "file_path": "transformers/tests/models/perceiver/test_modeling_perceiver.py", "repo_id": "transformers", "token_count": 20715 }
727
{"[MASK]": 0, "[UNK]": 1, "[PAD]": 2, "DUMMY": 3, "DUMMY2": 4, "[MASK2]": 5}
transformers/tests/fixtures/test_entity_vocab.json/0
{ "file_path": "transformers/tests/fixtures/test_entity_vocab.json", "repo_id": "transformers", "token_count": 45 }
794
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/ipynb/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/ipynb/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,317
<jupyter_start><jupyter_text>Extracting Metadata for Better Document Indexing and UnderstandingIn many cases, especially with long documents, a chunk of text may lack the context necessary to disambiguate the chunk from other similar chunks of text. One method of addressing this is manually labelling each chunk in our ...
llama_index/docs/examples/metadata_extraction/MetadataExtractionSEC.ipynb/0
{ "file_path": "llama_index/docs/examples/metadata_extraction/MetadataExtractionSEC.ipynb", "repo_id": "llama_index", "token_count": 3577 }
1,067
from __future__ import annotations import concurrent.futures from typing import Any, Iterable, List, Optional import numpy as np from langchain_core.callbacks import CallbackManagerForRetrieverRun from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.retrie...
langchain/libs/community/langchain_community/retrievers/svm.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/svm.py", "repo_id": "langchain", "token_count": 1826 }
292
from __future__ import annotations import asyncio import json from typing import Any, Dict, List, Optional import aiohttp import requests from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import BaseModel, root_validator def is_endpoint_live(url: str, headers: Optional[dict], payload:...
langchain/libs/community/langchain_community/embeddings/nemo.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/nemo.py", "repo_id": "langchain", "token_count": 2312 }
258
from rag_fusion.chain import chain if __name__ == "__main__": original_query = "impact of climate change" print(chain.invoke(original_query)) # noqa: T201
langchain/templates/rag-fusion/main.py/0
{ "file_path": "langchain/templates/rag-fusion/main.py", "repo_id": "langchain", "token_count": 57 }
674
<jupyter_start><jupyter_text>AstraDB DataStax [Astra DB](https://docs.datastax.com/en/astra/home/astra.html) is a serverless vector-capable database built on Cassandra and made conveniently available through an easy-to-use JSON API. Overview The AstraDB Document Loader returns a list of Langchain Documents from an Ast...
langchain/docs/docs/integrations/document_loaders/astradb.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/astradb.ipynb", "repo_id": "langchain", "token_count": 608 }
96
# coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers/examples/amused/train_amused.py/0
{ "file_path": "diffusers/examples/amused/train_amused.py", "repo_id": "diffusers", "token_count": 17459 }
200
"use node"; import { v } from "convex/values"; import { BufferMemory } from "langchain/memory"; import { ChatOpenAI } from "@langchain/openai"; import { ConversationChain } from "langchain/chains"; import { ConvexChatMessageHistory } from "@langchain/community/stores/message/convex"; import { action } from "./_generat...
langchainjs/examples/src/memory/convex/convex.ts/0
{ "file_path": "langchainjs/examples/src/memory/convex/convex.ts", "repo_id": "langchainjs", "token_count": 546 }
815
from llama_index.core.storage.kvstore.types import BaseKVStore from llama_index.storage.kvstore.mongodb import MongoDBKVStore def test_class(): names_of_base_classes = [b.__name__ for b in MongoDBKVStore.__mro__] assert BaseKVStore.__name__ in names_of_base_classes
llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-mongodb/tests/test_storage_kvstore_mongodb.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-mongodb/tests/test_storage_kvstore_mongodb.py", "repo_id": "llama_index", "token_count": 103 }
1,500
export * from "@langchain/community/agents/toolkits/base";
langchainjs/langchain/src/agents/toolkits/base.ts/0
{ "file_path": "langchainjs/langchain/src/agents/toolkits/base.ts", "repo_id": "langchainjs", "token_count": 18 }
882
[tool.poetry] name = "rag-multi-modal-mv-local" version = "0.1.0" description = "Multi-modal RAG using Chroma and multi-vector retriever" authors = [ "Lance Martin <lance@langchain.dev>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = ">=0.0.353,<0.2" openai = "<2" tiktoken =...
langchain/templates/rag-multi-modal-mv-local/pyproject.toml/0
{ "file_path": "langchain/templates/rag-multi-modal-mv-local/pyproject.toml", "repo_id": "langchain", "token_count": 380 }
697
"""Test OpenAI Chat API wrapper.""" import json from typing import Any from unittest.mock import MagicMock, patch import pytest from langchain_core.messages import ( AIMessage, FunctionMessage, HumanMessage, SystemMessage, ) from langchain_community.adapters.openai import convert_dict_to_message from ...
langchain/libs/community/tests/unit_tests/chat_models/test_openai.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/chat_models/test_openai.py", "repo_id": "langchain", "token_count": 1399 }
384
# Keras Dreambooth event! 🤗 This document summarises all the relevant information required for the event 📋. ## Introduction Dreambooth is a fine-tuning technique to teach new visual concepts to text-conditioned Diffusion models with just 3-5 images. With Dreambooth, you could generate funny and realistic images ...
diffusion-models-class/units/en/events/3.mdx/0
{ "file_path": "diffusion-models-class/units/en/events/3.mdx", "repo_id": "diffusion-models-class", "token_count": 3063 }
278
"""Wordpress reader.""" import json from typing import List from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class WordpressReader(BaseReader): """Wordpress reader. Reads data from a Wordpress workspace. Args: wordpress_subdomain (str): Wordpress subd...
llama_index/llama-index-integrations/readers/llama-index-readers-wordpress/llama_index/readers/wordpress/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-wordpress/llama_index/readers/wordpress/base.py", "repo_id": "llama_index", "token_count": 1204 }
1,439
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-jira/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-jira/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,464
## Textual Inversion fine-tuning example [Textual inversion](https://arxiv.org/abs/2208.01618) is a method to personalize text2image models like stable diffusion on your own images using just 3-5 examples. The `textual_inversion.py` script shows how to implement the training procedure and adapt it for stable diffusion...
diffusers/examples/research_projects/onnxruntime/textual_inversion/README.md/0
{ "file_path": "diffusers/examples/research_projects/onnxruntime/textual_inversion/README.md", "repo_id": "diffusers", "token_count": 1117 }
220
/* eslint-disable no-process-env */ import { expect, test } from "@jest/globals"; import { HumanMessage } from "@langchain/core/messages"; import { ChatPromptValue } from "@langchain/core/prompt_values"; import { PromptTemplate, ChatPromptTemplate, AIMessagePromptTemplate, HumanMessagePromptTemplate, SystemM...
langchainjs/libs/langchain-anthropic/src/tests/chat_models.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-anthropic/src/tests/chat_models.int.test.ts", "repo_id": "langchainjs", "token_count": 3270 }
941
<jupyter_start><jupyter_text>Huggingface Sagemaker-sdk - Distributed Training Demo Distributed Summarization with `transformers` scripts + `Trainer` and `samsum` dataset 1. [Tutorial](Tutorial) 2. [Set up a development environment and install sagemaker](Set-up-a-development-environment-and-install-sagemaker) 1. [In...
notebooks/sagemaker/08_distributed_summarization_bart_t5/sagemaker-notebook.ipynb/0
{ "file_path": "notebooks/sagemaker/08_distributed_summarization_bart_t5/sagemaker-notebook.ipynb", "repo_id": "notebooks", "token_count": 5673 }
314
// 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/pipeline/pipeline_test.go/0
{ "file_path": "milvus/internal/querynodev2/pipeline/pipeline_test.go", "repo_id": "milvus", "token_count": 2095 }
1,908
# Unit Testing with Pytest [![Open In GitHub](https://img.shields.io/badge/GitHub-View%20source-green.svg)](https://github.com/langchain-ai/langsmith-cookbook/tree/main/./testing-examples/pytest-ut/README.md) This tutorial shows how to use LangSmith datasets to write unit tests directly in your pytest test suite. Th...
langsmith-cookbook/testing-examples/pytest-ut/README.md/0
{ "file_path": "langsmith-cookbook/testing-examples/pytest-ut/README.md", "repo_id": "langsmith-cookbook", "token_count": 2507 }
1,061
<jupyter_start><jupyter_text>Airbyte Hubspot >[Airbyte](https://github.com/airbytehq/airbyte) is a data integration platform for ELT pipelines from APIs, databases & files to warehouses & lakes. It has the largest catalog of ELT connectors to data warehouses and databases.This loader exposes the Hubspot connector as a ...
langchain/docs/docs/integrations/document_loaders/airbyte_hubspot.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/airbyte_hubspot.ipynb", "repo_id": "langchain", "token_count": 932 }
105
<script lang="ts"> import { createEventDispatcher, onDestroy, onMount } from "svelte"; import { cubicOut } from "svelte/easing"; import { fade } from "svelte/transition"; import Portal from "./Portal.svelte"; import { browser } from "$app/environment"; export let width = "max-w-sm"; let backdropEl: HTMLDivElem...
chat-ui/src/lib/components/Modal.svelte/0
{ "file_path": "chat-ui/src/lib/components/Modal.svelte", "repo_id": "chat-ui", "token_count": 647 }
96
"""ReAct agent. Simple wrapper around AgentRunner + ReActAgentWorker. For the legacy implementation see: ```python from llama_index.legacy.agent.legacy.react.base import ReActAgent ``` """
llama_index/llama-index-legacy/llama_index/legacy/agent/react/agent.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/agent/react/agent.py", "repo_id": "llama_index", "token_count": 60 }
1,549
"""Tool for the DuckDuckGo search API.""" import warnings from typing import Any, Optional, Type from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.pydantic_v1 import BaseModel, Field from langchain_core.tools import BaseTool from langchain_community.utilities.duckduckgo_search import...
langchain/libs/community/langchain_community/tools/ddg_search/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/ddg_search/tool.py", "repo_id": "langchain", "token_count": 1018 }
281
"""Requests toolkit.""" from __future__ import annotations from typing import Any, List from langchain_core.language_models import BaseLanguageModel from langchain_core.tools import Tool from langchain_community.agent_toolkits.base import BaseToolkit from langchain_community.agent_toolkits.json.base import create_js...
langchain/libs/community/langchain_community/agent_toolkits/openapi/toolkit.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/openapi/toolkit.py", "repo_id": "langchain", "token_count": 1189 }
231
""" A dataset reader that reads tarfile based datasets This reader can extract image samples from: * a single tar of image files * a folder of multiple tarfiles containing imagefiles * a tar of tars containing image files Labels are based on the combined folder and/or tar name structure. Hacked together by / Copyrig...
pytorch-image-models/timm/data/readers/reader_image_in_tar.py/0
{ "file_path": "pytorch-image-models/timm/data/readers/reader_image_in_tar.py", "repo_id": "pytorch-image-models", "token_count": 4050 }
388
"""Tests for verifying that testing utility code works as expected.""" from itertools import cycle from typing import Any, Dict, List, Optional, Union from uuid import UUID from langchain_core.callbacks.base import AsyncCallbackHandler from langchain_core.messages import AIMessage, AIMessageChunk, BaseMessage from lan...
langserve/tests/unit_tests/utils/test_fake_chat_model.py/0
{ "file_path": "langserve/tests/unit_tests/utils/test_fake_chat_model.py", "repo_id": "langserve", "token_count": 2690 }
1,037
import argparse import inspect import logging import math import os from pathlib import Path import accelerate import datasets import torch import torch.nn.functional as F from accelerate import Accelerator from accelerate.logging import get_logger from accelerate.utils import ProjectConfiguration from datasets import...
diffusers/examples/research_projects/onnxruntime/unconditional_image_generation/train_unconditional.py/0
{ "file_path": "diffusers/examples/research_projects/onnxruntime/unconditional_image_generation/train_unconditional.py", "repo_id": "diffusers", "token_count": 12740 }
223
from langchain.llms import OpenAI from langchain.agents import AgentType, initialize_agent, load_tools from langchain.callbacks import StreamlitCallbackHandler import streamlit as st llm = OpenAI(temperature=0, streaming=True) tools = load_tools(["ddg-search"]) agent = initialize_agent( tools, llm, agent=AgentType...
streamlit-agent/streamlit_agent/minimal_agent.py/0
{ "file_path": "streamlit-agent/streamlit_agent/minimal_agent.py", "repo_id": "streamlit-agent", "token_count": 217 }
2,003
from typing import Optional from llama_index.legacy.core.base_selector import BaseSelector from llama_index.legacy.selectors.llm_selectors import ( LLMMultiSelector, LLMSingleSelector, ) from llama_index.legacy.selectors.pydantic_selectors import ( PydanticMultiSelector, PydanticSingleSelector, ) from ...
llama_index/llama-index-legacy/llama_index/legacy/selectors/utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/selectors/utils.py", "repo_id": "llama_index", "token_count": 462 }
1,616
"""Test Annoy functionality.""" import tempfile import pytest from langchain_core.documents import Document from langchain_community.docstore.in_memory import InMemoryDocstore from langchain_community.vectorstores.annoy import Annoy from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddings def...
langchain/libs/community/tests/integration_tests/vectorstores/test_annoy.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_annoy.py", "repo_id": "langchain", "token_count": 1867 }
355
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/storage/stats.go/0
{ "file_path": "milvus/internal/storage/stats.go", "repo_id": "milvus", "token_count": 3077 }
1,931
// eslint-disable-next-line import/no-extraneous-dependencies import { DocumentByInfo, FieldPaths, FilterExpression, FunctionReference, GenericActionCtx, GenericDataModel, GenericTableInfo, NamedTableInfo, NamedVectorIndex, TableNamesInDataModel, VectorFilterBuilder, VectorIndexNames, makeFunc...
langchainjs/libs/langchain-community/src/vectorstores/convex.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/convex.ts", "repo_id": "langchainjs", "token_count": 4109 }
992
// noinspection DuplicatedCode import fs from "fs"; import { fileURLToPath } from "node:url"; import * as path from "path"; import { describe, test } from "@jest/globals"; import { HumanMessage } from "@langchain/core/messages"; import { ChatGooglePaLM } from "@langchain/community/chat_models/googlepalm"; import { Go...
langchainjs/langchain/src/experimental/hubs/makersuite/tests/googlemakersuitehub.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/hubs/makersuite/tests/googlemakersuitehub.int.test.ts", "repo_id": "langchainjs", "token_count": 1260 }
883
use candle::{Device, Tensor}; use candle_transformers::generation::LogitsProcessor; pub use candle_transformers::models::quantized_t5::{ Config, T5EncoderModel, T5ForConditionalGeneration, VarBuilder, }; use candle_wasm_example_t5::console_log; use tokenizers::Tokenizer; use wasm_bindgen::prelude::*; const DEVICE:...
candle/candle-wasm-examples/t5/src/bin/m-quantized.rs/0
{ "file_path": "candle/candle-wasm-examples/t5/src/bin/m-quantized.rs", "repo_id": "candle", "token_count": 3555 }
91
// Code generated from Plan.g4 by ANTLR 4.9. DO NOT EDIT. package planparserv2 // Plan import ( "fmt" "reflect" "strconv" "github.com/antlr/antlr4/runtime/Go/antlr" ) // Suppress unused import errors var _ = fmt.Printf var _ = reflect.Copy var _ = strconv.Itoa var parserATN = []uint16{ 3, 24715, 42794, 33075, ...
milvus/internal/parser/planparserv2/generated/plan_parser.go/0
{ "file_path": "milvus/internal/parser/planparserv2/generated/plan_parser.go", "repo_id": "milvus", "token_count": 27838 }
1,871
# Databerry This page covers how to use the [Databerry](https://databerry.ai) within LangChain. ## What is Databerry? Databerry is an [open source](https://github.com/gmpetrov/databerry) document retrieval platform that helps to connect your personal data with Large Language Models. ![Databerry](/img/DataberryDashb...
langchainjs/docs/core_docs/docs/ecosystem/integrations/databerry.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/ecosystem/integrations/databerry.mdx", "repo_id": "langchainjs", "token_count": 376 }
745
<jupyter_start><jupyter_text>Metal>[Metal](https://github.com/getmetal/metal-python) is a managed service for ML Embeddings.This notebook shows how to use [Metal's](https://docs.getmetal.io/introduction) retriever.First, you will need to sign up for Metal and get an API key. You can do so [here](https://docs.getmetal.i...
langchain/docs/docs/integrations/retrievers/metal.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/metal.ipynb", "repo_id": "langchain", "token_count": 352 }
158
# 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/altclip/test_modeling_altclip.py/0
{ "file_path": "transformers/tests/models/altclip/test_modeling_altclip.py", "repo_id": "transformers", "token_count": 9801 }
702
import pytest from langchain_community.embeddings.ernie import ErnieEmbeddings def test_embedding_documents_1() -> None: documents = ["foo bar"] embedding = ErnieEmbeddings() output = embedding.embed_documents(documents) assert len(output) == 1 assert len(output[0]) == 384 def test_embedding_do...
langchain/libs/community/tests/integration_tests/embeddings/test_ernie.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/embeddings/test_ernie.py", "repo_id": "langchain", "token_count": 424 }
361
<jupyter_start><jupyter_text>Query Pipeline with Async/Parallel ExecutionHere we showcase our query pipeline with async + parallel execution.We do this by setting up a RAG pipeline that does the following:1. Send query to multiple RAG query engines.2. Combine results.In the process we'll also show some nice abstraction...
llama_index/docs/examples/pipeline/query_pipeline_async.ipynb/0
{ "file_path": "llama_index/docs/examples/pipeline/query_pipeline_async.ipynb", "repo_id": "llama_index", "token_count": 1463 }
1,100
import { OpenAIEmbeddings } from "@langchain/openai"; import { CacheBackedEmbeddings } from "langchain/embeddings/cache_backed"; import { InMemoryStore } from "langchain/storage/in_memory"; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; import { FaissStore } from "@langchain/community/vectors...
langchainjs/examples/src/embeddings/cache_backed_in_memory.ts/0
{ "file_path": "langchainjs/examples/src/embeddings/cache_backed_in_memory.ts", "repo_id": "langchainjs", "token_count": 740 }
833
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-shopify/llama_index/tools/shopify/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-shopify/llama_index/tools/shopify/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,498
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-azure-openai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-azure-openai/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,352
import { test } from "@jest/globals"; import { OpenAIEmbeddings, ChatOpenAI } from "@langchain/openai"; import { MemoryVectorStore } from "../../../vectorstores/memory.js"; import { createConversationalRetrievalAgent } from "../conversational_retrieval/openai_functions.js"; import { createRetrieverTool } from "../conve...
langchainjs/langchain/src/agents/toolkits/tests/conversational_retrieval.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/agents/toolkits/tests/conversational_retrieval.int.test.ts", "repo_id": "langchainjs", "token_count": 551 }
899
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/tasks/image_to_image.md/0
{ "file_path": "transformers/docs/source/ja/tasks/image_to_image.md", "repo_id": "transformers", "token_count": 2420 }
489
// Code generated by mockery v2.32.4. DO NOT EDIT. package proxy import ( context "context" internalpb "github.com/milvus-io/milvus/internal/proto/internalpb" mock "github.com/stretchr/testify/mock" ) // MockLBBalancer is an autogenerated mock type for the LBBalancer type type MockLBBalancer struct { mock.Mock ...
milvus/internal/proxy/mock_lb_balancer.go/0
{ "file_path": "milvus/internal/proxy/mock_lb_balancer.go", "repo_id": "milvus", "token_count": 2742 }
2,018
# 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/git/configuration_git.py/0
{ "file_path": "transformers/src/transformers/models/git/configuration_git.py", "repo_id": "transformers", "token_count": 4236 }
638
def test_import() -> None: from langchain.chains import OntotextGraphDBQAChain # noqa: F401
langchain/libs/langchain/tests/unit_tests/chains/test_ontotext_graphdb_qa.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/chains/test_ontotext_graphdb_qa.py", "repo_id": "langchain", "token_count": 34 }
652
# Trainer At TRL we support PPO (Proximal Policy Optimisation) with an implementation that largely follows the structure introduced in the paper "Fine-Tuning Language Models from Human Preferences" by D. Ziegler et al. [[paper](https://arxiv.org/pdf/1909.08593.pdf), [code](https://github.com/openai/lm-human-preferenc...
trl/docs/source/trainer.mdx/0
{ "file_path": "trl/docs/source/trainer.mdx", "repo_id": "trl", "token_count": 322 }
785
# coding=utf-8 # Copyright 2020 Optuna, Hugging Face # # 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 o...
transformers/src/transformers/utils/logging.py/0
{ "file_path": "transformers/src/transformers/utils/logging.py", "repo_id": "transformers", "token_count": 4263 }
758
import { initializeAgentExecutorWithOptions } from "langchain/agents"; import { ChatOpenAI } from "@langchain/openai"; import { Calculator } from "langchain/tools/calculator"; import { SerpAPI } from "@langchain/community/tools/serpapi"; const tools = [new Calculator(), new SerpAPI()]; const chat = new ChatOpenAI({ mo...
langchainjs/examples/src/agents/openai_custom_prompt.ts/0
{ "file_path": "langchainjs/examples/src/agents/openai_custom_prompt.ts", "repo_id": "langchainjs", "token_count": 290 }
839
<jupyter_start><jupyter_text>Faiss (Async)>[Facebook AI Similarity Search (Faiss)](https://engineering.fb.com/2017/03/29/data-infrastructure/faiss-a-library-for-efficient-similarity-search/) is a library for efficient similarity search and clustering of dense vectors. It contains algorithms that search in sets of vecto...
langchain/docs/docs/integrations/vectorstores/faiss_async.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/faiss_async.ipynb", "repo_id": "langchain", "token_count": 2387 }
191
<jupyter_start><jupyter_text>Google Vertex AI PaLM >[Vertex AI PaLM API](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/overview) is a service on Google Cloud exposing the embedding models. Note: This integration is separate from the Google PaLM integration.By default, Google Cloud [does not use](https://c...
langchain/docs/docs/integrations/text_embedding/google_vertex_ai_palm.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/google_vertex_ai_palm.ipynb", "repo_id": "langchain", "token_count": 453 }
169
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-deeplake/llama_index/vector_stores/deeplake/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-deeplake/llama_index/vector_stores/deeplake/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,553
import { ChatLlamaCpp } from "@langchain/community/chat_models/llama_cpp"; import { SystemMessage, HumanMessage } from "@langchain/core/messages"; const llamaPath = "/Replace/with/path/to/your/model/gguf-llama2-q4_0.bin"; const llamaCpp = new ChatLlamaCpp({ modelPath: llamaPath, temperature: 0.7 }); const stream = a...
langchainjs/examples/src/models/chat/integration_llama_cpp_stream_multi.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/integration_llama_cpp_stream_multi.ts", "repo_id": "langchainjs", "token_count": 270 }
801
# Text Environments Text environments provide a learning ground for language agents. It allows a language model to use tools to accomplish a task such as using a Python interpreter to answer math questions or using a search index for trivia questions. Having access to tools allows language models to solve tasks that w...
trl/docs/source/text_environments.md/0
{ "file_path": "trl/docs/source/text_environments.md", "repo_id": "trl", "token_count": 2826 }
779
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/pipeline_tutorial.md/0
{ "file_path": "transformers/docs/source/en/pipeline_tutorial.md", "repo_id": "transformers", "token_count": 4495 }
463
[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 = ["Bedrock", "completion_response_to_chat_response", "completion_with_retry"] contains_examp...
llama_index/llama-index-integrations/llms/llama-index-llms-bedrock/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-bedrock/pyproject.toml", "repo_id": "llama_index", "token_count": 685 }
1,277
import warnings from typing import Any, Dict, List, Set from langchain_core.memory import BaseMemory from langchain_core.pydantic_v1 import validator from langchain.memory.chat_memory import BaseChatMemory class CombinedMemory(BaseMemory): """Combining multiple memories' data together.""" memories: List[Ba...
langchain/libs/langchain/langchain/memory/combined.py/0
{ "file_path": "langchain/libs/langchain/langchain/memory/combined.py", "repo_id": "langchain", "token_count": 1253 }
571
# coding=utf-8 # Copyright 2023 The Intel AIA 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.org/lice...
transformers/src/transformers/models/tvp/configuration_tvp.py/0
{ "file_path": "transformers/src/transformers/models/tvp/configuration_tvp.py", "repo_id": "transformers", "token_count": 3880 }
703
from rag_multi_modal_local.chain import chain __all__ = ["chain"]
langchain/templates/rag-multi-modal-local/rag_multi_modal_local/__init__.py/0
{ "file_path": "langchain/templates/rag-multi-modal-local/rag_multi_modal_local/__init__.py", "repo_id": "langchain", "token_count": 23 }
739
<!--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/dinat.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/dinat.md", "repo_id": "transformers", "token_count": 2666 }
544
import argparse import logging import os import random import sys import numpy as np import torch from datasets import load_from_disk, load_metric from transformers import AutoModelForSequenceClassification, AutoTokenizer, Trainer, TrainingArguments from transformers.trainer_utils import get_last_checkpoint if __name...
notebooks/sagemaker/05_spot_instances/scripts/train.py/0
{ "file_path": "notebooks/sagemaker/05_spot_instances/scripts/train.py", "repo_id": "notebooks", "token_count": 1799 }
299
version: "3.8" services: pgvector: image: ankane/pgvector:latest environment: POSTGRES_DB: ${PGVECTOR_DB:-postgres} POSTGRES_USER: ${PGVECTOR_USER:-postgres} POSTGRES_PASSWORD: ${PGVECTOR_PASSWORD:-postgres} ports: - ${PGVECTOR_PORT:-5432}:5432 restart: unless-stopped heal...
langchain/libs/community/tests/integration_tests/vectorstores/docker-compose/pgvector.yml/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/docker-compose/pgvector.yml", "repo_id": "langchain", "token_count": 208 }
350
# Monte Carlo vs Temporal Difference Learning [[mc-vs-td]] The last thing we need to discuss before diving into Q-Learning is the two learning strategies. Remember that an RL agent **learns by interacting with its environment.** The idea is that **given the experience and the received reward, the agent will update it...
deep-rl-class/units/en/unit2/mc-vs-td.mdx/0
{ "file_path": "deep-rl-class/units/en/unit2/mc-vs-td.mdx", "repo_id": "deep-rl-class", "token_count": 2316 }
157
<jupyter_start><jupyter_text>Using local modelsThe popularity of projects like [PrivateGPT](https://github.com/imartinez/privateGPT), [llama.cpp](https://github.com/ggerganov/llama.cpp), and [Ollama](https://github.com/ollama/ollama) underscore the importance of running LLMs locally.LangChain has [integrations](/docs/i...
langchainjs/docs/core_docs/docs/use_cases/question_answering/local_retrieval_qa.ipynb/0
{ "file_path": "langchainjs/docs/core_docs/docs/use_cases/question_answering/local_retrieval_qa.ipynb", "repo_id": "langchainjs", "token_count": 2050 }
824
from langchain_core.language_models import ( BaseLanguageModel, LanguageModelInput, LanguageModelOutput, get_tokenizer, ) from langchain_core.language_models.base import _get_token_ids_default_method __all__ = [ "get_tokenizer", "BaseLanguageModel", "_get_token_ids_default_method", "Lan...
langchain/libs/langchain/langchain/schema/language_model.py/0
{ "file_path": "langchain/libs/langchain/langchain/schema/language_model.py", "repo_id": "langchain", "token_count": 131 }
566
/// This example contains some simple benchmarks so that it's easy to run them in perf etc. #[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use candle::quantized::GgmlType; use candle::{CpuStorage, Device, Layout, Module, Result, Shape, Tensor, D}; use c...
candle/candle-nn/examples/cpu_benchmarks.rs/0
{ "file_path": "candle/candle-nn/examples/cpu_benchmarks.rs", "repo_id": "candle", "token_count": 5283 }
56
from langchain_community.document_loaders.twitter import ( TwitterTweetLoader, ) __all__ = ["TwitterTweetLoader"]
langchain/libs/langchain/langchain/document_loaders/twitter.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/twitter.py", "repo_id": "langchain", "token_count": 36 }
502
"""Unittests for langchain.agents.chat package.""" from typing import Tuple from langchain_core.agents import AgentAction from langchain.agents.chat.output_parser import ChatOutputParser output_parser = ChatOutputParser() def get_action_and_input(text: str) -> Tuple[str, str]: output = output_parser.parse(text...
langchain/libs/langchain/tests/unit_tests/agents/test_chat.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/agents/test_chat.py", "repo_id": "langchain", "token_count": 441 }
600
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-longllmlingua/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-longllmlingua/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,263
ann_accuracy: collections: - server: cache_config.cpu_cache_capacity: 16GB engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: false gpu_resource_config.cache_capacity: 4GB gpu_resource_config.search_resourc...
milvus/tests/benchmark/milvus_benchmark/suites/ann_debug.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/ann_debug.yaml", "repo_id": "milvus", "token_count": 383 }
1,879
<jupyter_start><jupyter_text>Run TemplateIn `server.py`, set -```add_routes(app, chain, path="/sql_ollama")```This template includes an example DB of 2023 NBA rosters.We can ask questions related to NBA players.<jupyter_code>from langserve.client import RemoteRunnable sql_app = RemoteRunnable("http://0.0.0.0:8001/sql...
langchain/templates/sql-ollama/sql-ollama.ipynb/0
{ "file_path": "langchain/templates/sql-ollama/sql-ollama.ipynb", "repo_id": "langchain", "token_count": 147 }
692
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/using-diffusers/svd.md/0
{ "file_path": "diffusers/docs/source/en/using-diffusers/svd.md", "repo_id": "diffusers", "token_count": 1761 }
197
package model import pb "github.com/milvus-io/milvus/internal/proto/etcdpb" type Alias struct { Name string CollectionID int64 CreatedTime uint64 State pb.AliasState DbID int64 } func (a *Alias) Available() bool { return a.State == pb.AliasState_AliasCreated } func (a *Alias) Clone() *...
milvus/internal/metastore/model/alias.go/0
{ "file_path": "milvus/internal/metastore/model/alias.go", "repo_id": "milvus", "token_count": 491 }
1,861
[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 = ["DatabaseToolSpec"] contains_example = false import_path = "llama_index.tools.database" [...
llama_index/llama-index-integrations/tools/llama-index-tools-database/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-database/pyproject.toml", "repo_id": "llama_index", "token_count": 658 }
1,510
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/src/query/PlanNode.h/0
{ "file_path": "milvus/internal/core/src/query/PlanNode.h", "repo_id": "milvus", "token_count": 649 }
1,930
from llama_index.legacy.agent.react.base import ReActAgent from llama_index.legacy.agent.react.formatter import ReActChatFormatter from llama_index.legacy.agent.react.step import ReActAgentWorker __all__ = ["ReActChatFormatter", "ReActAgentWorker", "ReActAgent"]
llama_index/llama-index-legacy/llama_index/legacy/agent/react/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/agent/react/__init__.py", "repo_id": "llama_index", "token_count": 87 }
1,577
--- sidebar_class_name: hidden --- # Plan and execute :::info Compatibility This agent currently only supports Chat Models. ::: Plan and execute agents accomplish an objective by first planning what to do, then executing the sub tasks. This idea is largely inspired by [BabyAGI](https://github.com/yoheinakajima/babya...
langchainjs/docs/core_docs/docs/modules/agents/agent_types/plan_and_execute.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/agents/agent_types/plan_and_execute.mdx", "repo_id": "langchainjs", "token_count": 395 }
753