text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: Milvus Storage Description: Storage wrapper for Milvus Version: @MILVUS_VERSION@ Libs: -L${libdir} -lmilvus_storage Cflags: -I${includedir}
milvus/internal/core/src/storage/milvus_storage.pc.in/0
{ "file_path": "milvus/internal/core/src/storage/milvus_storage.pc.in", "repo_id": "milvus", "token_count": 97 }
1,896
import tempfile from pathlib import Path from typing import Generator import pytest from langchain_core.messages import AIMessage, HumanMessage from langchain_community.chat_message_histories import FileChatMessageHistory @pytest.fixture def file_chat_message_history() -> Generator[FileChatMessageHistory, None, Non...
langchain/libs/community/tests/unit_tests/chat_message_histories/test_file.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/chat_message_histories/test_file.py", "repo_id": "langchain", "token_count": 942 }
392
import torch import time from dataclasses import dataclass from opentelemetry import trace from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, PreTrainedTokenizerBase from typing import Optional, Tuple, List, Type, Dict from text_generation_server.utils.tokens import batch_top_tokens from text_generation_s...
text-generation-inference/server/text_generation_server/models/seq2seq_lm.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/seq2seq_lm.py", "repo_id": "text-generation-inference", "token_count": 16171 }
387
<jupyter_start><jupyter_text>Using PEFT with custom models `peft` allows us to fine-tune models efficiently with LoRA. In this short notebook, we will demonstrate how to train a simple multilayer perceptron (MLP) using `peft`. Imports Make sure that you have the latest version of `peft` installed. To ensure that, run ...
peft/examples/multilayer_perceptron/multilayer_perceptron_lora.ipynb/0
{ "file_path": "peft/examples/multilayer_perceptron/multilayer_perceptron_lora.ipynb", "repo_id": "peft", "token_count": 4094 }
314
from llama_index.packs.streamlit_chatbot.base import StreamlitChatPack __all__ = ["StreamlitChatPack"]
llama_index/llama-index-packs/llama-index-packs-streamlit-chatbot/llama_index/packs/streamlit_chatbot/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-streamlit-chatbot/llama_index/packs/streamlit_chatbot/__init__.py", "repo_id": "llama_index", "token_count": 33 }
1,701
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/rss/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/rss/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,392
# Hello world! We will now create the hello world of the ML world, building a model capable of solving MNIST dataset. Open `src/main.rs` and fill in this content: ```rust # extern crate candle_core; use candle_core::{Device, Result, Tensor}; struct Model { first: Tensor, second: Tensor, } impl Model { ...
candle/candle-book/src/guide/hello_world.md/0
{ "file_path": "candle/candle-book/src/guide/hello_world.md", "repo_id": "candle", "token_count": 2069 }
30
# coding=utf-8 # Copyright 2021 The Fairseq Authors, 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...
transformers/src/transformers/models/wavlm/modeling_wavlm.py/0
{ "file_path": "transformers/src/transformers/models/wavlm/modeling_wavlm.py", "repo_id": "transformers", "token_count": 33888 }
740
"""Test base tool child implementations.""" import inspect import re from typing import List, Type import pytest from langchain_core.tools import BaseTool from langchain_community.tools.amadeus.base import AmadeusBaseTool from langchain_community.tools.gmail.base import GmailBaseTool from langchain_community.tools....
langchain/libs/community/tests/unit_tests/tools/test_signatures.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/tools/test_signatures.py", "repo_id": "langchain", "token_count": 784 }
408
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
transformers/examples/research_projects/performer/modeling_flax_performer_utils.py/0
{ "file_path": "transformers/examples/research_projects/performer/modeling_flax_performer_utils.py", "repo_id": "transformers", "token_count": 11671 }
568
import { AIMessage, type BaseMessage, HumanMessage, FunctionMessage, } from "@langchain/core/messages"; import type { AgentStep } from "@langchain/core/agents"; import { renderTemplate } from "@langchain/core/prompts"; import { TEMPLATE_TOOL_RESPONSE } from "../chat_convo/prompt.js"; /** * Format a list of Ag...
langchainjs/langchain/src/agents/format_scratchpad/openai_functions.ts/0
{ "file_path": "langchainjs/langchain/src/agents/format_scratchpad/openai_functions.ts", "repo_id": "langchainjs", "token_count": 557 }
892
# 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/src/transformers/models/speecht5/processing_speecht5.py/0
{ "file_path": "transformers/src/transformers/models/speecht5/processing_speecht5.py", "repo_id": "transformers", "token_count": 3047 }
746
# 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/processing_kosmos2.py/0
{ "file_path": "transformers/src/transformers/models/kosmos2/processing_kosmos2.py", "repo_id": "transformers", "token_count": 13353 }
654
<!--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/ko/optimization/open_vino.md/0
{ "file_path": "diffusers/docs/source/ko/optimization/open_vino.md", "repo_id": "diffusers", "token_count": 920 }
203
import { BaseRetriever, type BaseRetrieverInput, } from "@langchain/core/retrievers"; import { AsyncCaller, type AsyncCallerParams, } from "@langchain/core/utils/async_caller"; import type { DocumentInterface } from "@langchain/core/documents"; /** * Type for the authentication method used by the RemoteRetrie...
langchainjs/libs/langchain-community/src/retrievers/remote/base.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/retrievers/remote/base.ts", "repo_id": "langchainjs", "token_count": 1074 }
1,032
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-neutrino/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-neutrino/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,235
import argparse import logging import math import os from pathlib import Path import jax import jax.numpy as jnp import numpy as np import optax import torch import torch.utils.checkpoint import transformers from flax import jax_utils from flax.training import train_state from flax.training.common_utils import shard f...
diffusers/examples/dreambooth/train_dreambooth_flax.py/0
{ "file_path": "diffusers/examples/dreambooth/train_dreambooth_flax.py", "repo_id": "diffusers", "token_count": 11966 }
210
import json from typing import Any, Callable, Dict, List, Optional from llama_index.legacy.bridge.pydantic import Field, root_validator from llama_index.legacy.core.llms.types import ChatMessage, MessageRole from llama_index.legacy.llms.llm import LLM from llama_index.legacy.llms.types import ChatMessage, MessageRole ...
llama_index/llama-index-legacy/llama_index/legacy/memory/chat_memory_buffer.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/memory/chat_memory_buffer.py", "repo_id": "llama_index", "token_count": 2455 }
1,740
# flake8: noqa PREFIX = """ You are working with a spark dataframe in Python. The name of the dataframe is `df`. You should use the tools below to answer the question posed of you:""" SUFFIX = """ This is the result of `print(df.first())`: {df} Begin! Question: {input} {agent_scratchpad}"""
langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/spark/prompt.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/spark/prompt.py", "repo_id": "langchain", "token_count": 98 }
442
<jupyter_start><jupyter_text>Joplin>[Joplin](https://joplinapp.org/) is an open-source note-taking app. Capture your thoughts and securely access them from any device.This notebook covers how to load documents from a `Joplin` database.`Joplin` has a [REST API](https://joplinapp.org/api/references/rest_api/) for accessi...
langchain/docs/docs/integrations/document_loaders/joplin.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/joplin.ipynb", "repo_id": "langchain", "token_count": 336 }
101
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/oneformer/test_modeling_oneformer.py/0
{ "file_path": "transformers/tests/models/oneformer/test_modeling_oneformer.py", "repo_id": "transformers", "token_count": 10046 }
802
# 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 applicabl...
transformers/src/transformers/models/univnet/feature_extraction_univnet.py/0
{ "file_path": "transformers/src/transformers/models/univnet/feature_extraction_univnet.py", "repo_id": "transformers", "token_count": 9294 }
667
python_sources()
llama_index/llama-index-packs/llama-index-packs-vanna/llama_index/packs/vanna/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-vanna/llama_index/packs/vanna/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,683
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/llms/llama-index-llms-openai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-openai/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,293
# 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...
accelerate/src/accelerate/big_modeling.py/0
{ "file_path": "accelerate/src/accelerate/big_modeling.py", "repo_id": "accelerate", "token_count": 10832 }
10
<jupyter_start><jupyter_text>Add fallbacksThere are many possible points of failure in an LLM application, whether that be issues with LLM API's, poor model outputs, issues with other integrations, etc. Fallbacks help you gracefully handle and isolate these issues.Crucially, fallbacks can be applied not only on the LLM...
langchain/docs/docs/expression_language/how_to/fallbacks.ipynb/0
{ "file_path": "langchain/docs/docs/expression_language/how_to/fallbacks.ipynb", "repo_id": "langchain", "token_count": 1781 }
91
<jupyter_start><jupyter_text>IntroductionIn this notebook, we are going to fine-tune the LayoutLM model by Microsoft Research on the [FUNSD](https://guillaumejaume.github.io/FUNSD/) dataset, which is a collection of annotated form documents. The goal of our model is to learn the annotations of a number of labels ("ques...
peft/examples/token_classification/peft_lora_token_cls.ipynb/0
{ "file_path": "peft/examples/token_classification/peft_lora_token_cls.ipynb", "repo_id": "peft", "token_count": 11949 }
302
# Segment Interface ## External Interface 1. `get_row_count`: Get the number of entities in the segment 2. `get_schema`: Get the corresponding collection schema in the segment 3. `GetMemoryUsageInBytes`: Get memory usage of a segment 4. `Search(plan, placeholderGroup, timestamp) -> QueryResult`: Perform search operat...
milvus/docs/design_docs/segcore/segment_interface.md/0
{ "file_path": "milvus/docs/design_docs/segcore/segment_interface.md", "repo_id": "milvus", "token_count": 923 }
1,715
from typing import Any, Dict, List try: from llama_index.readers.sec_filings.prepline_sec_filings.sec_document import ( REPORT_TYPES, VALID_FILING_TYPES, SECDocument, ) from llama_index.readers.sec_filings.prepline_sec_filings.sections import ( ALL_SECTIONS, SECTIONS...
llama_index/llama-index-integrations/readers/llama-index-readers-sec-filings/llama_index/readers/sec_filings/sec_filings.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-sec-filings/llama_index/readers/sec_filings/sec_filings.py", "repo_id": "llama_index", "token_count": 5045 }
1,454
// 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/json_parser.go/0
{ "file_path": "milvus/internal/util/importutil/json_parser.go", "repo_id": "milvus", "token_count": 4294 }
1,803
# coding=utf-8 # Copyright 2023 The Intel Labs Team Authors, The Microsoft Research Team Authors and HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License a...
transformers/src/transformers/models/bridgetower/modeling_bridgetower.py/0
{ "file_path": "transformers/src/transformers/models/bridgetower/modeling_bridgetower.py", "repo_id": "transformers", "token_count": 37419 }
577
<jupyter_start><jupyter_text>DSPy[DSPy](https://github.com/stanfordnlp/dspy) is a fantastic framework for LLMs that introduces an automatic compiler that teaches LMs how to conduct the declarative steps in your program. Specifically, the DSPy compiler will internally trace your program and then craft high-quality promp...
langchain/docs/docs/integrations/providers/dspy.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/providers/dspy.ipynb", "repo_id": "langchain", "token_count": 3880 }
143
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #ifndef _tuning_h #define _tuning_h struct ExLlamaTuning { int matmul_recons_thd; bool matmul_fused_remap; bool matmul_no_half2; }; #endif
text-generation-inference/server/exllama_kernels/exllama_kernels/tuning.h/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/tuning.h", "repo_id": "text-generation-inference", "token_count": 106 }
377
from abc import ABC, abstractmethod from chromadb.config import Settings class Server(ABC): @abstractmethod def __init__(self, settings: Settings): pass
chroma/chromadb/server/__init__.py/0
{ "file_path": "chroma/chromadb/server/__init__.py", "repo_id": "chroma", "token_count": 58 }
22
"""Base class for Office 365 tools.""" from __future__ import annotations from typing import TYPE_CHECKING from langchain_core.pydantic_v1 import Field from langchain_core.tools import BaseTool from langchain_community.tools.office365.utils import authenticate if TYPE_CHECKING: from O365 import Account class ...
langchain/libs/community/langchain_community/tools/office365/base.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/office365/base.py", "repo_id": "langchain", "token_count": 145 }
289
<jupyter_start><jupyter_text>Dall-E Image Generator>[OpenAI Dall-E](https://openai.com/dall-e-3) are text-to-image models developed by `OpenAI` using deep learning methodologies to generate digital images from natural language descriptions, called "prompts".This notebook shows how you can generate images from a prompt ...
langchain/docs/docs/integrations/tools/dalle_image_generator.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/dalle_image_generator.ipynb", "repo_id": "langchain", "token_count": 1302 }
172
from abc import abstractmethod from typing import Any, Callable, List from overrides import EnforceOverrides, overrides from chromadb.config import Component, System from chromadb.types import Segment class SegmentDirectory(Component): """A segment directory is a data interface that manages the location of segme...
chroma/chromadb/segment/distributed/__init__.py/0
{ "file_path": "chroma/chromadb/segment/distributed/__init__.py", "repo_id": "chroma", "token_count": 814 }
20
from langchain_community.retrievers.arxiv import ArxivRetriever __all__ = ["ArxivRetriever"]
langchain/libs/langchain/langchain/retrievers/arxiv.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/arxiv.py", "repo_id": "langchain", "token_count": 35 }
555
# (Gluon) SENet A **SENet** is a convolutional neural network architecture that employs [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) to enable the network to perform dynamic channel-wise feature recalibration. The weights from this model were ported from [Gluon](http...
pytorch-image-models/docs/models/.templates/models/gloun-senet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/gloun-senet.md", "repo_id": "pytorch-image-models", "token_count": 747 }
360
python_tests()
llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-cohere-rerank/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-cohere-rerank/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,261
"""Test Google Cloud Document AI Warehouse retriever.""" import os from langchain_core.documents import Document from langchain_community.retrievers import GoogleDocumentAIWarehouseRetriever def test_google_documentai_warehoure_retriever() -> None: """In order to run this test, you should provide a project_id a...
langchain/libs/community/tests/integration_tests/retrievers/test_google_docai_warehoure_retriever.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/retrievers/test_google_docai_warehoure_retriever.py", "repo_id": "langchain", "token_count": 298 }
341
# (Tensorflow) MixNet **MixNet** is a type of convolutional neural network discovered via AutoML that utilises [MixConvs](https://paperswithcode.com/method/mixconv) instead of regular [depthwise convolutions](https://paperswithcode.com/method/depthwise-convolution). The weights from this model were ported from [Tenso...
pytorch-image-models/docs/models/tf-mixnet.md/0
{ "file_path": "pytorch-image-models/docs/models/tf-mixnet.md", "repo_id": "pytorch-image-models", "token_count": 2356 }
358
"""LiteLLM Router as LangChain Model.""" from typing import ( Any, AsyncIterator, Iterator, List, Mapping, Optional, ) from langchain_core.callbacks.manager import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_models.chat_models import ( a...
langchain/libs/community/langchain_community/chat_models/litellm_router.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/litellm_router.py", "repo_id": "langchain", "token_count": 3514 }
239
import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class BaseCompressedFileFileSystem(AbstractArchiveFileSystem): """Read contents of compressed file as a filesystem with one file inside.""" root_marker = "" ...
datasets/src/datasets/filesystems/compression.py/0
{ "file_path": "datasets/src/datasets/filesystems/compression.py", "repo_id": "datasets", "token_count": 2608 }
151
<p align="center"> <a href="https://trychroma.com"><img src="https://user-images.githubusercontent.com/891664/227103090-6624bf7d-9524-4e05-9d2c-c28d5d451481.png" alt="Chroma logo"></a> </p> <p align="center"> <b>Chroma - the open-source embedding database</b>. <br /> The fastest way to build Python or JavaSc...
chroma/README.md/0
{ "file_path": "chroma/README.md", "repo_id": "chroma", "token_count": 1872 }
13
# coding=utf-8 # Copyright Deepmind 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/perceiver/configuration_perceiver.py/0
{ "file_path": "transformers/src/transformers/models/perceiver/configuration_perceiver.py", "repo_id": "transformers", "token_count": 4729 }
644
package milvus import ( "flag" "fmt" "os" ) const ( DryRunCmd = "dry-run" ) var ( BuildTags = "unknown" BuildTime = "unknown" GitCommit = "unknown" GoVersion = "unknown" ) type command interface { execute(args []string, flags *flag.FlagSet) } type dryRun struct{} func (c *dryRun) execute(args []string, f...
milvus/cmd/milvus/milvus.go/0
{ "file_path": "milvus/cmd/milvus/milvus.go", "repo_id": "milvus", "token_count": 425 }
1,893
# 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/src/transformers/models/mobilevitv2/configuration_mobilevitv2.py/0
{ "file_path": "transformers/src/transformers/models/mobilevitv2/configuration_mobilevitv2.py", "repo_id": "transformers", "token_count": 2821 }
636
python_sources()
llama_index/llama-index-packs/llama-index-packs-node-parser-semantic-chunking/llama_index/packs/node_parser_semantic_chunking/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-node-parser-semantic-chunking/llama_index/packs/node_parser_semantic_chunking/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,664
# 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/src/transformers/commands/add_new_model_like.py/0
{ "file_path": "transformers/src/transformers/commands/add_new_model_like.py", "repo_id": "transformers", "token_count": 30693 }
589
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/encoder_decoder/modeling_encoder_decoder.py/0
{ "file_path": "transformers/src/transformers/models/encoder_decoder/modeling_encoder_decoder.py", "repo_id": "transformers", "token_count": 14818 }
613
from typing import List, Optional from langchain.chains.graph_qa.cypher_utils import CypherQueryCorrector, Schema from langchain.chains.openai_functions import create_structured_output_chain from langchain_community.chat_models import ChatOpenAI from langchain_community.graphs import Neo4jGraph from langchain_core.out...
langchain/templates/neo4j-cypher-ft/neo4j_cypher_ft/chain.py/0
{ "file_path": "langchain/templates/neo4j-cypher-ft/neo4j_cypher_ft/chain.py", "repo_id": "langchain", "token_count": 1494 }
647
# 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/examples/community/rerender_a_video.py/0
{ "file_path": "diffusers/examples/community/rerender_a_video.py", "repo_id": "diffusers", "token_count": 26688 }
201
[build-system] build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] [tool.codespell] check-filenames = true check-hidden = true ignore-words-list = "astroid,gallary,momento,narl,ot,rouge" # Feel free to un-skip examples, and experimental, you will just need to # work through many typos (--write-changes...
llama_index/llama-index-legacy/pyproject.toml/0
{ "file_path": "llama_index/llama-index-legacy/pyproject.toml", "repo_id": "llama_index", "token_count": 3121 }
1,625
import logging from typing import Any, Callable, Dict, Optional, Sequence from llama_index.core.base.llms.types import ( ChatMessage, ChatResponse, ChatResponseAsyncGen, ChatResponseGen, CompletionResponse, CompletionResponseAsyncGen, CompletionResponseGen, ) from llama_index.core.bridge.py...
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/base.py/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/base.py", "repo_id": "llama_index", "token_count": 4819 }
1,326
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-arango-db/llama_index/readers/arango_db/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-arango-db/llama_index/readers/arango_db/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,319
[tool.poetry] name = "rag-conversation" version = "0.1.0" description = "Conversational RAG using Pinecone" authors = [ "Lance Martin <lance@langchain.dev>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" openai = "<2" tiktoken = ">=0.5.1" pinecone-client = ">=2.2.4" b...
langchain/templates/rag-conversation/pyproject.toml/0
{ "file_path": "langchain/templates/rag-conversation/pyproject.toml", "repo_id": "langchain", "token_count": 308 }
694
<jupyter_start><jupyter_text>Apify Dataset>[Apify Dataset](https://docs.apify.com/platform/storage/dataset) is a scalable append-only storage with sequential access built for storing structured web scraping results, such as a list of products or Google SERPs, and then export them to various formats like JSON, CSV, or E...
langchain/docs/docs/integrations/document_loaders/apify_dataset.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/apify_dataset.ipynb", "repo_id": "langchain", "token_count": 859 }
102
"""Test embedding model integration.""" from langchain_nomic.embeddings import NomicEmbeddings def test_initialization() -> None: """Test embedding model initialization.""" NomicEmbeddings(model="nomic-embed-text-v1")
langchain/libs/partners/nomic/tests/unit_tests/test_embeddings.py/0
{ "file_path": "langchain/libs/partners/nomic/tests/unit_tests/test_embeddings.py", "repo_id": "langchain", "token_count": 72 }
671
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-nougat-ocr/llama_index/readers/nougat_ocr/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-nougat-ocr/llama_index/readers/nougat_ocr/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,348
# 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/pipelines/kandinsky/test_kandinsky_inpaint.py/0
{ "file_path": "diffusers/tests/pipelines/kandinsky/test_kandinsky_inpaint.py", "repo_id": "diffusers", "token_count": 5400 }
279
from typing import Dict, Optional import logging from chromadb.api.client import Client as ClientCreator from chromadb.api.client import AdminClient as AdminClientCreator from chromadb.auth.token import TokenTransportHeader import chromadb.config from chromadb.config import DEFAULT_DATABASE, DEFAULT_TENANT, Settings fr...
chroma/chromadb/__init__.py/0
{ "file_path": "chroma/chromadb/__init__.py", "repo_id": "chroma", "token_count": 3007 }
11
export * from "./pairwise.js";
langchainjs/langchain/src/evaluation/comparison/index.ts/0
{ "file_path": "langchainjs/langchain/src/evaluation/comparison/index.ts", "repo_id": "langchainjs", "token_count": 11 }
904
import sqlite3 from abc import ABC, abstractmethod from typing import Any, Set import threading from overrides import override class Connection: """A threadpool connection that returns itself to the pool on close()""" _pool: "Pool" _db_file: str _conn: sqlite3.Connection def __init__( se...
chroma/chromadb/db/impl/sqlite_pool.py/0
{ "file_path": "chroma/chromadb/db/impl/sqlite_pool.py", "repo_id": "chroma", "token_count": 2068 }
16
"""Read Pubmed Papers.""" from typing import List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class PubmedReader(BaseReader): """Pubmed Reader. Gets a search query, return a list of Documents of the top corresponding scientific papers on Pubme...
llama_index/llama-index-integrations/readers/llama-index-readers-papers/llama_index/readers/papers/pubmed/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-papers/llama_index/readers/papers/pubmed/base.py", "repo_id": "llama_index", "token_count": 3630 }
1,441
<!--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/fr/quicktour.md/0
{ "file_path": "transformers/docs/source/fr/quicktour.md", "repo_id": "transformers", "token_count": 10715 }
484
"""Integration test for embedding-based relevant doc filtering.""" import numpy as np from langchain_community.document_transformers.embeddings_redundant_filter import ( _DocumentWithState, ) from langchain_community.embeddings import OpenAIEmbeddings from langchain_core.documents import Document from langchain.re...
langchain/libs/langchain/tests/integration_tests/retrievers/document_compressors/test_embeddings_filter.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/retrievers/document_compressors/test_embeddings_filter.py", "repo_id": "langchain", "token_count": 618 }
642
from typing import Optional import pytest from langchain_core.documents import Document from langchain_community.vectorstores import Qdrant from tests.integration_tests.vectorstores.fake_embeddings import ( ConsistentFakeEmbeddings, ) from tests.integration_tests.vectorstores.qdrant.common import assert_documents...
langchain/libs/community/tests/integration_tests/vectorstores/qdrant/test_max_marginal_relevance.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/qdrant/test_max_marginal_relevance.py", "repo_id": "langchain", "token_count": 955 }
389
<jupyter_start><jupyter_text>Vision-based Evals in JavaScriptLangSmith's support for custom evaluators grants you great flexibility with checking your chains against datasets. One exciting possibility for certain visual generative use cases is prompting vision models to determine success.This notebook will walk through...
langsmith-cookbook/typescript-testing-examples/vision-evals/vision-evals.ipynb/0
{ "file_path": "langsmith-cookbook/typescript-testing-examples/vision-evals/vision-evals.ipynb", "repo_id": "langsmith-cookbook", "token_count": 2407 }
1,023
<!--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/model_doc/longt5.md/0
{ "file_path": "transformers/docs/source/en/model_doc/longt5.md", "repo_id": "transformers", "token_count": 1797 }
487
import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { formatDocumentsAsString } from "langchain/util/document"; import { PromptTemplate } from "@langchain/core/prompts"; import { RunnableSequence } from "@langchain/core/runnables"...
langchainjs/examples/src/guides/expression_language/cookbook_retriever_map.ts/0
{ "file_path": "langchainjs/examples/src/guides/expression_language/cookbook_retriever_map.ts", "repo_id": "langchainjs", "token_count": 517 }
807
from string import Formatter from typing import List from llama_index.core.llms.base import BaseLLM def get_template_vars(template_str: str) -> List[str]: """Get template variables from a template string.""" variables = [] formatter = Formatter() for _, variable_name, _, _ in formatter.parse(templat...
llama_index/llama-index-core/llama_index/core/prompts/utils.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/prompts/utils.py", "repo_id": "llama_index", "token_count": 178 }
1,286
from langchain_community.chat_models import ChatOpenAI from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from langchain_core.runnables import ConfigurableField WRITER_SYSTEM_PROMPT = "You are an AI critical thinker research assistant. Your sole purpose is t...
langchain/templates/research-assistant/research_assistant/writer.py/0
{ "file_path": "langchain/templates/research-assistant/research_assistant/writer.py", "repo_id": "langchain", "token_count": 1000 }
709
/** @type {import('next').NextConfig} */ const nextConfig = {} module.exports = nextConfig
langsmith-cookbook/feedback-examples/nextjs/next.config.js/0
{ "file_path": "langsmith-cookbook/feedback-examples/nextjs/next.config.js", "repo_id": "langsmith-cookbook", "token_count": 28 }
1,095
<!--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/model_doc/ernie.md/0
{ "file_path": "transformers/docs/source/en/model_doc/ernie.md", "repo_id": "transformers", "token_count": 1417 }
442
# Retriever Modes Here we show the mapping from `retriever_mode` configuration to the selected retriever class. > Note that `retriever_mode` can mean different thing for different index classes. ## Vector Index Specifying `retriever_mode` has no effect (silently ignored). `vector_index.as_retriever(...)` always ret...
llama_index/docs/module_guides/querying/retriever/retriever_modes.md/0
{ "file_path": "llama_index/docs/module_guides/querying/retriever/retriever_modes.md", "repo_id": "llama_index", "token_count": 344 }
1,146
# coding=utf-8 # Copyright 2022 SHI Labs and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
transformers/src/transformers/models/oneformer/processing_oneformer.py/0
{ "file_path": "transformers/src/transformers/models/oneformer/processing_oneformer.py", "repo_id": "transformers", "token_count": 3741 }
709
# Brief introduction to RL documentation In this advanced topic, we address the question: **how should we monitor and keep track of powerful reinforcement learning agents that we are training in the real world and interfacing with humans?** As machine learning systems have increasingly impacted modern life, the **cal...
deep-rl-class/units/en/unitbonus3/rl-documentation.mdx/0
{ "file_path": "deep-rl-class/units/en/unitbonus3/rl-documentation.mdx", "repo_id": "deep-rl-class", "token_count": 886 }
166
from pathlib import Path import numpy as np import pytest from langchain_core.documents import Document from langchain_community.vectorstores.tiledb import TileDB from tests.integration_tests.vectorstores.fake_embeddings import ( ConsistentFakeEmbeddings, FakeEmbeddings, ) @pytest.mark.requires("tiledb-vect...
langchain/libs/community/tests/integration_tests/vectorstores/test_tiledb.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_tiledb.py", "repo_id": "langchain", "token_count": 5506 }
395
from typing import Any, Dict, Optional, Sequence from llama_index.legacy.core.base_selector import ( BaseSelector, SelectorResult, SingleSelection, ) from llama_index.legacy.embeddings.base import BaseEmbedding from llama_index.legacy.embeddings.utils import resolve_embed_model from llama_index.legacy.indi...
llama_index/llama-index-legacy/llama_index/legacy/selectors/embedding_selectors.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/selectors/embedding_selectors.py", "repo_id": "llama_index", "token_count": 1291 }
1,521
build_performance: collections: - milvus: db_config.primary_path: /test/milvus/db_data_011/sift_1m_128_128_l2_sq8 cache_config.cpu_cache_capacity: 32 engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: true ...
milvus/tests/benchmark/milvus_benchmark/suites/2_cpu_build.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/2_cpu_build.yaml", "repo_id": "milvus", "token_count": 342 }
2,003
<jupyter_start><jupyter_text>ModalThe [Modal cloud platform](https://modal.com/docs/guide) provides convenient, on-demand access to serverless cloud compute from Python scripts on your local computer. Use `modal` to run your own custom LLM models instead of depending on LLM APIs.This example goes over how to use LangCh...
langchain/docs/docs/integrations/llms/modal.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/modal.ipynb", "repo_id": "langchain", "token_count": 907 }
130
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-mangoapps-guides/llama_index/readers/mangoapps_guides/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mangoapps-guides/llama_index/readers/mangoapps_guides/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,378
# coding=utf-8 # Copyright 2021 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/tests/models/auto/test_feature_extraction_auto.py/0
{ "file_path": "transformers/tests/models/auto/test_feature_extraction_auto.py", "repo_id": "transformers", "token_count": 3275 }
718
# Arize-Phoenix LlamaPack This LlamaPack instruments your LlamaIndex app for LLM tracing with [Phoenix](https://github.com/Arize-ai/phoenix), an open-source LLM observability library from [Arize AI](https://phoenix.arize.com/). ## CLI Usage You can download llamapacks directly using `llamaindex-cli`, which comes ins...
llama_index/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/README.md/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/README.md", "repo_id": "llama_index", "token_count": 932 }
1,643
// 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/metastore/kv/datacoord/util.go/0
{ "file_path": "milvus/internal/metastore/kv/datacoord/util.go", "repo_id": "milvus", "token_count": 3886 }
1,720
# 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/pipelines/kandinsky/test_kandinsky.py/0
{ "file_path": "diffusers/tests/pipelines/kandinsky/test_kandinsky.py", "repo_id": "diffusers", "token_count": 4828 }
285
# Required Environment Variables: OPENAI_API_KEY from llama_index.core import SimpleDirectoryReader from llama_index.core.llama_pack import download_llama_pack # download and install dependencies DenseXRetrievalPack = download_llama_pack("DenseXRetrievalPack", "./dense_pack") # load documents documents = SimpleDirec...
llama_index/llama-index-packs/llama-index-packs-dense-x-retrieval/examples/example.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-dense-x-retrieval/examples/example.py", "repo_id": "llama_index", "token_count": 164 }
1,699
import { type BaseMessage } from "@langchain/core/messages"; import { BaseListChatMessageHistory } from "@langchain/core/chat_history"; /** * Class for storing chat message history in-memory. It extends the * BaseListChatMessageHistory class and provides methods to get, add, and * clear messages. */ export class C...
langchainjs/libs/langchain-community/src/stores/message/in_memory.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/stores/message/in_memory.ts", "repo_id": "langchainjs", "token_count": 380 }
966
import { QdrantVectorStore } from "@langchain/community/vectorstores/qdrant"; import { OpenAIEmbeddings } from "@langchain/openai"; const vectorStore = await QdrantVectorStore.fromExistingCollection( new OpenAIEmbeddings(), { url: process.env.QDRANT_URL, collectionName: "goldel_escher_bach", } ); const ...
langchainjs/examples/src/indexes/vector_stores/qdrant/fromExisting.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/qdrant/fromExisting.ts", "repo_id": "langchainjs", "token_count": 203 }
818
# Required Environment Variables: OPENAI_API_KEY, VOYAGE_API_KEY from pathlib import Path from llama_index.core.readers import download_loader from llama_index.core.llama_pack import download_llama_pack # download and install dependencies VoyageQueryEnginePack = download_llama_pack("VoyageQueryEnginePack", "./voyage_...
llama_index/llama-index-packs/llama-index-packs-voyage-query-engine/examples/example.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-voyage-query-engine/examples/example.py", "repo_id": "llama_index", "token_count": 213 }
1,739
--- hide_table_of_contents: true sidebar_position: 4 --- # Tabular Question Answering Lots of data and information is stored in tabular data, whether it be csvs, excel sheets, or SQL tables. This page covers all resources available in LangChain for working with data in this format. ## Chains If you are just getting...
langchainjs/docs/core_docs/docs/use_cases/tabular.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/use_cases/tabular.mdx", "repo_id": "langchainjs", "token_count": 242 }
757
import asyncio from typing import Any, Callable, List, Optional, Sequence from llama_index.legacy.async_utils import run_async_tasks from llama_index.legacy.prompts import BasePromptTemplate from llama_index.legacy.prompts.default_prompt_selectors import ( DEFAULT_TEXT_QA_PROMPT_SEL, ) from llama_index.legacy.prom...
llama_index/llama-index-legacy/llama_index/legacy/response_synthesizers/accumulate.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/response_synthesizers/accumulate.py", "repo_id": "llama_index", "token_count": 2336 }
1,599
--- sidebar_position: 1 --- # Chat Messages :::info Head to [Integrations](/docs/integrations/memory/) for documentation on built-in memory integrations with 3rd-party databases and tools. ::: One of the core utility classes underpinning most (if not all) memory modules is the `ChatMessageHistory` class. This is a su...
langchain/docs/docs/modules/memory/chat_messages/index.mdx/0
{ "file_path": "langchain/docs/docs/modules/memory/chat_messages/index.mdx", "repo_id": "langchain", "token_count": 266 }
208
# 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/prefix_tuning/model.py/0
{ "file_path": "peft/src/peft/tuners/prefix_tuning/model.py", "repo_id": "peft", "token_count": 1228 }
336
<jupyter_start><jupyter_text>Azure AI Search Basic ExampleIn this notebook, we take a Paul Graham essay, split it into chunks, embed it using an Azure OpenAI embedding model, load it into an Azure AI Search index, and then query it. If you're opening this Notebook on colab, you will probably need to install LlamaIndex...
llama_index/docs/examples/vector_stores/AzureAISearchIndexDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/AzureAISearchIndexDemo.ipynb", "repo_id": "llama_index", "token_count": 3855 }
1,133
from typing import Any, Callable, Dict, List from langchain_core.documents import Document from langchain_core.pydantic_v1 import BaseModel, root_validator from langchain_community.document_loaders.base import BaseLoader class ApifyDatasetLoader(BaseLoader, BaseModel): """Load datasets from `Apify` web scraping...
langchain/libs/community/langchain_community/document_loaders/apify_dataset.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/apify_dataset.py", "repo_id": "langchain", "token_count": 1118 }
230
# coding=utf-8 # Copyright 2020 The Google AI Language Team Authors and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICEN...
transformers/src/transformers/models/bert_generation/modeling_bert_generation.py/0
{ "file_path": "transformers/src/transformers/models/bert_generation/modeling_bert_generation.py", "repo_id": "transformers", "token_count": 20269 }
569
<jupyter_start><jupyter_text>---sidebar_position: 3title: QA with private data protection---<jupyter_code># QA with private data protection [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/langchain-ai/langchain/blob/master/docs/docs/guides/privacy/p...
langchain/docs/docs/guides/privacy/presidio_data_anonymization/qa_privacy_protection.ipynb/0
{ "file_path": "langchain/docs/docs/guides/privacy/presidio_data_anonymization/qa_privacy_protection.ipynb", "repo_id": "langchain", "token_count": 6193 }
90
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/tasks/audio_classification.md/0
{ "file_path": "transformers/docs/source/ja/tasks/audio_classification.md", "repo_id": "transformers", "token_count": 6120 }
548