text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
"""Logic for converting internal query language to a valid DashVector query.""" from typing import Tuple, Union from langchain.chains.query_constructor.ir import ( Comparator, Comparison, Operation, Operator, StructuredQuery, Visitor, ) class DashvectorTranslator(Visitor): """Logic for co...
langchain/libs/langchain/langchain/retrievers/self_query/dashvector.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/self_query/dashvector.py", "repo_id": "langchain", "token_count": 826 }
533
<jupyter_start><jupyter_text>LongLLMLinguaLongLLMLingua is a research project/paper that presents a new method for prompt compression in the long-context setting.- Paper: https://arxiv.org/abs/2310.06839- Repo: https://github.com/microsoft/LLMLinguaIn this guide, we show how you can seamlessly use prompt compression in...
llama_index/docs/examples/node_postprocessor/LongLLMLingua.ipynb/0
{ "file_path": "llama_index/docs/examples/node_postprocessor/LongLLMLingua.ipynb", "repo_id": "llama_index", "token_count": 1250 }
1,122
from llama_index.llms.langchain.base import LangChainLLM __all__ = ["LangChainLLM"]
llama_index/llama-index-integrations/llms/llama-index-llms-langchain/llama_index/llms/langchain/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-langchain/llama_index/llms/langchain/__init__.py", "repo_id": "llama_index", "token_count": 32 }
1,311
"""Power BI agent."""
langchain/libs/community/langchain_community/agent_toolkits/powerbi/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/powerbi/__init__.py", "repo_id": "langchain", "token_count": 7 }
215
# coding=utf-8 # 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 requir...
transformers/tests/models/distilbert/test_modeling_distilbert.py/0
{ "file_path": "transformers/tests/models/distilbert/test_modeling_distilbert.py", "repo_id": "transformers", "token_count": 7895 }
729
# Copyright 2021 The EleutherAI and HuggingFace Teams. 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 requi...
transformers/src/transformers/models/gptj/__init__.py/0
{ "file_path": "transformers/src/transformers/models/gptj/__init__.py", "repo_id": "transformers", "token_count": 1409 }
647
## init from llama_index.tools.bing_search.base import ( ENDPOINT_BASE_URL, BingSearchToolSpec, ) __all__ = ["BingSearchToolSpec", "ENDPOINT_BASE_URL"]
llama_index/llama-index-integrations/tools/llama-index-tools-bing-search/llama_index/tools/bing_search/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-bing-search/llama_index/tools/bing_search/__init__.py", "repo_id": "llama_index", "token_count": 68 }
1,417
<jupyter_start><jupyter_text>InstructPix2Pix: Learning to Follow Image Editing InstructionsA demo notebook for [InstructPix2Pix](https://www.timothybrooks.com/instruct-pix2pix/) using [diffusers](https://github.com/huggingface/diffusers). InstructPix2Pix is fine-tuned stable diffusion model which allows you to edit ima...
notebooks/diffusers/InstructPix2Pix_using_diffusers.ipynb/0
{ "file_path": "notebooks/diffusers/InstructPix2Pix_using_diffusers.ipynb", "repo_id": "notebooks", "token_count": 3610 }
275
from langchain_community.agent_toolkits.nasa.toolkit import NasaToolkit __all__ = ["NasaToolkit"]
langchain/libs/langchain/langchain/agents/agent_toolkits/nasa/toolkit.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/nasa/toolkit.py", "repo_id": "langchain", "token_count": 34 }
435
import asyncio from typing import ( Any, Iterable, List, Optional, Tuple, ) from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.vectorstores import VectorStore class SurrealDBStore(VectorStore): """ SurrealDB as Vector Store. ...
langchain/libs/community/langchain_community/vectorstores/surrealdb.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/surrealdb.py", "repo_id": "langchain", "token_count": 6920 }
341
import { ChatOpenAI } from "@langchain/openai"; import { HumanMessage } from "@langchain/core/messages"; const extractionFunctionSchema = { name: "extractor", description: "Extracts fields from the input.", parameters: { type: "object", properties: { tone: { type: "string", enum: ["...
langchainjs/examples/src/models/chat/openai_functions.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/openai_functions.ts", "repo_id": "langchainjs", "token_count": 574 }
850
use candle::{Module, Result, Tensor}; use candle_nn::VarBuilder; #[derive(Debug, Clone)] pub struct Embedding { inner: candle_nn::Embedding, span: tracing::Span, } impl Embedding { pub fn new(d1: usize, d2: usize, vb: VarBuilder) -> Result<Self> { let inner = candle_nn::embedding(d1, d2, vb)?; ...
candle/candle-transformers/src/models/with_tracing.rs/0
{ "file_path": "candle/candle-transformers/src/models/with_tracing.rs", "repo_id": "candle", "token_count": 1863 }
72
from langchain_community.document_loaders.parsers.docai import ( DocAIParser, DocAIParsingResults, ) __all__ = ["DocAIParsingResults", "DocAIParser"]
langchain/libs/langchain/langchain/document_loaders/parsers/docai.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/parsers/docai.py", "repo_id": "langchain", "token_count": 62 }
511
<jupyter_start><jupyter_text>Evaluating Q&A Systems with Dynamic Data[](https://colab.research.google.com/github/langchain-ai/langsmith-cookbook/blob/main/testing-examples/dynamic-data/testing_dynamic_data.ipynb)In many real-world scenarios, the correct answer to a question may change over time. For instance, if you're...
langsmith-cookbook/testing-examples/dynamic-data/testing_dynamic_data.ipynb/0
{ "file_path": "langsmith-cookbook/testing-examples/dynamic-data/testing_dynamic_data.ipynb", "repo_id": "langsmith-cookbook", "token_count": 2940 }
1,041
#include "flash_fwd_launch_template.h" void run_mha_fwd(Flash_fwd_params &params, cudaStream_t stream, bool force_split_kernel=false) { FP16_SWITCH(!params.is_bf16, [&] { FWD_HEADDIM_SWITCH(params.d, [&] { // if (params.num_splits <= 1 && !force_split_kernel) { // If we don't set it num_splits ...
candle/candle-flash-attn/kernels/flash_api.cu/0
{ "file_path": "candle/candle-flash-attn/kernels/flash_api.cu", "repo_id": "candle", "token_count": 1722 }
54
import pytest import yaml def pytest_addoption(parser): parser.addoption("--endpoint", action="store", default="http://127.0.0.1:19530", help="endpoint") parser.addoption("--token", action="store", default="root:Milvus", help="token") @pytest.fixture def endpoint(request): return request.config.getoptio...
milvus/tests/restful_client/conftest.py/0
{ "file_path": "milvus/tests/restful_client/conftest.py", "repo_id": "milvus", "token_count": 144 }
1,905
# `VectorDB Auto-evaluator` :brain: :memo: **Context** We previously introduced auto-evaluator, an open-source tool for grading LLM question-answer chains. But this app did not connect to an existing (e.g., production) VectorDB and did not test some interesting architectures for retrieval, such as metadata filtering....
auto-evaluator/streamlit/README.md/0
{ "file_path": "auto-evaluator/streamlit/README.md", "repo_id": "auto-evaluator", "token_count": 976 }
3
"""Test embedding functionalities.""" from collections import defaultdict from typing import Any, Dict, List from unittest.mock import patch import pytest from llama_index.core.indices.tree.base import TreeIndex from llama_index.core.indices.tree.select_leaf_embedding_retriever import ( TreeSelectLeafEmbeddingRet...
llama_index/llama-index-core/tests/indices/tree/test_embedding_retriever.py/0
{ "file_path": "llama_index/llama-index-core/tests/indices/tree/test_embedding_retriever.py", "repo_id": "llama_index", "token_count": 943 }
1,266
from langchain_openai.llms import __all__ EXPECTED_ALL = ["OpenAI", "AzureOpenAI"] def test_all_imports() -> None: assert sorted(EXPECTED_ALL) == sorted(__all__)
langchain/libs/partners/openai/tests/unit_tests/llms/test_imports.py/0
{ "file_path": "langchain/libs/partners/openai/tests/unit_tests/llms/test_imports.py", "repo_id": "langchain", "token_count": 65 }
678
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/extractors/llama-index-extractors-entity/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/extractors/llama-index-extractors-entity/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,260
<jupyter_start><jupyter_text>Awadb Vector Store If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-embeddings-huggingface %pip install llama-index-vector-stores-awadb !pip install llama-index<jupyter_output><empty_output><jupyter_text>Creatin...
llama_index/docs/examples/vector_stores/AwadbDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/AwadbDemo.ipynb", "repo_id": "llama_index", "token_count": 850 }
1,144
from __future__ import annotations import logging from typing import Any, Dict, List, Optional from langchain_core.embeddings import Embeddings from langchain_community.vectorstores.milvus import Milvus logger = logging.getLogger(__name__) class Zilliz(Milvus): """`Zilliz` vector store. You need to have ...
langchain/libs/community/langchain_community/vectorstores/zilliz.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/zilliz.py", "repo_id": "langchain", "token_count": 3761 }
335
// 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/nmq/nmq_server.go/0
{ "file_path": "milvus/pkg/mq/msgstream/mqwrapper/nmq/nmq_server.go", "repo_id": "milvus", "token_count": 1478 }
2,041
from neo4j_cypher.chain import chain if __name__ == "__main__": original_query = "Who played in Top Gun?" print(chain.invoke({"question": original_query})) # noqa: T201
langchain/templates/neo4j-cypher/main.py/0
{ "file_path": "langchain/templates/neo4j-cypher/main.py", "repo_id": "langchain", "token_count": 64 }
649
# 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 applicabl...
transformers/tests/models/mt5/test_modeling_flax_mt5.py/0
{ "file_path": "transformers/tests/models/mt5/test_modeling_flax_mt5.py", "repo_id": "transformers", "token_count": 950 }
800
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-zephyr-query-engine/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-zephyr-query-engine/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,688
"""Question answering over a graph.""" from __future__ import annotations from typing import Any, Dict, List, Optional from langchain_community.graphs.networkx_graph import NetworkxEntityGraph, get_entities from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import BasePromptTempl...
langchain/libs/langchain/langchain/chains/graph_qa/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/graph_qa/base.py", "repo_id": "langchain", "token_count": 1447 }
483
// 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/server_test.go/0
{ "file_path": "milvus/internal/querycoordv2/server_test.go", "repo_id": "milvus", "token_count": 7880 }
1,865
# coding=utf-8 # Copyright Studio-Ouisa and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
transformers/src/transformers/models/luke/tokenization_luke.py/0
{ "file_path": "transformers/src/transformers/models/luke/tokenization_luke.py", "repo_id": "transformers", "token_count": 38766 }
685
import json import logging from typing import List, Optional from langchain_core.chat_history import BaseChatMessageHistory from langchain_core.messages import ( BaseMessage, message_to_dict, messages_from_dict, ) from langchain_community.utilities.redis import get_client logger = logging.getLogger(__nam...
langchain/libs/community/langchain_community/chat_message_histories/redis.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_message_histories/redis.py", "repo_id": "langchain", "token_count": 835 }
221
from llama_index.embeddings.gemini.base import GeminiEmbedding __all__ = ["GeminiEmbedding"]
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-gemini/llama_index/embeddings/gemini/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-gemini/llama_index/embeddings/gemini/__init__.py", "repo_id": "llama_index", "token_count": 34 }
1,307
from langchain_community.utilities.clickup import ( ClickupAPIWrapper, Component, CUList, Member, Space, Task, Team, ) __all__ = [ "Component", "Task", "CUList", "Member", "Team", "Space", "ClickupAPIWrapper", ]
langchain/libs/langchain/langchain/utilities/clickup.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/clickup.py", "repo_id": "langchain", "token_count": 128 }
561
# LlamaIndex Vector_Stores Integration: Lantern
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-lantern/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-lantern/README.md", "repo_id": "llama_index", "token_count": 12 }
1,560
"""Common classes/functions for tree index operations.""" import asyncio import logging from typing import Dict, List, Optional, Sequence, Tuple from llama_index.core.async_utils import run_async_tasks from llama_index.core.callbacks.schema import CBEventType, EventPayload from llama_index.core.data_structs.data_str...
llama_index/llama-index-core/llama_index/core/indices/common_tree/base.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/common_tree/base.py", "repo_id": "llama_index", "token_count": 4262 }
1,176
# Metric Card for SQuAD ## Metric description This metric wraps the official scoring script for version 1 of the [Stanford Question Answering Dataset (SQuAD)](https://huggingface.co/datasets/squad). SQuAD is a reading comprehension dataset, consisting of questions posed by crowdworkers on a set of Wikipedia articles...
datasets/metrics/squad/README.md/0
{ "file_path": "datasets/metrics/squad/README.md", "repo_id": "datasets", "token_count": 1494 }
134
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/core/src/common/binary_set_c.h/0
{ "file_path": "milvus/internal/core/src/common/binary_set_c.h", "repo_id": "milvus", "token_count": 501 }
1,725
import { ChatOpenAI } from "@langchain/openai"; const model = new ChatOpenAI({ temperature: 0.9, modelName: "ft:gpt-3.5-turbo-0613:{ORG_NAME}::{MODEL_ID}", }); const message = await model.invoke("Hi there!"); console.log(message); /* AIMessage { content: 'Hello! How can I assist you today?', additiona...
langchainjs/examples/src/models/chat/integration_openai_fine_tune.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/integration_openai_fine_tune.ts", "repo_id": "langchainjs", "token_count": 138 }
897
# coding=utf-8 # Copyright 2023 Microsoft Research and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
transformers/src/transformers/models/kosmos2/configuration_kosmos2.py/0
{ "file_path": "transformers/src/transformers/models/kosmos2/configuration_kosmos2.py", "repo_id": "transformers", "token_count": 5219 }
701
"""LLM reranker.""" from typing import Callable, List, Optional from llama_index.core.bridge.pydantic import Field, PrivateAttr from llama_index.core.indices.utils import ( default_format_node_batch_fn, default_parse_choice_select_answer_fn, ) from llama_index.core.llms.llm import LLM from llama_index.core.pos...
llama_index/llama-index-core/llama_index/core/postprocessor/llm_rerank.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/postprocessor/llm_rerank.py", "repo_id": "llama_index", "token_count": 1902 }
1,164
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/others/test_image_processor.py/0
{ "file_path": "diffusers/tests/others/test_image_processor.py", "repo_id": "diffusers", "token_count": 5494 }
281
<!--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/model_summary.md/0
{ "file_path": "transformers/docs/source/ja/model_summary.md", "repo_id": "transformers", "token_count": 9488 }
522
# coding=utf-8 # Copyright 2021, Google and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
transformers/src/transformers/models/pegasus/configuration_pegasus.py/0
{ "file_path": "transformers/src/transformers/models/pegasus/configuration_pegasus.py", "repo_id": "transformers", "token_count": 2966 }
676
<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <url> <loc>https://python.langchain.com/en/stable/</loc> <lastmod>2023-05-04T16:15:31.377584+00:00</lastmod> <changefreq>weekly</changefreq> <priority>1<...
langchain/libs/community/tests/examples/sitemap.xml/0
{ "file_path": "langchain/libs/community/tests/examples/sitemap.xml", "repo_id": "langchain", "token_count": 363 }
339
/* * Copyright (c) 2010 Arc90 Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed t...
llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/readability_web/Readability.js/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/readability_web/Readability.js", "repo_id": "llama_index", "token_count": 35793 }
1,444
--- hide_table_of_contents: true --- import CodeBlock from "@theme/CodeBlock"; # AssemblyAI Audio Transcript This covers how to load audio (and video) transcripts as document objects from a file using the [AssemblyAI API](https://www.assemblyai.com/docs/api-reference/transcript). ## Usage First, you'll need to ins...
langchainjs/docs/core_docs/docs/integrations/document_loaders/web_loaders/assemblyai_audio_transcription.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/document_loaders/web_loaders/assemblyai_audio_transcription.mdx", "repo_id": "langchainjs", "token_count": 538 }
727
// 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/segcore/Reduce.h/0
{ "file_path": "milvus/internal/core/src/segcore/Reduce.h", "repo_id": "milvus", "token_count": 1385 }
1,736
import asyncio from typing import Any, Dict, Tuple import pytest from llama_index.legacy.indices.struct_store.base import default_output_parser from llama_index.legacy.indices.struct_store.sql import SQLStructStoreIndex from llama_index.legacy.indices.struct_store.sql_query import ( NLSQLTableQueryEngine, NLSt...
llama_index/llama-index-legacy/tests/indices/struct_store/test_sql_query.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/struct_store/test_sql_query.py", "repo_id": "llama_index", "token_count": 2303 }
1,622
"""Tool for the Reddit search API.""" from typing import 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.reddit_search import RedditSearchAPIWrapper cla...
langchain/libs/community/langchain_community/tools/reddit_search/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/reddit_search/tool.py", "repo_id": "langchain", "token_count": 761 }
299
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-microsoft-sharepoint/llama_index/readers/microsoft_sharepoint/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-microsoft-sharepoint/llama_index/readers/microsoft_sharepoint/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,400
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.cogniswitch import CogniswitchToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in CogniswitchToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-cogniswitch/tests/test_tools_cogniswitch.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-cogniswitch/tests/test_tools_cogniswitch.py", "repo_id": "llama_index", "token_count": 98 }
1,421
# Google MakerSuite Google's [MakerSuite](https://makersuite.google.com/) is a web-based playground for creating and saving chat, text, and "data" prompts that work with the Google PaLM API and model. These prompts include the text, which may include "test input" that act as template parameters, and parameters for the...
langchainjs/docs/core_docs/docs/ecosystem/integrations/makersuite.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/ecosystem/integrations/makersuite.mdx", "repo_id": "langchainjs", "token_count": 1208 }
715
import * as uuid from "uuid"; import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { MultiVectorRetriever } from "langchain/retrievers/multi_vector"; import { FaissStore } from "@langchain/community/vectorstores/faiss"; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; impor...
langchainjs/examples/src/retrievers/multi_vector_summary.ts/0
{ "file_path": "langchainjs/examples/src/retrievers/multi_vector_summary.ts", "repo_id": "langchainjs", "token_count": 869 }
913
import os import py import pytest from langchain_community.document_loaders import GitLoader def init_repo(tmpdir: py.path.local, dir_name: str) -> str: from git import Repo repo_dir = tmpdir.mkdir(dir_name) repo = Repo.init(repo_dir) git = repo.git git.checkout(b="main") git.config("user....
langchain/libs/community/tests/unit_tests/document_loaders/test_git.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_git.py", "repo_id": "langchain", "token_count": 670 }
371
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/indices/vector_store/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/vector_store/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,670
"""Neo4j Query Engine Pack.""" from enum import Enum from typing import Any, Dict, List, Optional from llama_index.core import ( KnowledgeGraphIndex, QueryBundle, ServiceContext, StorageContext, VectorStoreIndex, get_response_synthesizer, ) from llama_index.core.llama_pack.base import BaseLlam...
llama_index/llama-index-packs/llama-index-packs-neo4j-query-engine/llama_index/packs/neo4j_query_engine/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-neo4j-query-engine/llama_index/packs/neo4j_query_engine/base.py", "repo_id": "llama_index", "token_count": 3386 }
1,858
# Dreambooth for the inpainting model This script was added by @thedarkzeno . Please note that this script is not actively maintained, you can open an issue and tag @thedarkzeno or @patil-suraj though. ```bash export MODEL_NAME="runwayml/stable-diffusion-inpainting" export INSTANCE_DIR="path-to-instance-images" expo...
diffusers/examples/research_projects/dreambooth_inpaint/README.md/0
{ "file_path": "diffusers/examples/research_projects/dreambooth_inpaint/README.md", "repo_id": "diffusers", "token_count": 1502 }
214
from langchain_community.document_loaders.python import PythonLoader __all__ = ["PythonLoader"]
langchain/libs/langchain/langchain/document_loaders/python.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/python.py", "repo_id": "langchain", "token_count": 26 }
536
import threading from types import TracebackType from typing import Optional, Type class ReadWriteLock: """A lock object that allows many simultaneous "read locks", but only one "write lock." """ def __init__(self) -> None: self._read_ready = threading.Condition(threading.RLock()) self._r...
chroma/chromadb/utils/read_write_lock.py/0
{ "file_path": "chroma/chromadb/utils/read_write_lock.py", "repo_id": "chroma", "token_count": 873 }
28
<!--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/api/pipelines/stable_diffusion/k_diffusion.md/0
{ "file_path": "diffusers/docs/source/en/api/pipelines/stable_diffusion/k_diffusion.md", "repo_id": "diffusers", "token_count": 379 }
191
export * from "@langchain/community/utils/event_source_parse";
langchainjs/langchain/src/util/event-source-parse.ts/0
{ "file_path": "langchainjs/langchain/src/util/event-source-parse.ts", "repo_id": "langchainjs", "token_count": 18 }
946
"""Test JinaChat wrapper.""" from typing import cast import pytest from langchain_core.callbacks import CallbackManager from langchain_core.messages import BaseMessage, HumanMessage, SystemMessage from langchain_core.outputs import ChatGeneration, LLMResult from langchain_core.pydantic_v1 import SecretStr from pytest...
langchain/libs/community/tests/integration_tests/chat_models/test_jinachat.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/chat_models/test_jinachat.py", "repo_id": "langchain", "token_count": 2065 }
319
import logging from typing import Any, Dict, List, Optional from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models.llms import LLM from langchain_core.pydantic_v1 import Extra, root_validator from langchain_core.utils import get_from_dict_or_env from langchain_community.llms...
langchain/libs/community/langchain_community/llms/predictionguard.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/predictionguard.py", "repo_id": "langchain", "token_count": 1822 }
283
--- hide_table_of_contents: true sidebar_class_name: node-only --- # Sonix Audio :::tip Compatibility Only available on Node.js. ::: This covers how to load document objects from an audio file using the [Sonix](https://sonix.ai/) API. ## Setup To run this loader you will need to create an account on the https://so...
langchainjs/docs/core_docs/docs/integrations/document_loaders/web_loaders/sonix_audio_transcription.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/document_loaders/web_loaders/sonix_audio_transcription.mdx", "repo_id": "langchainjs", "token_count": 312 }
705
# coding=utf-8 # Copyright 2022 Meta and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
transformers/src/transformers/models/timesformer/modeling_timesformer.py/0
{ "file_path": "transformers/src/transformers/models/timesformer/modeling_timesformer.py", "repo_id": "transformers", "token_count": 15092 }
701
import os from pathlib import Path from langchain_community.document_loaders import UnstructuredCSVLoader EXAMPLE_DIRECTORY = file_path = Path(__file__).parent.parent / "examples" def test_unstructured_csv_loader() -> None: """Test unstructured loader.""" file_path = os.path.join(EXAMPLE_DIRECTORY, "stanley...
langchain/libs/community/tests/integration_tests/document_loaders/test_csv_loader.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_csv_loader.py", "repo_id": "langchain", "token_count": 155 }
347
from llama_index.readers.metal.base import MetalReader __all__ = ["MetalReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-metal/llama_index/readers/metal/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-metal/llama_index/readers/metal/__init__.py", "repo_id": "llama_index", "token_count": 26 }
1,397
python_tests()
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-openinference/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-openinference/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,294
from __future__ import annotations import os from decimal import Decimal from typing import Any, Dict, List, Set, Tuple import boto3 from boto3.dynamodb.conditions import Key from llama_index.core.storage.kvstore.types import DEFAULT_COLLECTION, BaseKVStore def parse_schema(table: Any) -> Tuple[str, str]: key_h...
llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-dynamodb/llama_index/storage/kvstore/dynamodb/base.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-dynamodb/llama_index/storage/kvstore/dynamodb/base.py", "repo_id": "llama_index", "token_count": 3079 }
1,469
from langchain.prompts.few_shot_with_templates import __all__ EXPECTED_ALL = ["FewShotPromptWithTemplates"] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
langchain/libs/langchain/tests/unit_tests/prompts/test_few_shot_with_templates.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/prompts/test_few_shot_with_templates.py", "repo_id": "langchain", "token_count": 71 }
610
package integration import ( "context" "testing" "time" "github.com/stretchr/testify/suite" ) type QueryNodeV2Suite struct { suite.Suite c *MiniClusterV2 } func (s *QueryNodeV2Suite) SetupSuite() { ctx := context.Background() var err error s.c, err = StartMiniClusterV2(ctx) s.Require().NoError(err) tim...
milvus/tests/integration/querynodev2_test.go/0
{ "file_path": "milvus/tests/integration/querynodev2_test.go", "repo_id": "milvus", "token_count": 233 }
1,949
<jupyter_start><jupyter_text>TOML>[TOML](https://en.wikipedia.org/wiki/TOML) is a file format for configuration files. It is intended to be easy to read and write, and is designed to map unambiguously to a dictionary. Its specification is open-source. `TOML` is implemented in many programming languages. The name `TOML`...
langchain/docs/docs/integrations/document_loaders/toml.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/toml.ipynb", "repo_id": "langchain", "token_count": 199 }
123
<jupyter_start><jupyter_text>ClientThis is an example client that interacts with the server that has "auth".Please reference appropriate documentation in the server code and in FastAPI to actually make this secure.**ATTENTION** Only the invoke endpoint has been defined by the server! So batch/stream won't work. If you ...
langserve/examples/auth/api_handler/client.ipynb/0
{ "file_path": "langserve/examples/auth/api_handler/client.ipynb", "repo_id": "langserve", "token_count": 526 }
995
// Pytorch also has an implementation of Philox RNG: https://github.com/pytorch/pytorch/blob/8ca3c881db3e3510fcb7725389f6a0633c9b992c/torch/csrc/jit/tensorexpr/cuda_random.h #pragma once // Philox CUDA. namespace flash { struct ull2 { unsigned long long x; unsigned long long y; }; inline __device__ uint2 mul...
candle/candle-flash-attn/kernels/philox.cuh/0
{ "file_path": "candle/candle-flash-attn/kernels/philox.cuh", "repo_id": "candle", "token_count": 2511 }
61
# Baseten [Baseten](https://baseten.co) provides all the infrastructure you need to deploy and serve ML models performantly, scalably, and cost-efficiently. As a model inference platform, Baseten is a `Provider` in the LangChain ecosystem. The Baseten integration currently implements a single `Component`, LLMs, but m...
langchain/docs/docs/integrations/providers/baseten.md/0
{ "file_path": "langchain/docs/docs/integrations/providers/baseten.md", "repo_id": "langchain", "token_count": 941 }
131
# iFixit >[iFixit](https://www.ifixit.com) is the largest, open repair community on the web. The site contains nearly 100k > repair manuals, 200k Questions & Answers on 42k devices, and all the data is licensed under `CC-BY-NC-SA 3.0`. ## Installation and Setup There isn't any special setup for it. ## Document Loa...
langchain/docs/docs/integrations/providers/ifixit.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/ifixit.mdx", "repo_id": "langchain", "token_count": 142 }
139
#!/usr/bin/env python """Example that shows how to upload files and process files in the server. This example uses a very simple architecture for dealing with file uploads and processing. The main issue with this approach is that processing is done in the same process rather than offloaded to a process pool. A smalle...
langserve/examples/file_processing/server.py/0
{ "file_path": "langserve/examples/file_processing/server.py", "repo_id": "langserve", "token_count": 636 }
1,041
# Want to name your test runs? Here's how! You can easily name LangSmith test projects by setting the `project_name` parameter. We recommend including a string identifier for the model/variant you are testing, along with a time-based component so that you can easily tell your test runs apart, e.g."\<prompt-123\> {time...
langsmith-cookbook/testing-examples/naming-test-projects/naming-test-projects.md/0
{ "file_path": "langsmith-cookbook/testing-examples/naming-test-projects/naming-test-projects.md", "repo_id": "langsmith-cookbook", "token_count": 203 }
1,072
<jupyter_start><jupyter_text>Conversation Knowledge GraphThis type of memory uses a knowledge graph to recreate memory. Using memory with LLM<jupyter_code>from langchain.memory import ConversationKGMemory from langchain_openai import OpenAI llm = OpenAI(temperature=0) memory = ConversationKGMemory(llm=llm) memory.save...
langchain/docs/docs/modules/memory/types/kg.ipynb/0
{ "file_path": "langchain/docs/docs/modules/memory/types/kg.ipynb", "repo_id": "langchain", "token_count": 922 }
204
import { OpenAI } from "@langchain/openai"; import { StructuredOutputParser } from "langchain/output_parsers"; import { PromptTemplate } from "@langchain/core/prompts"; // With a `StructuredOutputParser` we can define a schema for the output. const parser = StructuredOutputParser.fromNamesAndDescriptions({ answer: "...
langchainjs/examples/src/prompts/structured_parser.ts/0
{ "file_path": "langchainjs/examples/src/prompts/structured_parser.ts", "repo_id": "langchainjs", "token_count": 724 }
818
package planparserv2 import ( "github.com/milvus-io/milvus/internal/proto/planpb" ) var wildcards = map[byte]struct{}{ // '_': {}, // TODO '%': {}, } var escapeCharacter byte = '\\' // hasWildcards returns true if pattern contains any wildcard. func hasWildcards(pattern string) bool { l := len(pattern) i := l ...
milvus/internal/parser/planparserv2/pattern_match.go/0
{ "file_path": "milvus/internal/parser/planparserv2/pattern_match.go", "repo_id": "milvus", "token_count": 545 }
2,008
import logging from typing import Optional from llama_index.core.base.base_query_engine import BaseQueryEngine from llama_index.core.base.response.schema import RESPONSE_TYPE, Response from llama_index.core.callbacks.base import CallbackManager from llama_index.core.evaluation import BaseEvaluator from llama_index.cor...
llama_index/llama-index-core/llama_index/core/query_engine/retry_source_query_engine.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/query_engine/retry_source_query_engine.py", "repo_id": "llama_index", "token_count": 1674 }
1,289
<jupyter_start><jupyter_text>Comparing Q&A System Outputs[](https://colab.research.google.com/github/langchain-ai/langsmith-cookbook/blob/main/testing-examples/comparing-runs/comparing-qa.ipynb)The most common way to compare two models is to benchmark them both on a dataset and compare the aggregate metrics.This approa...
langsmith-cookbook/testing-examples/comparing-runs/comparing-qa.ipynb/0
{ "file_path": "langsmith-cookbook/testing-examples/comparing-runs/comparing-qa.ipynb", "repo_id": "langsmith-cookbook", "token_count": 5776 }
1,013
<!--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/unconditional_image_generation.md/0
{ "file_path": "diffusers/docs/source/en/using-diffusers/unconditional_image_generation.md", "repo_id": "diffusers", "token_count": 635 }
193
<jupyter_start><jupyter_text>Hugging Face Local PipelinesHugging Face models can be run locally through the `HuggingFacePipeline` class.The [Hugging Face Model Hub](https://huggingface.co/models) hosts over 120k models, 20k datasets, and 50k demo apps (Spaces), all open source and publicly available, in an online platf...
langchain/docs/docs/integrations/llms/huggingface_pipelines.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/huggingface_pipelines.ipynb", "repo_id": "langchain", "token_count": 1237 }
115
from typing import Any, AsyncGenerator, Generator try: import litellm except ImportError: litellm = None # type: ignore import pytest from llama_index.legacy.core.llms.types import ChatMessage from llama_index.legacy.llms.litellm import LiteLLM from pytest import MonkeyPatch from tests.conftest import Cache...
llama_index/llama-index-legacy/tests/llms/test_litellm.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/llms/test_litellm.py", "repo_id": "llama_index", "token_count": 2928 }
1,807
import pytest from langchain.schema import AIMessage, HumanMessage, SystemMessage from langchain_experimental.chat_models import Vicuna from tests.unit_tests.chat_models.test_llm_wrapper_llama2chat import FakeLLM @pytest.fixture def model() -> Vicuna: return Vicuna(llm=FakeLLM()) @pytest.fixture def model_cfg_...
langchain/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_vicuna.py/0
{ "file_path": "langchain/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_vicuna.py", "repo_id": "langchain", "token_count": 319 }
431
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/readers/github_readers/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/github_readers/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,518
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/test_backbone_common.py/0
{ "file_path": "transformers/tests/test_backbone_common.py", "repo_id": "transformers", "token_count": 4375 }
766
# 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/examples/legacy/seq2seq/old_test_seq2seq_examples.py/0
{ "file_path": "transformers/examples/legacy/seq2seq/old_test_seq2seq_examples.py", "repo_id": "transformers", "token_count": 2127 }
581
# coding=utf-8 # Copyright 2023 Microsoft and the HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
transformers/src/transformers/models/phi/convert_phi_weights_to_hf.py/0
{ "file_path": "transformers/src/transformers/models/phi/convert_phi_weights_to_hf.py", "repo_id": "transformers", "token_count": 3301 }
706
"""Test Base Schema of documents.""" from typing import Iterator, List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseBlobParser, BaseLoader from langchain_community.document_loaders.blob_loaders import Blob def test_base_blob_parser() -> None: """Verify ...
langchain/libs/community/tests/unit_tests/document_loaders/test_base.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_base.py", "repo_id": "langchain", "token_count": 566 }
407
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/agent/custom/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/agent/custom/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,485
# Information Gain Filtration(IGF) Authors @Tuko @mraunak This folder contains the code how to implement IGF for finetuning on GPT-2. ## What is IGF? Here we present a general fine-tuning method that we call information gain filtration for improving the overall training efficiency and final performance of language...
transformers/examples/research_projects/information-gain-filtration/README.md/0
{ "file_path": "transformers/examples/research_projects/information-gain-filtration/README.md", "repo_id": "transformers", "token_count": 1456 }
562
import { NodeHandler, ASTParser } from "./base.js"; import { NumericLiteralType } from "./types.js"; /** * Handler for numeric literal nodes in an abstract syntax tree (AST). * Extends the NodeHandler class. */ export class NumericLiteralHandler extends NodeHandler { /** * Checks if a given node is a numeric l...
langchainjs/langchain/src/output_parsers/expression_type_handlers/numeric_literal_handler.ts/0
{ "file_path": "langchainjs/langchain/src/output_parsers/expression_type_handlers/numeric_literal_handler.ts", "repo_id": "langchainjs", "token_count": 425 }
974
"""RWKV models. Based on https://github.com/saharNooby/rwkv.cpp/blob/master/rwkv/chat_with_bot.py https://github.com/BlinkDL/ChatRWKV/blob/main/v2/chat.py """ from typing import Any, Dict, List, Mapping, Optional, Set from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_...
langchain/libs/community/langchain_community/llms/rwkv.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/rwkv.py", "repo_id": "langchain", "token_count": 3437 }
273
from langchain_community.llms.arcee import Arcee __all__ = ["Arcee"]
langchain/libs/langchain/langchain/llms/arcee.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/arcee.py", "repo_id": "langchain", "token_count": 28 }
512
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/utils/check_support_list.py/0
{ "file_path": "transformers/utils/check_support_list.py", "repo_id": "transformers", "token_count": 1443 }
868
""" RepViT Paper: `RepViT: Revisiting Mobile CNN From ViT Perspective` - https://arxiv.org/abs/2307.09283 @misc{wang2023repvit, title={RepViT: Revisiting Mobile CNN From ViT Perspective}, author={Ao Wang and Hui Chen and Zijia Lin and Hengjun Pu and Guiguang Ding}, year={2023}, eprint={23...
pytorch-image-models/timm/models/repvit.py/0
{ "file_path": "pytorch-image-models/timm/models/repvit.py", "repo_id": "pytorch-image-models", "token_count": 8357 }
367
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/llms/llama-index-llms-konko/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-konko/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,354
import unittest from langchain_community.document_loaders.rspace import RSpaceLoader class TestRSpaceLoader(unittest.TestCase): url = "https://community.researchspace.com" api_key = "myapikey" global_id = "SD12345" def test_valid_arguments(self) -> None: loader = RSpaceLoader( ur...
langchain/libs/community/tests/unit_tests/document_loaders/test_rspace_loader.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_rspace_loader.py", "repo_id": "langchain", "token_count": 591 }
371