text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
import type { Message } from "ai/react"; export function ChatMessageBubble(props: { message: Message, aiEmoji?: string, sources: any[] }) { const colorClassName = props.message.role === "user" ? "bg-sky-600" : "bg-slate-50 text-black"; const alignmentClassName = props.message.role === "user" ? "ml-auto" : ...
langchain-nextjs-template/components/ChatMessageBubble.tsx/0
{ "file_path": "langchain-nextjs-template/components/ChatMessageBubble.tsx", "repo_id": "langchain-nextjs-template", "token_count": 752 }
67
# 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 applicabl...
transformers/src/transformers/models/nezha/__init__.py/0
{ "file_path": "transformers/src/transformers/models/nezha/__init__.py", "repo_id": "transformers", "token_count": 899 }
706
// Copyright (C) 2019-2023 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/simd/sse4.cpp/0
{ "file_path": "milvus/internal/core/src/simd/sse4.cpp", "repo_id": "milvus", "token_count": 1497 }
1,770
package etcdkv import ( "fmt" "path" clientv3 "go.etcd.io/etcd/client/v3" "github.com/milvus-io/milvus/internal/kv/predicates" "github.com/milvus-io/milvus/pkg/util/merr" ) func parsePredicates(rootPath string, preds ...predicates.Predicate) ([]clientv3.Cmp, error) { if len(preds) == 0 { return []clientv3.C...
milvus/internal/kv/etcd/util.go/0
{ "file_path": "milvus/internal/kv/etcd/util.go", "repo_id": "milvus", "token_count": 452 }
1,822
import uuid from typing import Optional import pytest from langchain_core.documents import Document from langchain_community.vectorstores import Qdrant from langchain_community.vectorstores.qdrant import QdrantException from tests.integration_tests.vectorstores.fake_embeddings import ( ConsistentFakeEmbeddings, )...
langchain/libs/community/tests/integration_tests/vectorstores/qdrant/async_api/test_from_texts.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/qdrant/async_api/test_from_texts.py", "repo_id": "langchain", "token_count": 3598 }
351
/* eslint-disable import/no-extraneous-dependencies */ import path from "path"; import { green } from "picocolors"; import { tryGitInit } from "./helpers/git"; import { isFolderEmpty } from "./helpers/is-folder-empty"; import { isWriteable } from "./helpers/is-writeable"; import { makeDir } from "./helpers/make-dir"; ...
langchainjs/libs/create-langchain-integration/create-app.ts/0
{ "file_path": "langchainjs/libs/create-langchain-integration/create-app.ts", "repo_id": "langchainjs", "token_count": 468 }
926
import { describe, test, expect, jest } from "@jest/globals"; import { FakeListLLM } from "../fake.js"; describe("Test FakeListLLM", () => { test("Should exist", async () => { const llm = new FakeListLLM({ responses: ["test response"] }); const response = await llm.call("test prompt"); expect(typeof res...
langchainjs/langchain/src/llms/tests/fake.test.ts/0
{ "file_path": "langchainjs/langchain/src/llms/tests/fake.test.ts", "repo_id": "langchainjs", "token_count": 1051 }
930
/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable no-process-env */ import fs from "fs"; import { expect, beforeAll } from "@jest/globals"; import { insecureHash } from "@langchain/core/utils/hash"; import { Document } from "@langchain/core/documents"; import { FakeEmbeddings } from "@langchain/c...
langchainjs/libs/langchain-community/src/vectorstores/tests/vectara.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/vectara.int.test.ts", "repo_id": "langchainjs", "token_count": 3997 }
986
# LlamaIndex Graph Stores Integration: Kuzu
llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-kuzu/README.md/0
{ "file_path": "llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-kuzu/README.md", "repo_id": "llama_index", "token_count": 12 }
1,281
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-openai/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-openai/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,239
from __future__ import annotations from typing import Any, Dict, List, Optional, Sequence, Tuple, Type from langchain_core.callbacks import CallbackManagerForChainRun from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import Extra from langch...
langchain/libs/langchain/langchain/chains/router/embedding_router.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/router/embedding_router.py", "repo_id": "langchain", "token_count": 766 }
512
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/pkg/mq/msgstream/mqwrapper/pulsar/pulsar_id_test.go/0
{ "file_path": "milvus/pkg/mq/msgstream/mqwrapper/pulsar/pulsar_id_test.go", "repo_id": "milvus", "token_count": 1160 }
2,042
from neo4j_advanced_rag.chain import chain if __name__ == "__main__": original_query = "What is the plot of the Dune?" print( # noqa: T201 chain.invoke( {"question": original_query}, {"configurable": {"strategy": "parent_document"}}, ) )
langchain/templates/neo4j-advanced-rag/main.py/0
{ "file_path": "langchain/templates/neo4j-advanced-rag/main.py", "repo_id": "langchain", "token_count": 128 }
654
"""Tool for the Serper.dev Google Search API.""" from typing import Optional from langchain_core.callbacks import ( AsyncCallbackManagerForToolRun, CallbackManagerForToolRun, ) from langchain_core.pydantic_v1 import Field from langchain_core.tools import BaseTool from langchain_community.utilities.google_ser...
langchain/libs/community/langchain_community/tools/google_serper/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/google_serper/tool.py", "repo_id": "langchain", "token_count": 802 }
287
import torch import torch.nn.functional as F from diffusers import VQDiffusionScheduler from .test_schedulers import SchedulerCommonTest class VQDiffusionSchedulerTest(SchedulerCommonTest): scheduler_classes = (VQDiffusionScheduler,) def get_scheduler_config(self, **kwargs): config = { ...
diffusers/tests/schedulers/test_scheduler_vq_diffusion.py/0
{ "file_path": "diffusers/tests/schedulers/test_scheduler_vq_diffusion.py", "repo_id": "diffusers", "token_count": 694 }
298
import { Serialized } from "@langchain/core/load/serializable"; import { BaseCallbackHandler } from "@langchain/core/callbacks/base"; import { AgentAction, AgentFinish } from "@langchain/core/agents"; import { ChainValues } from "@langchain/core/utils/types"; export class MyCallbackHandler extends BaseCallbackHandler ...
langchainjs/examples/src/callbacks/custom_handler.ts/0
{ "file_path": "langchainjs/examples/src/callbacks/custom_handler.ts", "repo_id": "langchainjs", "token_count": 266 }
785
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-trello/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-trello/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,461
import * as uuid from "uuid"; import pg, { Pool, PoolConfig } from "pg"; import { from as copyFrom } from "pg-copy-streams"; import { pipeline } from "node:stream/promises"; import { Readable } from "node:stream"; import { VectorStore } from "@langchain/core/vectorstores"; import type { EmbeddingsInterface } from "@la...
langchainjs/libs/langchain-community/src/vectorstores/analyticdb.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/analyticdb.ts", "repo_id": "langchainjs", "token_count": 4659 }
1,046
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/main_classes/quantization.md/0
{ "file_path": "transformers/docs/source/en/main_classes/quantization.md", "repo_id": "transformers", "token_count": 421 }
437
# coding=utf-8 # Copyright 2021 The Fairseq Authors 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/LICE...
transformers/src/transformers/models/xglm/modeling_xglm.py/0
{ "file_path": "transformers/src/transformers/models/xglm/modeling_xglm.py", "repo_id": "transformers", "token_count": 17039 }
754
# Q&A One of the most common use-cases for an LLM application is to answer questions about a set of documents. LlamaIndex has rich support for many forms of question & answering. ## Types of question answering use cases Q&A has all sorts of sub-types, such as: ### What to do - **Semantic search**: finding data tha...
llama_index/docs/use_cases/q_and_a/root.md/0
{ "file_path": "llama_index/docs/use_cases/q_and_a/root.md", "repo_id": "llama_index", "token_count": 627 }
1,237
import os from langchain_community.chat_models import BedrockChat from langchain_core.prompts import ChatPromptTemplate from langchain_core.runnables import ConfigurableField # For a description of each inference parameter, see # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html _model...
langchain/templates/bedrock-jcvd/bedrock_jcvd/chain.py/0
{ "file_path": "langchain/templates/bedrock-jcvd/bedrock_jcvd/chain.py", "repo_id": "langchain", "token_count": 697 }
659
// 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/datacoord/channel_store.go/0
{ "file_path": "milvus/internal/datacoord/channel_store.go", "repo_id": "milvus", "token_count": 5221 }
1,689
"""A common module for NVIDIA Riva Runnables.""" import asyncio import logging import pathlib import queue import tempfile import threading import wave from enum import Enum from typing import ( TYPE_CHECKING, Any, AsyncGenerator, AsyncIterator, Dict, Generator, Iterator, List, Opti...
langchain/libs/community/langchain_community/utilities/nvidia_riva.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/nvidia_riva.py", "repo_id": "langchain", "token_count": 9592 }
317
import pytest as pytest from langchain_community.document_loaders.web_base import WebBaseLoader class TestWebBaseLoader: @pytest.mark.requires("bs4") def test_respect_user_specified_user_agent(self) -> None: user_specified_user_agent = "user_specified_user_agent" header_template = {"User-Agen...
langchain/libs/community/tests/unit_tests/document_loaders/test_web_base.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_web_base.py", "repo_id": "langchain", "token_count": 393 }
375
import contextlib import csv import json import os import sqlite3 import tarfile import textwrap import zipfile import pandas as pd import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config # dataset + arrow_file @pytest.fixture(scope="session") def dataset(): n = ...
datasets/tests/fixtures/files.py/0
{ "file_path": "datasets/tests/fixtures/files.py", "repo_id": "datasets", "token_count": 8208 }
145
<!--Copyright 2021 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/es/debugging.md/0
{ "file_path": "transformers/docs/source/es/debugging.md", "repo_id": "transformers", "token_count": 5532 }
469
# InstructPix2Pix text-to-edit-image fine-tuning This extended LoRA training script was authored by [Aiden-Frost](https://github.com/Aiden-Frost). This is an experimental LoRA extension of [this example](https://github.com/huggingface/diffusers/blob/main/examples/instruct_pix2pix/train_instruct_pix2pix.py). This script...
diffusers/examples/research_projects/instructpix2pix_lora/README.md/0
{ "file_path": "diffusers/examples/research_projects/instructpix2pix_lora/README.md", "repo_id": "diffusers", "token_count": 1124 }
198
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-arango-db/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-arango-db/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,404
""" Test of Astra DB vector store class `AstraDBVectorStore` Required to run this test: - a recent `astrapy` Python package available - an Astra DB instance; - the two environment variables set: export ASTRA_DB_API_ENDPOINT="https://<DB-ID>-us-east1.apps.astra.datastax.com" export ASTRA_DB_...
langchain/libs/partners/astradb/tests/integration_tests/vectorstores/test_astradb.py/0
{ "file_path": "langchain/libs/partners/astradb/tests/integration_tests/vectorstores/test_astradb.py", "repo_id": "langchain", "token_count": 15353 }
649
[build-system] build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] [tool.codespell] check-filenames = true check-hidden = true # Feel free to un-skip examples, and experimental, you will just need to # work through many typos (--write-changes and --interactive will help) skip = "*.csv,*.html,*.json,*....
llama_index/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/pyproject.toml", "repo_id": "llama_index", "token_count": 651 }
1,339
<p align="center"> <br> <img src="https://huggingface.co/landing/assets/tokenizers/tokenizers-logo.png" width="600"/> <br> <p> <p align="center"> <a href="https://badge.fury.io/js/tokenizers"> <img alt="Build" src="https://badge.fury.io/js/tokenizers.svg"> </a> <a href="https://github.com/huggingface/to...
tokenizers/bindings/node/README.md/0
{ "file_path": "tokenizers/bindings/node/README.md", "repo_id": "tokenizers", "token_count": 651 }
449
# coding=utf-8 # Copyright 2023 Xuan Ouyang, Shuohuan Wang, Chao Pang, Yu Sun, Hao Tian, Hua Wu, Haifeng Wang 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 ...
transformers/src/transformers/models/ernie_m/modeling_ernie_m.py/0
{ "file_path": "transformers/src/transformers/models/ernie_m/modeling_ernie_m.py", "repo_id": "transformers", "token_count": 20540 }
614
<jupyter_start><jupyter_text>Exa SearchExa's search integration exists in its own [partner package](https://pypi.org/project/langchain-exa/). You can install it with:<jupyter_code>%pip install -qU langchain-exa<jupyter_output><empty_output><jupyter_text>In order to use the package, you will also need to set the `EXA_AP...
langchain/docs/docs/integrations/providers/exa_search.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/providers/exa_search.ipynb", "repo_id": "langchain", "token_count": 208 }
135
from langchain_community.tools.ainetwork.base import AINBaseTool, OperationType __all__ = ["OperationType", "AINBaseTool"]
langchain/libs/langchain/langchain/tools/ainetwork/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/ainetwork/base.py", "repo_id": "langchain", "token_count": 37 }
549
import { OpenAIEmbeddings } from "@langchain/openai"; import { PGVectorStore } from "@langchain/community/vectorstores/pgvector"; import { PoolConfig } from "pg"; // First, follow set-up instructions at // https://js.langchain.com/docs/modules/indexes/vector_stores/integrations/pgvector const config = { postgresCon...
langchainjs/examples/src/indexes/vector_stores/pgvector_vectorstore/pgvector.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/pgvector_vectorstore/pgvector.ts", "repo_id": "langchainjs", "token_count": 461 }
878
""" Initialized parameters """ port = 19530 epsilon = 0.000001 namespace = "milvus" default_flush_interval = 1 big_flush_interval = 1000 default_drop_interval = 3 default_dim = 128 default_nb = 2000 default_nb_medium = 5000 default_max_capacity = 100 default_top_k = 10 default_nq = 2 default_limit = 10 default_batch_si...
milvus/tests/python_client/common/common_type.py/0
{ "file_path": "milvus/tests/python_client/common/common_type.py", "repo_id": "milvus", "token_count": 3935 }
1,903
<!--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/ja/model_doc/deberta-v2.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/deberta-v2.md", "repo_id": "transformers", "token_count": 3023 }
548
import time from typing import Any, Dict, List, Optional, cast from langchain_core.agents import AgentAction, AgentFinish from langchain_core.callbacks import BaseCallbackHandler from langchain_core.messages import BaseMessage from langchain_core.outputs import ChatGeneration, LLMResult def import_infino() -> Any: ...
langchain/libs/community/langchain_community/callbacks/infino_callback.py/0
{ "file_path": "langchain/libs/community/langchain_community/callbacks/infino_callback.py", "repo_id": "langchain", "token_count": 4286 }
219
# LlamaIndex Embeddings Integration: Elasticsearch
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-elasticsearch/README.md/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-elasticsearch/README.md", "repo_id": "llama_index", "token_count": 12 }
1,194
from llama_index.vector_stores.azureaisearch.base import ( AzureAISearchVectorStore, CognitiveSearchVectorStore, IndexManagement, ) __all__ = ["AzureAISearchVectorStore", "CognitiveSearchVectorStore", "IndexManagement"]
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/llama_index/vector_stores/azureaisearch/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/llama_index/vector_stores/azureaisearch/__init__.py", "repo_id": "llama_index", "token_count": 74 }
1,449
<!--- Copyright 2021 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
accelerate/examples/README.md/0
{ "file_path": "accelerate/examples/README.md", "repo_id": "accelerate", "token_count": 4003 }
7
<jupyter_start><jupyter_text>Advanced RAG EvalThe cookbook walks through the process of running eval(s) on advanced RAG. This can be very useful to determine the best RAG approach for your application.<jupyter_code>! pip install -U langchain openai chromadb langchain-experimental # (newest versions required for multi-m...
langchain/cookbook/advanced_rag_eval.ipynb/0
{ "file_path": "langchain/cookbook/advanced_rag_eval.ipynb", "repo_id": "langchain", "token_count": 5970 }
74
import json from abc import abstractmethod from dataclasses import dataclass from typing import TYPE_CHECKING, Any, Dict, Optional, Type if TYPE_CHECKING: from llama_index.legacy.bridge.langchain import StructuredTool, Tool from deprecated import deprecated from llama_index.legacy.bridge.pydantic import BaseModel...
llama_index/llama-index-legacy/llama_index/legacy/tools/types.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/tools/types.py", "repo_id": "llama_index", "token_count": 2465 }
1,650
<script lang="ts"> import { page } from "$app/stores"; </script> <div class="flex items-center justify-center bg-gradient-to-t from-gray-200 text-gray-800 dark:from-gray-700 dark:text-gray-300" > <div class="align-center -mt-24 flex flex-col justify-center rounded-xl border bg-white px-8 pb-2 pt-4 text-center dar...
chat-ui/src/routes/+error.svelte/0
{ "file_path": "chat-ui/src/routes/+error.svelte", "repo_id": "chat-ui", "token_count": 241 }
115
python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/objects/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/objects/BUILD", "repo_id": "llama_index", "token_count": 25 }
1,643
from __future__ import annotations from typing import Any, TypeVar from langchain_core.exceptions import OutputParserException from langchain_core.language_models import BaseLanguageModel from langchain_core.output_parsers import BaseOutputParser from langchain_core.prompt_values import PromptValue from langchain_cor...
langchain/libs/langchain/langchain/output_parsers/retry.py/0
{ "file_path": "langchain/libs/langchain/langchain/output_parsers/retry.py", "repo_id": "langchain", "token_count": 3339 }
561
from pathlib import Path from langchain.text_splitter import TokenTextSplitter from langchain_community.document_loaders import TextLoader from langchain_community.embeddings.openai import OpenAIEmbeddings from langchain_community.graphs import Neo4jGraph from langchain_community.vectorstores import Neo4jVector txt_p...
langchain/templates/neo4j-parent/ingest.py/0
{ "file_path": "langchain/templates/neo4j-parent/ingest.py", "repo_id": "langchain", "token_count": 504 }
713
# flake8: noqa from langchain_core.prompts.prompt import PromptTemplate NAIVE_FIX = """Instructions: -------------- {instructions} -------------- Completion: -------------- {completion} -------------- Above, the Completion did not satisfy the constraints given in the Instructions. Error: -------------- {error} ------...
langchain/libs/langchain/langchain/output_parsers/prompts.py/0
{ "file_path": "langchain/libs/langchain/langchain/output_parsers/prompts.py", "repo_id": "langchain", "token_count": 132 }
529
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPT2Config, GPT2LMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin # Modified from ClipCapti...
diffusers/src/diffusers/pipelines/unidiffuser/modeling_text_decoder.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/unidiffuser/modeling_text_decoder.py", "repo_id": "diffusers", "token_count": 6304 }
248
<jupyter_start><jupyter_text>CohereLet's load the Cohere Embedding class.<jupyter_code>from langchain_community.embeddings import CohereEmbeddings embeddings = CohereEmbeddings(model="embed-english-light-v3.0") text = "This is a test document." query_result = embeddings.embed_query(text) print(query_result) doc_result ...
langchain/docs/docs/integrations/text_embedding/cohere.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/cohere.ipynb", "repo_id": "langchain", "token_count": 692 }
172
from typing import Any, Dict, Optional, Sequence, Type, cast from llama_index.core.bridge.pydantic import BaseModel from llama_index.core.multi_modal_llms import MultiModalLLM from llama_index.core.output_parsers.pydantic import PydanticOutputParser from llama_index.core.prompts.base import BasePromptTemplate, PromptT...
llama_index/llama-index-core/llama_index/core/program/multi_modal_llm_program.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/program/multi_modal_llm_program.py", "repo_id": "llama_index", "token_count": 1995 }
1,237
from llama_index.llms.perplexity.base import Perplexity __all__ = ["Perplexity"]
llama_index/llama-index-integrations/llms/llama-index-llms-perplexity/llama_index/llms/perplexity/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-perplexity/llama_index/llms/perplexity/__init__.py", "repo_id": "llama_index", "token_count": 30 }
1,369
# Copyright 2024 MultiDiffusion 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 # # Un...
diffusers/src/diffusers/pipelines/stable_diffusion_panorama/pipeline_stable_diffusion_panorama.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion_panorama/pipeline_stable_diffusion_panorama.py", "repo_id": "diffusers", "token_count": 21252 }
268
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/pipelines/deprecated/audio_diffusion/pipeline_audio_diffusion.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/deprecated/audio_diffusion/pipeline_audio_diffusion.py", "repo_id": "diffusers", "token_count": 6240 }
252
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "retrievers/chaindesk", }); export * from "@langchain/community/retrievers/chaindesk";
langchainjs/langchain/src/retrievers/chaindesk.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/chaindesk.ts", "repo_id": "langchainjs", "token_count": 76 }
927
python_tests()
llama_index/llama-index-packs/llama-index-packs-fuzzy-citation/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-fuzzy-citation/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,568
# 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/owlvit/image_processing_owlvit.py/0
{ "file_path": "transformers/src/transformers/models/owlvit/image_processing_owlvit.py", "repo_id": "transformers", "token_count": 11997 }
712
from typing import List from langchain_core.documents import Document def qdrant_is_not_running() -> bool: """Check if Qdrant is not running.""" import requests try: response = requests.get("http://localhost:6333", timeout=10.0) response_json = response.json() return response_jso...
langchain/libs/community/tests/integration_tests/vectorstores/qdrant/common.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/qdrant/common.py", "repo_id": "langchain", "token_count": 355 }
372
<div align="center"> <h1><code>wasm-pack-template</code></h1> <strong>A template for kick starting a Rust and WebAssembly project using <a href="https://github.com/rustwasm/wasm-pack">wasm-pack</a>.</strong> <p> <a href="https://travis-ci.org/rustwasm/wasm-pack-template"><img src="https://img.shields.io/tr...
tokenizers/tokenizers/examples/unstable_wasm/README.md/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/README.md", "repo_id": "tokenizers", "token_count": 811 }
476
<!--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/torchscript.md/0
{ "file_path": "transformers/docs/source/en/torchscript.md", "repo_id": "transformers", "token_count": 2732 }
476
from typing import TYPE_CHECKING from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 TreeSitterSegmenter, ) if TYPE_CHECKING: from tree_sitter import Language CHUNK_QUERY = """ [ (namespace_declaration) @namespace (class_declaration) @c...
langchain/libs/community/langchain_community/document_loaders/parsers/language/csharp.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/parsers/language/csharp.py", "repo_id": "langchain", "token_count": 363 }
239
from langchain_community.retrievers.azure_cognitive_search import ( AzureCognitiveSearchRetriever, ) __all__ = ["AzureCognitiveSearchRetriever"]
langchain/libs/langchain/langchain/retrievers/azure_cognitive_search.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/azure_cognitive_search.py", "repo_id": "langchain", "token_count": 50 }
554
python_tests()
llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-firestore/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-firestore/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,454
<!--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/de/llm_tutorial.md/0
{ "file_path": "transformers/docs/source/de/llm_tutorial.md", "repo_id": "transformers", "token_count": 4767 }
470
from os import environ from typing import List import pytest try: from tair import Tair except ImportError: Tair = None # type: ignore from llama_index.legacy.schema import NodeRelationship, RelatedNodeInfo, TextNode from llama_index.legacy.vector_stores import TairVectorStore from llama_index.legacy.vector...
llama_index/llama-index-legacy/tests/vector_stores/test_tair.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/vector_stores/test_tair.py", "repo_id": "llama_index", "token_count": 2091 }
1,571
#!/bin/bash yum -y update yum install gcc bzip2-devel libffi-devel zlib-devel wget tar gzip -y amazon-linux-extras install python3.8 -y # install quarto wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.450/quarto-1.3.450-linux-amd64.tar.gz tar -xzf quarto-1.3.450-linux-amd64.tar.gz export PATH=...
langchain/docs/vercel_build.sh/0
{ "file_path": "langchain/docs/vercel_build.sh", "repo_id": "langchain", "token_count": 365 }
220
<!--- 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 a...
diffusers/examples/README.md/0
{ "file_path": "diffusers/examples/README.md", "repo_id": "diffusers", "token_count": 1796 }
202
--- sidebar_position: 0 title: Prompt + LLM hide_table_of_contents: true --- # Prompt + LLM One of the most foundational Expression Language compositions is taking: `PromptTemplate` / `ChatPromptTemplate` -> `LLM` / `ChatModel` -> `OutputParser` Almost all other chains you build will use this building block. <deta...
langchainjs/docs/core_docs/docs/expression_language/cookbook/prompt_llm_parser.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/expression_language/cookbook/prompt_llm_parser.mdx", "repo_id": "langchainjs", "token_count": 959 }
692
import types from typing import List, Optional, Tuple, Union import torch from transformers import CLIPTextModelWithProjection, CLIPTokenizer from transformers.models.clip.modeling_clip import CLIPTextModelOutput from diffusers.models import PriorTransformer from diffusers.pipelines import DiffusionPipeline, StableDi...
diffusers/examples/community/stable_unclip.py/0
{ "file_path": "diffusers/examples/community/stable_unclip.py", "repo_id": "diffusers", "token_count": 5489 }
211
# Ollama The `OllamaEmbeddings` class uses the `/api/embeddings` route of a locally hosted [Ollama](https://ollama.ai) server to generate embeddings for given texts. # Setup Follow [these instructions](https://github.com/jmorganca/ollama) to set up and run a local Ollama instance. # Usage Basic usage: ```typescri...
langchainjs/docs/core_docs/docs/integrations/text_embedding/ollama.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/text_embedding/ollama.mdx", "repo_id": "langchainjs", "token_count": 512 }
737
import argparse import glob from tokenizers import BertWordPieceTokenizer parser = argparse.ArgumentParser() parser.add_argument( "--files", default=None, metavar="path", type=str, required=True, help="The files to use as training; accept '**/*.txt' type of patterns \ ...
tokenizers/bindings/python/examples/train_bert_wordpiece.py/0
{ "file_path": "tokenizers/bindings/python/examples/train_bert_wordpiece.py", "repo_id": "tokenizers", "token_count": 472 }
445
# Next.js [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/langchain-ai/langchain-nextjs-template) If you're looking to use LangChain in a [Next.js](https://nextjs.org) project, you can check out the [official Next.js starter template](https://github.com/langchain-ai/lang...
langchainjs/docs/core_docs/docs/guides/deployment/nextjs.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/guides/deployment/nextjs.mdx", "repo_id": "langchainjs", "token_count": 204 }
705
import { defaultProvider } from "@aws-sdk/credential-provider-node"; import { BaseLLMParams } from "@langchain/core/language_models/llms"; import { BaseBedrockInput } from "../../util/bedrock.js"; import { Bedrock as BaseBedrock } from "./web.js"; import { logVersion010MigrationWarning } from "../../util/entrypoint_dep...
langchainjs/langchain/src/llms/bedrock/index.ts/0
{ "file_path": "langchainjs/langchain/src/llms/bedrock/index.ts", "repo_id": "langchainjs", "token_count": 234 }
965
import { Document } from "@langchain/core/documents"; import { BaseRetriever, type BaseRetrieverInput, } from "@langchain/core/retrievers"; import { CallbackManagerForRetrieverRun } from "@langchain/core/callbacks/manager"; import { VectaraStore, type VectaraSummary, type VectaraFilter, DEFAULT_FILTER, } fr...
langchainjs/libs/langchain-community/src/retrievers/vectara_summary.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/retrievers/vectara_summary.ts", "repo_id": "langchainjs", "token_count": 641 }
999
<html> <main id="main-content"> Hello World! </main> </html>
langchain/libs/community/tests/unit_tests/document_loaders/test_docs/readthedocs/main_id_main_content/test.html/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_docs/readthedocs/main_id_main_content/test.html", "repo_id": "langchain", "token_count": 33 }
409
// 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/segments/load_field_data_info.go/0
{ "file_path": "milvus/internal/querynodev2/segments/load_field_data_info.go", "repo_id": "milvus", "token_count": 1293 }
1,992
from __future__ import annotations import logging from typing import Dict, List, Literal, Optional import requests from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.pydantic_v1 import Field, root_validator, validator from langchain_community.tools.edenai.edenai_base_tool import Edena...
langchain/libs/community/langchain_community/tools/edenai/audio_text_to_speech.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/edenai/audio_text_to_speech.py", "repo_id": "langchain", "token_count": 1627 }
287
import { loadEvaluator } from "langchain/evaluation"; import { PromptTemplate } from "@langchain/core/prompts"; const template = `Respond Y or N based on how well the following response follows the specified rubric. Grade only based on the rubric and expected response: Grading Rubric: {criteria} Expected Resp...
langchainjs/examples/src/guides/evaluation/string/configuring_criteria_prompt.ts/0
{ "file_path": "langchainjs/examples/src/guides/evaluation/string/configuring_criteria_prompt.ts", "repo_id": "langchainjs", "token_count": 384 }
775
# Model Summaries The model architectures included come from a wide variety of sources. Sources, including papers, original impl ("reference code") that I rewrote / adapted, and PyTorch impl that I leveraged directly ("code") are listed below. Most included models have pretrained weights. The weights are either: 1. ...
pytorch-image-models/docs/models.md/0
{ "file_path": "pytorch-image-models/docs/models.md", "repo_id": "pytorch-image-models", "token_count": 4347 }
344
from llama_index.core.readers.base import BaseReader from llama_index.readers.database import DatabaseReader def test_class(): names_of_base_classes = [b.__name__ for b in DatabaseReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-database/tests/test_readers_database.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-database/tests/test_readers_database.py", "repo_id": "llama_index", "token_count": 85 }
1,481
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/prompt_tuning/model.py/0
{ "file_path": "peft/src/peft/tuners/prompt_tuning/model.py", "repo_id": "peft", "token_count": 1437 }
308
<jupyter_start><jupyter_text>Spreedly>[Spreedly](https://docs.spreedly.com/) is a service that allows you to securely store credit cards and use them to transact against any number of payment gateways and third party APIs. It does this by simultaneously providing a card tokenization/vault service as well as a gateway a...
langchain/docs/docs/integrations/document_loaders/spreedly.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/spreedly.ipynb", "repo_id": "langchain", "token_count": 757 }
110
"""Param tuner.""" import asyncio from abc import abstractmethod from copy import deepcopy from typing import Any, Awaitable, Callable, Dict, List, Optional from llama_index.legacy.bridge.pydantic import BaseModel, Field, PrivateAttr from llama_index.legacy.utils import get_tqdm_iterable class RunResult(BaseModel):...
llama_index/llama-index-legacy/llama_index/legacy/param_tuner/base.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/param_tuner/base.py", "repo_id": "llama_index", "token_count": 4015 }
1,747
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/tests/test_decoder_models.py/0
{ "file_path": "peft/tests/test_decoder_models.py", "repo_id": "peft", "token_count": 6313 }
324
# coding=utf-8 # Copyright 2019-present, the HuggingFace Inc. team and Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Un...
transformers/examples/research_projects/distillation/grouped_batch_sampler.py/0
{ "file_path": "transformers/examples/research_projects/distillation/grouped_batch_sampler.py", "repo_id": "transformers", "token_count": 1750 }
540
# Vector store-backed retriever A vector store retriever is a retriever that uses a vector store to retrieve documents. It is a lightweight wrapper around the Vector Store class to make it conform to the Retriever interface. It uses the search methods implemented by a vector store, like similarity search and MMR, to q...
langchainjs/docs/core_docs/docs/modules/data_connection/retrievers/vectorstore.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/retrievers/vectorstore.mdx", "repo_id": "langchainjs", "token_count": 575 }
758
<jupyter_start><jupyter_text>Cloudflare Workers AI>[Cloudflare, Inc. (Wikipedia)](https://en.wikipedia.org/wiki/Cloudflare) is an American company that provides content delivery network services, cloud cybersecurity, DDoS mitigation, and ICANN-accredited domain registration services.>[Cloudflare Workers AI](https://dev...
langchain/docs/docs/integrations/text_embedding/cloudflare_workersai.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/cloudflare_workersai.ipynb", "repo_id": "langchain", "token_count": 507 }
174
# Authorization ## Configuration ### Resource Actions ```yaml resource_type_action: # This is here just for reference - tenant:create_tenant - tenant:get_tenant - db:create_database - db:get_database - db:reset - db:list_collections - collection:get_collection - db:create_collection - db:get_or_cre...
chroma/examples/basic_functionality/authz/README.md/0
{ "file_path": "chroma/examples/basic_functionality/authz/README.md", "repo_id": "chroma", "token_count": 1683 }
38
<jupyter_start><jupyter_text>Postgres Embedding> [Postgres Embedding](https://github.com/neondatabase/pg_embedding) is an open-source vector similarity search for `Postgres` that uses `Hierarchical Navigable Small Worlds (HNSW)` for approximate nearest neighbor search.>It supports:>- exact and approximate nearest neig...
langchain/docs/docs/integrations/vectorstores/pgembedding.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/pgembedding.ipynb", "repo_id": "langchain", "token_count": 1610 }
178
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/util/importutil/import_util.go/0
{ "file_path": "milvus/internal/util/importutil/import_util.go", "repo_id": "milvus", "token_count": 16195 }
2,074
#!/bin/bash # Exit immediately for non zero status set -e # Ensure $HOME exists when starting if [ ! -d "${HOME}" ]; then mkdir -p "${HOME}" fi # Setup $PS1 for a consistent and reasonable prompt if [ -w "${HOME}" ] && [ -d /etc/skel ]; then cp /etc/skel/.bash* "${HOME}" fi # Add current (arbitrary) user to /et...
milvus/build/docker/builder/entrypoint.sh/0
{ "file_path": "milvus/build/docker/builder/entrypoint.sh", "repo_id": "milvus", "token_count": 342 }
1,835
import os from langchain_community.chat_models import ChatOpenAI from langchain_community.embeddings import OpenAIEmbeddings from langchain_community.vectorstores import MomentoVectorIndex from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from langchain_cor...
langchain/templates/rag-momento-vector-index/rag_momento_vector_index/chain.py/0
{ "file_path": "langchain/templates/rag-momento-vector-index/rag_momento_vector_index/chain.py", "repo_id": "langchain", "token_count": 627 }
720
from llama_index.postprocessor.presidio.base import PresidioPIINodePostprocessor __all__ = ["PresidioPIINodePostprocessor"]
llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-presidio/llama_index/postprocessor/presidio/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-presidio/llama_index/postprocessor/presidio/__init__.py", "repo_id": "llama_index", "token_count": 40 }
1,265
from langchain_community.tools.google_trends.tool import GoogleTrendsQueryRun __all__ = ["GoogleTrendsQueryRun"]
langchain/libs/langchain/langchain/tools/google_trends/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/google_trends/tool.py", "repo_id": "langchain", "token_count": 35 }
554
""" Run this script to generate the model-index files in `models` from the templates in `.templates/models`. """ import argparse from pathlib import Path from jinja2 import Environment, FileSystemLoader import modelindex def generate_readmes(templates_path: Path, dest_path: Path): """Add the code snippet templ...
pytorch-image-models/docs/models/.templates/generate_readmes.py/0
{ "file_path": "pytorch-image-models/docs/models/.templates/generate_readmes.py", "repo_id": "pytorch-image-models", "token_count": 725 }
334
stages: benchmark_array_xd: cmd: python ./benchmarks/benchmark_array_xd.py deps: - ./benchmarks/benchmark_array_xd.py metrics: - ./benchmarks/results/benchmark_array_xd.json: cache: false benchmark_indices_mapping: cmd: python ./benchmarks/benchmark_indices_mapping.py deps: ...
datasets/dvc.yaml/0
{ "file_path": "datasets/dvc.yaml", "repo_id": "datasets", "token_count": 456 }
116
export { RunnableConfig } from "@langchain/core/runnables";
langchainjs/langchain/src/schema/runnable/config.ts/0
{ "file_path": "langchainjs/langchain/src/schema/runnable/config.ts", "repo_id": "langchainjs", "token_count": 19 }
1,015
from __future__ import annotations from typing import Any, Iterator, List, Optional, Sequence from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader from langchain_community.utilities.max_compute import MaxComputeAPIWrapper class MaxComputeLoader(BaseLoader):...
langchain/libs/community/langchain_community/document_loaders/max_compute.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/max_compute.py", "repo_id": "langchain", "token_count": 1407 }
239
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/tests/test_adaption_prompt.py/0
{ "file_path": "peft/tests/test_adaption_prompt.py", "repo_id": "peft", "token_count": 8363 }
339