text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from llama_index.core.readers.base import BasePydanticReader from llama_index.readers.twitter import TwitterTweetReader def test_class(): names_of_base_classes = [b.__name__ for b in TwitterTweetReader.__mro__] assert BasePydanticReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-twitter/tests/test_readers_twitter.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-twitter/tests/test_readers_twitter.py", "repo_id": "llama_index", "token_count": 93 }
1,439
<jupyter_start><jupyter_text>Amazon Product Extraction PackThis LlamaPack provides an example of our Amazon Product Extraction pack.<jupyter_code>import nest_asyncio nest_asyncio.apply() from llama_index.core.llama_pack import download_llama_pack AmazonProductExtractionPack = download_llama_pack( "AmazonProductEx...
llama_index/llama-index-packs/llama-index-packs-amazon-product-extraction/examples/product_extraction.ipynb/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-amazon-product-extraction/examples/product_extraction.ipynb", "repo_id": "llama_index", "token_count": 448 }
1,573
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/models/unets/unet_1d.py/0
{ "file_path": "diffusers/src/diffusers/models/unets/unet_1d.py", "repo_id": "diffusers", "token_count": 4858 }
238
from langchain_pinecone import __all__ EXPECTED_ALL = [ "Pinecone", ] def test_all_imports() -> None: assert sorted(EXPECTED_ALL) == sorted(__all__)
langchain/libs/partners/pinecone/tests/unit_tests/test_imports.py/0
{ "file_path": "langchain/libs/partners/pinecone/tests/unit_tests/test_imports.py", "repo_id": "langchain", "token_count": 64 }
697
"""Mock text splitter.""" from typing import Any, List, Optional def patch_token_splitter_newline( self: Any, text: str, metadata_str: Optional[str] = None ) -> List[str]: """Mock token splitter by newline.""" if text == "": return [] return text.split("\n") def mock_token_splitter_newline(...
llama_index/llama-index-core/tests/mock_utils/mock_text_splitter.py/0
{ "file_path": "llama_index/llama-index-core/tests/mock_utils/mock_text_splitter.py", "repo_id": "llama_index", "token_count": 191 }
1,225
"""General prompt helper that can help deal with LLM context window token limitations. At its core, it calculates available context size by starting with the context window size of an LLM and reserve token space for the prompt template, and the output. It provides utility for "repacking" text chunks (retrieved from i...
llama_index/llama-index-legacy/llama_index/legacy/indices/prompt_helper.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/prompt_helper.py", "repo_id": "llama_index", "token_count": 4533 }
1,720
# rag-chroma-multi-modal Multi-modal LLMs enable visual assistants that can perform question-answering about images. This template create a visual assistant for slide decks, which often contain visuals such as graphs or figures. It uses OpenCLIP embeddings to embed all of the slide images and stores them in Chroma...
langchain/templates/rag-chroma-multi-modal/README.md/0
{ "file_path": "langchain/templates/rag-chroma-multi-modal/README.md", "repo_id": "langchain", "token_count": 1261 }
675
<jupyter_start><jupyter_text>Refine If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-llms-openai !pip install llama-index<jupyter_output><empty_output><jupyter_text>Download Data<jupyter_code>!mkdir -p 'data/paul_graham/' !wget 'https://raw...
llama_index/docs/examples/response_synthesizers/refine.ipynb/0
{ "file_path": "llama_index/docs/examples/response_synthesizers/refine.ipynb", "repo_id": "llama_index", "token_count": 517 }
1,078
#!/usr/bin/env python # coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
transformers/examples/tensorflow/image-classification/run_image_classification.py/0
{ "file_path": "transformers/examples/tensorflow/image-classification/run_image_classification.py", "repo_id": "transformers", "token_count": 10735 }
541
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/tasks/zero_shot_object_detection.md/0
{ "file_path": "transformers/docs/source/en/tasks/zero_shot_object_detection.md", "repo_id": "transformers", "token_count": 3901 }
526
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,254
<jupyter_start><jupyter_text>OnDemandLoaderTool TutorialOur `OnDemandLoaderTool` is a powerful agent tool that allows for "on-demand" data querying from any data source on LlamaHub.This tool takes in a `BaseReader` data loader, and when called will 1) load data, 2) index data, and 3) query the data.In this walkthrough,...
llama_index/docs/examples/tools/OnDemandLoaderTool.ipynb/0
{ "file_path": "llama_index/docs/examples/tools/OnDemandLoaderTool.ipynb", "repo_id": "llama_index", "token_count": 1137 }
1,163
from llama_index.core.agent.react.base import ReActAgent from llama_index.core.agent.react.formatter import ReActChatFormatter from llama_index.core.agent.react.step import ReActAgentWorker __all__ = ["ReActChatFormatter", "ReActAgentWorker", "ReActAgent"]
llama_index/llama-index-core/llama_index/core/agent/react/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/agent/react/__init__.py", "repo_id": "llama_index", "token_count": 84 }
1,160
"""Test CallbackManager.""" from unittest.mock import patch import pytest from langchain_core.callbacks.manager import CallbackManager, trace_as_chain_group from langchain_core.outputs import LLMResult from langchain_core.tracers.langchain import LangChainTracer, wait_for_all_tracers from langchain_community.callback...
langchain/libs/community/tests/unit_tests/callbacks/test_callback_manager.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/callbacks/test_callback_manager.py", "repo_id": "langchain", "token_count": 2147 }
397
// 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/mq_msgstream.go/0
{ "file_path": "milvus/pkg/mq/msgstream/mq_msgstream.go", "repo_id": "milvus", "token_count": 11278 }
1,823
# coding=utf-8 # Copyright 2023 The Suno AI Authors and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/...
transformers/src/transformers/models/bark/modeling_bark.py/0
{ "file_path": "transformers/src/transformers/models/bark/modeling_bark.py", "repo_id": "transformers", "token_count": 37224 }
620
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-supabase/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-supabase/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,539
# Metric Card for Spearman Correlation Coefficient Metric (spearmanr) ## Metric Description The Spearman rank-order correlation coefficient is a measure of the relationship between two datasets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Positive correlation...
datasets/metrics/spearmanr/README.md/0
{ "file_path": "datasets/metrics/spearmanr/README.md", "repo_id": "datasets", "token_count": 1585 }
130
# flake8: noqa STRUCTURED_FORMAT_INSTRUCTIONS = """The output should be a markdown code snippet formatted in the following schema, including the leading and trailing "```json" and "```": ```json {{ {format} }} ```""" STRUCTURED_FORMAT_SIMPLE_INSTRUCTIONS = """ ```json {{ {format} }} ```""" PYDANTIC_FORMAT_INSTRUCT...
langchain/libs/langchain/langchain/output_parsers/format_instructions.py/0
{ "file_path": "langchain/libs/langchain/langchain/output_parsers/format_instructions.py", "repo_id": "langchain", "token_count": 1165 }
533
from abc import abstractmethod from typing import Any, Optional, Protocol, Sequence, runtime_checkable from langchain_core.callbacks import ( AsyncCallbackManagerForToolRun, CallbackManagerForToolRun, ) from langchain_core.pydantic_v1 import Field from langchain_core.tools import BaseTool from langchain_commu...
langchain/libs/community/langchain_community/tools/memorize/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/memorize/tool.py", "repo_id": "langchain", "token_count": 689 }
288
from __future__ import annotations import logging import os from abc import ABC, abstractmethod from typing import ( TYPE_CHECKING, Any, Dict, Generic, List, Optional, Tuple, Type, TypeVar, Union, ) from langchain.callbacks.manager import CallbackManagerForChainRun from langcha...
langchain/libs/experimental/langchain_experimental/rl_chain/base.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/rl_chain/base.py", "repo_id": "langchain", "token_count": 9221 }
424
package proxy import ( "context" "fmt" "reflect" "strings" "sync" "github.com/casbin/casbin/v2" "github.com/casbin/casbin/v2/model" "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com...
milvus/internal/proxy/privilege_interceptor.go/0
{ "file_path": "milvus/internal/proxy/privilege_interceptor.go", "repo_id": "milvus", "token_count": 2333 }
1,883
"""LangSmith langchain_client Integration Tests.""" import datetime import io import os import random import string import time from datetime import timedelta from typing import Any, Callable, Dict, cast from uuid import uuid4 import pytest from freezegun import freeze_time from langchain.schema import FunctionMessag...
langsmith-sdk/python/tests/integration_tests/test_client.py/0
{ "file_path": "langsmith-sdk/python/tests/integration_tests/test_client.py", "repo_id": "langsmith-sdk", "token_count": 8215 }
1,082
<jupyter_start><jupyter_text>Get References from PDFs This guide shows you how to use LlamaIndex to get in-line page number citations in the response (and the response is streamed).This is a simple combination of using the page number metadata in our PDF loader along with our indexing/query abstractions to use this inf...
llama_index/docs/examples/citation/pdf_page_reference.ipynb/0
{ "file_path": "llama_index/docs/examples/citation/pdf_page_reference.ipynb", "repo_id": "llama_index", "token_count": 1103 }
1,106
{ "modelname": "NewTFENCDEC", "uppercase_modelname": "NEW_TF_ENC_DEC", "lowercase_modelname": "new_tf_enc_dec_template", "camelcase_modelname": "NewTFEncDec", "authors": "The HuggingFace Team", "checkpoint_identifier": "new-tf-enc-dec-base_template", "tokenizer_type": "Based on BART", "generate_tensorfl...
transformers/templates/adding_a_new_model/tests/tf-seq-2-seq-bart-tokenizer.json/0
{ "file_path": "transformers/templates/adding_a_new_model/tests/tf-seq-2-seq-bart-tokenizer.json", "repo_id": "transformers", "token_count": 159 }
777
# coding=utf-8 # 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 requir...
transformers/tests/models/lilt/test_modeling_lilt.py/0
{ "file_path": "transformers/tests/models/lilt/test_modeling_lilt.py", "repo_id": "transformers", "token_count": 5376 }
821
"""Base query engine.""" import logging from abc import abstractmethod from typing import Any, Dict, List, Optional, Sequence from llama_index.legacy.bridge.pydantic import Field from llama_index.legacy.callbacks.base import CallbackManager from llama_index.legacy.core.query_pipeline.query_component import ( Chai...
llama_index/llama-index-legacy/llama_index/legacy/core/base_query_engine.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/core/base_query_engine.py", "repo_id": "llama_index", "token_count": 1651 }
1,645
// 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/exec/expression/Expr.h/0
{ "file_path": "milvus/internal/core/src/exec/expression/Expr.h", "repo_id": "milvus", "token_count": 6416 }
1,785
import os from langchain.retrievers import GoogleVertexAISearchRetriever from langchain_community.chat_models import ChatVertexAI from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from langchain_core.pydantic_v1 import BaseModel from langchain_core.runnable...
langchain/templates/rag-google-cloud-vertexai-search/rag_google_cloud_vertexai_search/chain.py/0
{ "file_path": "langchain/templates/rag-google-cloud-vertexai-search/rag_google_cloud_vertexai_search/chain.py", "repo_id": "langchain", "token_count": 481 }
692
{ "name": "@cfworker/json-schema", "type": "module", "version": "1.12.5", "description": "A JSON schema validator that will run on Cloudflare workers. Supports drafts 4, 7, 2019-09, and 2020-12.", "keywords": [ "json-schema", "jsonschema", "json", "schema", "cloudflare", "worker", ...
langchainjs/langchain-core/src/utils/@cfworker/json-schema/package.json/0
{ "file_path": "langchainjs/langchain-core/src/utils/@cfworker/json-schema/package.json", "repo_id": "langchainjs", "token_count": 606 }
884
<!--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/fast_tokenizers.md/0
{ "file_path": "transformers/docs/source/ja/fast_tokenizers.md", "repo_id": "transformers", "token_count": 1187 }
487
# Observability LlamaIndex provides **one-click observability** 🔭 to allow you to build principled LLM applications in a production setting. A key requirement for principled development of LLM applications over your data (RAG systems, agents) is being able to observe, debug, and evaluate your system - both as a whol...
llama_index/docs/module_guides/observability/observability.md/0
{ "file_path": "llama_index/docs/module_guides/observability/observability.md", "repo_id": "llama_index", "token_count": 3113 }
1,147
from langchain_community.llms.vllm import VLLM, VLLMOpenAI __all__ = ["VLLM", "VLLMOpenAI"]
langchain/libs/langchain/langchain/llms/vllm.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/vllm.py", "repo_id": "langchain", "token_count": 41 }
526
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_combined.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_combined.py", "repo_id": "diffusers", "token_count": 18700 }
244
from llama_index.readers.airbyte_salesforce.base import AirbyteSalesforceReader __all__ = ["AirbyteSalesforceReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-salesforce/llama_index/readers/airbyte_salesforce/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-salesforce/llama_index/readers/airbyte_salesforce/__init__.py", "repo_id": "llama_index", "token_count": 37 }
1,400
<jupyter_start><jupyter_text>Multivariate Probabilistic Time Series Forecasting with Informer IntroductionA few months ago we introduced the [Time Series Transformer](https://huggingface.co/blog/time-series-transformers), which is the vanilla Transformer ([Vaswani et al., 2017](https://arxiv.org/abs/1706.03762)) applie...
notebooks/examples/multivariate_informer.ipynb/0
{ "file_path": "notebooks/examples/multivariate_informer.ipynb", "repo_id": "notebooks", "token_count": 15125 }
323
from langchain_community.embeddings.huggingface import ( HuggingFaceBgeEmbeddings, HuggingFaceEmbeddings, HuggingFaceInferenceAPIEmbeddings, HuggingFaceInstructEmbeddings, ) __all__ = [ "HuggingFaceEmbeddings", "HuggingFaceInstructEmbeddings", "HuggingFaceBgeEmbeddings", "HuggingFaceInf...
langchain/libs/langchain/langchain/embeddings/huggingface.py/0
{ "file_path": "langchain/libs/langchain/langchain/embeddings/huggingface.py", "repo_id": "langchain", "token_count": 134 }
498
package typeutil import ( "fmt" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" ) func genEmptyBoolFieldData(field *schemapb.FieldSchema) *schemapb.FieldData { return &schemapb.FieldData{ Type: field.GetDataType(), FieldName: field.GetName(), Field: &schemapb.FieldData_Scalars{ Scalars: &sche...
milvus/pkg/util/typeutil/gen_empty_field_data.go/0
{ "file_path": "milvus/pkg/util/typeutil/gen_empty_field_data.go", "repo_id": "milvus", "token_count": 2896 }
1,853
export { RunnableAssign, RunnablePassthrough } from "@langchain/core/runnables";
langchainjs/langchain/src/schema/runnable/passthrough.ts/0
{ "file_path": "langchainjs/langchain/src/schema/runnable/passthrough.ts", "repo_id": "langchainjs", "token_count": 28 }
965
--- hide_table_of_contents: true --- import CodeBlock from "@theme/CodeBlock"; import Comparisons from "@examples/guides/evaluation/examples/comparisons.ts"; # Comparing Chain Outputs Suppose you have two different prompts (or LLMs). How do you know which will generate "better" results? One automated way to predict...
langchainjs/docs/core_docs/docs/guides/evaluation/examples/comparisons.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/guides/evaluation/examples/comparisons.mdx", "repo_id": "langchainjs", "token_count": 385 }
750
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/utils/test_offline.py/0
{ "file_path": "transformers/tests/utils/test_offline.py", "repo_id": "transformers", "token_count": 2916 }
763
<jupyter_start><jupyter_text>Timeouts for agentsThis notebook walks through how to cap an agent executor after a certain amount of time. This can be useful for safeguarding against long running agent runs.<jupyter_code>%pip install --upgrade --quiet wikipedia from langchain import hub from langchain.agents import Agen...
langchain/docs/docs/modules/agents/how_to/max_time_limit.ipynb/0
{ "file_path": "langchain/docs/docs/modules/agents/how_to/max_time_limit.ipynb", "repo_id": "langchain", "token_count": 1067 }
196
import { ChatPromptTemplate, HumanMessagePromptTemplate, MessagesPlaceholder, } from "@langchain/core/prompts"; import { ChatOpenAI } from "@langchain/openai"; import { createOpenAIToolsAgent, AgentExecutor } from "langchain/agents"; import { SqlToolkit } from "langchain/agents/toolkits/sql"; import { AIMessage }...
langchainjs/examples/src/use_cases/sql/agents/index.ts/0
{ "file_path": "langchainjs/examples/src/use_cases/sql/agents/index.ts", "repo_id": "langchainjs", "token_count": 1326 }
826
from transformers import AutoTokenizer, AutoModel import torch import torch.nn.functional as F # Helper: Mean Pooling - Take attention mask into account for correct averaging def mean_pooling(model_output, attention_mask): token_embeddings = model_output[0] #First element of model_output contains all token embedd...
notebooks/sagemaker/17_custom_inference_script/code/inference.py/0
{ "file_path": "notebooks/sagemaker/17_custom_inference_script/code/inference.py", "repo_id": "notebooks", "token_count": 487 }
288
# Scripts A train, validation, inference, and checkpoint cleaning script included in the github root folder. Scripts are not currently packaged in the pip release. The training and validation scripts evolved from early versions of the [PyTorch Imagenet Examples](https://github.com/pytorch/examples). I have added sign...
pytorch-image-models/hfdocs/source/training_script.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/training_script.mdx", "repo_id": "pytorch-image-models", "token_count": 2320 }
335
--- sidebar_class_name: node-only --- # Elasticsearch :::tip Compatibility Only available on Node.js. ::: [Elasticsearch](https://github.com/elastic/elasticsearch) is a distributed, RESTful search engine optimized for speed and relevance on production-scale workloads. It supports also vector search using the [k-near...
langchainjs/docs/core_docs/docs/integrations/vectorstores/elasticsearch.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/vectorstores/elasticsearch.mdx", "repo_id": "langchainjs", "token_count": 584 }
743
import asyncio from typing import Any, Dict, Tuple import pytest from llama_index.core.indices.struct_store.base import default_output_parser from llama_index.core.indices.struct_store.sql import SQLStructStoreIndex from llama_index.core.indices.struct_store.sql_query import ( NLSQLTableQueryEngine, NLStructSt...
llama_index/llama-index-core/tests/indices/struct_store/test_sql_query.py/0
{ "file_path": "llama_index/llama-index-core/tests/indices/struct_store/test_sql_query.py", "repo_id": "llama_index", "token_count": 2389 }
1,315
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querynodev2/pipeline/delete_node_test.go/0
{ "file_path": "milvus/internal/querynodev2/pipeline/delete_node_test.go", "repo_id": "milvus", "token_count": 1261 }
1,766
# coding=utf-8 # Copyright 2022 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/upernet/convert_swin_upernet_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/upernet/convert_swin_upernet_to_pytorch.py", "repo_id": "transformers", "token_count": 6234 }
689
<jupyter_start><jupyter_text>NVIDIA NeMo embeddings Connect to NVIDIA's embedding service using the `NeMoEmbeddings` class.The NeMo Retriever Embedding Microservice (NREM) brings the power of state-of-the-art text embedding to your applications, providing unmatched natural language processing and understanding capabili...
langchain/docs/docs/integrations/text_embedding/nemo.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/nemo.ipynb", "repo_id": "langchain", "token_count": 346 }
174
<jupyter_start><jupyter_text>Enum parserThis notebook shows how to use an Enum output parser.<jupyter_code>from langchain.output_parsers.enum import EnumOutputParser from enum import Enum class Colors(Enum): RED = "red" GREEN = "green" BLUE = "blue" parser = EnumOutputParser(enum=Colors) from langchain_co...
langchain/docs/docs/modules/model_io/output_parsers/types/enum.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/output_parsers/types/enum.ipynb", "repo_id": "langchain", "token_count": 231 }
205
from pathlib import Path from typing import Dict, List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document, ImageDocument class ImageTabularChartReader(BaseReader): """Image parser. Extract tabular data from a chart or figure. """ def __init_...
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image_deplot/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image_deplot/base.py", "repo_id": "llama_index", "token_count": 1472 }
1,437
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-cohere/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-cohere/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,357
from llama_index.readers.opendal.azblob.base import OpendalAzblobReader from llama_index.readers.opendal.base import OpendalReader from llama_index.readers.opendal.gcs.base import OpendalGcsReader from llama_index.readers.opendal.s3.base import OpendalS3Reader __all__ = [ "OpendalReader", "OpendalAzblobReader"...
llama_index/llama-index-integrations/readers/llama-index-readers-opendal/llama_index/readers/opendal/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-opendal/llama_index/readers/opendal/__init__.py", "repo_id": "llama_index", "token_count": 153 }
1,497
/* eslint-disable no-process-env */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { beforeAll, expect, test } from "@jest/globals"; import { Document } from "@langchain/core/documents"; import type { EmbeddingsInterface } from "@langchain/core/embeddings"; import { SyntheticEmbeddings } from "@la...
langchainjs/libs/langchain-community/src/vectorstores/tests/googlevertexai.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/googlevertexai.int.test.ts", "repo_id": "langchainjs", "token_count": 1918 }
1,019
--- sidebar_position: 0 sidebar_class_name: hidden --- # Stuff The stuff documents chain ("stuff" as in "to stuff" or "to fill") is the most straightforward of the document chains. It takes a list of documents, inserts them all into a prompt and passes that prompt to an LLM. This chain is well-suited for application...
langchainjs/docs/core_docs/docs/modules/chains/document/stuff.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/chains/document/stuff.mdx", "repo_id": "langchainjs", "token_count": 244 }
783
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-bitbucket/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-bitbucket/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,472
# 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_task_guides.py/0
{ "file_path": "transformers/utils/check_task_guides.py", "repo_id": "transformers", "token_count": 2721 }
845
--- hide_table_of_contents: true --- import CodeBlock from "@theme/CodeBlock"; # MongoDB Chat Memory For longer-term persistence across chat sessions, you can swap out the default in-memory `chatHistory` that backs chat memory classes like `BufferMemory` for a MongoDB instance. ## Setup You need to install Node Mo...
langchainjs/docs/core_docs/docs/integrations/chat_memory/mongodb.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/chat_memory/mongodb.mdx", "repo_id": "langchainjs", "token_count": 252 }
724
from langchain_community.graphs import Neo4jGraph graph = Neo4jGraph() # Import sample data graph.query( """ MERGE (m:Movie {name:"Top Gun"}) WITH m UNWIND ["Tom Cruise", "Val Kilmer", "Anthony Edwards", "Meg Ryan"] AS actor MERGE (a:Person {name:actor}) MERGE (a)-[:ACTED_IN]->(m) """ ) # Create full text index ...
langchain/templates/neo4j-cypher-ft/ingest.py/0
{ "file_path": "langchain/templates/neo4j-cypher-ft/ingest.py", "repo_id": "langchain", "token_count": 178 }
655
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/response_synthesizers/google/generativeai/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/response_synthesizers/google/generativeai/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,639
""" Implementation of a custom transfer agent for the transfer type "multipart" for git-lfs. Inspired by: github.com/cbartz/git-lfs-swift-transfer-agent/blob/master/git_lfs_swift_transfer.py Spec is: github.com/git-lfs/git-lfs/blob/master/docs/custom-transfers.md To launch debugger while developing: ``` [lfs "cust...
transformers/src/transformers/commands/lfs.py/0
{ "file_path": "transformers/src/transformers/commands/lfs.py", "repo_id": "transformers", "token_count": 3515 }
629
"""EverlyAI Endpoints chat wrapper. Relies heavily on ChatOpenAI.""" from __future__ import annotations import logging import sys from typing import TYPE_CHECKING, Dict, Optional, Set from langchain_core.messages import BaseMessage from langchain_core.pydantic_v1 import Field, root_validator from langchain_core.utils...
langchain/libs/community/langchain_community/chat_models/everlyai.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/everlyai.py", "repo_id": "langchain", "token_count": 2407 }
225
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/model_doc/biogpt.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/biogpt.md", "repo_id": "transformers", "token_count": 1982 }
514
--- sidebar_position: 2 --- # Prompting strategies In this guide we'll go over prompting strategies to improve SQL query generation. We'll largely focus on methods for getting relevant database-specific information in your prompt. ## Setup First, install the required packages and set your environment variables. Thi...
langchainjs/docs/core_docs/docs/use_cases/sql/prompting.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/use_cases/sql/prompting.mdx", "repo_id": "langchainjs", "token_count": 1108 }
825
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-telegram/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-telegram/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,425
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all. # Copyright 2022 The HuggingFace Team and The OpenBMB Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); ...
transformers/src/transformers/models/cpmant/__init__.py/0
{ "file_path": "transformers/src/transformers/models/cpmant/__init__.py", "repo_id": "transformers", "token_count": 776 }
595
<!--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/decision_transformer.md/0
{ "file_path": "transformers/docs/source/en/model_doc/decision_transformer.md", "repo_id": "transformers", "token_count": 639 }
487
import React from "react"; import HeaderEvaluator, { MenuItem } from "../../components/HeaderEvaluator"; import { UserCardImage } from "../../components/PersonCard"; import { Center, Group } from "@mantine/core"; const AboutPage = () => { return ( <> <HeaderEvaluator activeTab={MenuItem.About} /> <Ce...
auto-evaluator/nextjs/pages/about/index.tsx/0
{ "file_path": "auto-evaluator/nextjs/pages/about/index.tsx", "repo_id": "auto-evaluator", "token_count": 585 }
2
from langchain_community.vectorstores.docarray.hnsw import DocArrayHnswSearch __all__ = ["DocArrayHnswSearch"]
langchain/libs/langchain/langchain/vectorstores/docarray/hnsw.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/docarray/hnsw.py", "repo_id": "langchain", "token_count": 36 }
583
python_tests()
llama_index/llama-index-packs/llama-index-packs-nebulagraph-query-engine/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-nebulagraph-query-engine/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,662
<jupyter_start><jupyter_text>ChatGPT PluginsThis example shows how to use ChatGPT Plugins within LangChain abstractions.Note 1: This currently only works for plugins with no auth.Note 2: There are almost certainly other ways to do this, this is just a first pass. If you have better ideas, please open a PR!<jupyter_code...
langchain/docs/docs/integrations/tools/chatgpt_plugins.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/chatgpt_plugins.ipynb", "repo_id": "langchain", "token_count": 565 }
173
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/whisper/test_modeling_tf_whisper.py/0
{ "file_path": "transformers/tests/models/whisper/test_modeling_tf_whisper.py", "repo_id": "transformers", "token_count": 21571 }
780
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/tools/tool_spec/slack/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/tools/tool_spec/slack/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,526
from typing import ( TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Sequence, Type, cast, ) if TYPE_CHECKING: from marvin import ai_model from llama_index.core.bridge.pydantic import BaseModel, Field from llama_index.core.extractors.interface import BaseExtractor from llam...
llama_index/llama-index-integrations/extractors/llama-index-extractors-marvin/llama_index/extractors/marvin/base.py/0
{ "file_path": "llama_index/llama-index-integrations/extractors/llama-index-extractors-marvin/llama_index/extractors/marvin/base.py", "repo_id": "llama_index", "token_count": 1257 }
1,207
from typing import Tuple from langchain_core.output_parsers import BaseOutputParser from langchain_core.prompts import PromptTemplate class FinishedOutputParser(BaseOutputParser[Tuple[str, bool]]): """Output parser that checks if the output is finished.""" finished_value: str = "FINISHED" """Value that ...
langchain/libs/langchain/langchain/chains/flare/prompts.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/flare/prompts.py", "repo_id": "langchain", "token_count": 473 }
458
import unittest from langchain_community.document_loaders.parsers.language.python import PythonSegmenter class TestPythonSegmenter(unittest.TestCase): def setUp(self) -> None: self.example_code = """import os def hello(text): print(text) class Simple: def __init__(self): self.a = 1 hel...
langchain/libs/community/tests/unit_tests/document_loaders/parsers/language/test_python.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/parsers/language/test_python.py", "repo_id": "langchain", "token_count": 463 }
403
# coding=utf-8 # Copyright 2022 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/auto/image_processing_auto.py/0
{ "file_path": "transformers/src/transformers/models/auto/image_processing_auto.py", "repo_id": "transformers", "token_count": 8645 }
581
# flake8: noqa NASA_SEARCH_PROMPT = """ This tool is a wrapper around NASA's search API, useful when you need to search through NASA's Image and Video Library. The input to this tool is a query specified by the user, and will be passed into NASA's `search` function. At least one parameter must be prov...
langchain/libs/community/langchain_community/tools/nasa/prompt.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/nasa/prompt.py", "repo_id": "langchain", "token_count": 1626 }
309
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
peft/docs/source/package_reference/multitask_prompt_tuning.md/0
{ "file_path": "peft/docs/source/package_reference/multitask_prompt_tuning.md", "repo_id": "peft", "token_count": 533 }
324
import { Chroma } from "@langchain/community/vectorstores/chroma"; import { OpenAIEmbeddings } from "@langchain/openai"; import { TextLoader } from "langchain/document_loaders/fs/text"; // Create docs with a loader const loader = new TextLoader("src/document_loaders/example_data/example.txt"); const docs = await loade...
langchainjs/examples/src/indexes/vector_stores/chroma/fromDocs.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/chroma/fromDocs.ts", "repo_id": "langchainjs", "token_count": 320 }
800
# candle-datasets
candle/candle-datasets/README.md/0
{ "file_path": "candle/candle-datasets/README.md", "repo_id": "candle", "token_count": 7 }
33
import pytest from langchain.agents.openai_assistant import OpenAIAssistantRunnable @pytest.mark.requires("openai") def test_user_supplied_client() -> None: import openai client = openai.AzureOpenAI( azure_endpoint="azure_endpoint", api_key="api_key", api_version="api_version", )...
langchain/libs/langchain/tests/unit_tests/agents/test_openai_assistant.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/agents/test_openai_assistant.py", "repo_id": "langchain", "token_count": 190 }
621
import CodeBlock from "@theme/CodeBlock"; import Example from "@examples/tools/connery.ts"; import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; # Connery Action Tool Using this tool, you can integrate individual Connery Action into your LangChain agent. :::note If you want to use...
langchainjs/docs/core_docs/docs/integrations/tools/connery.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/tools/connery.mdx", "repo_id": "langchainjs", "token_count": 637 }
745
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/models/reformer/test_tokenization_reformer.py/0
{ "file_path": "transformers/tests/models/reformer/test_tokenization_reformer.py", "repo_id": "transformers", "token_count": 6375 }
765
import multiprocessing import numbers import random import numpy import threading import pytest import pandas as pd import decimal from decimal import Decimal, getcontext from time import sleep import heapq from base.client_base import TestcaseBase from utils.util_log import test_log as log from common import common_f...
milvus/tests/python_client/milvus_client/test_milvus_client_delete.py/0
{ "file_path": "milvus/tests/python_client/milvus_client/test_milvus_client_delete.py", "repo_id": "milvus", "token_count": 5560 }
2,040
// 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/mq/mqimpl/rocksmq/client/producer_impl_test.go/0
{ "file_path": "milvus/internal/mq/mqimpl/rocksmq/client/producer_impl_test.go", "repo_id": "milvus", "token_count": 429 }
1,732
import json import urllib.request from typing import List, Optional from langchain_core.documents import Document from langchain_core.utils import get_from_env, stringify_dict from langchain_community.document_loaders.base import BaseLoader IUGU_ENDPOINTS = { "invoices": "https://api.iugu.com/v1/invoices", "...
langchain/libs/community/langchain_community/document_loaders/iugu.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/iugu.py", "repo_id": "langchain", "token_count": 696 }
234
# Trubrics >[Trubrics](https://trubrics.com) is an LLM user analytics platform that lets you collect, analyse and manage user prompts & feedback on AI models. > >Check out [Trubrics repo](https://github.com/trubrics/trubrics-sdk) for more information on `Trubrics`. ## Installation and Setup We need to install the ...
langchain/docs/docs/integrations/providers/trubrics.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/trubrics.mdx", "repo_id": "langchain", "token_count": 168 }
159
import { PromptTemplate } from "@langchain/core/prompts"; const CYPHER_GENERATION_TEMPLATE = `Task:Generate Cypher statement to query a graph database. Instructions: Use only the provided relationship types and properties in the schema. Do not use any other relationship types or properties that are not provided. Schem...
langchainjs/langchain/src/chains/graph_qa/prompts.ts/0
{ "file_path": "langchainjs/langchain/src/chains/graph_qa/prompts.ts", "repo_id": "langchainjs", "token_count": 463 }
954
# for backwards compatibility from llama_index.core.base.base_query_engine import BaseQueryEngine __all__ = [ "BaseQueryEngine", ]
llama_index/llama-index-core/llama_index/core/indices/query/base.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/query/base.py", "repo_id": "llama_index", "token_count": 43 }
1,180
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #include "column_remap.cuh" #include "../util.cuh" const int SHUF_BLOCKSIZE_X = 256; const int SHUF_BLOCKSIZE_Y = 16; __global__ void column_remap_kernel ( const half* __restrict__ x, half* __restrict__ x_new, const int x_width, ...
text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/column_remap.cu/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/column_remap.cu", "repo_id": "text-generation-inference", "token_count": 696 }
396
use std::sync::{Arc, RwLock}; use pyo3::exceptions; use pyo3::prelude::*; use pyo3::types::*; use crate::error::ToPyResult; use crate::utils::{PyNormalizedString, PyNormalizedStringRefMut, PyPattern}; use serde::ser::SerializeStruct; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use tk::normalizers::...
tokenizers/bindings/python/src/normalizers.rs/0
{ "file_path": "tokenizers/bindings/python/src/normalizers.rs", "repo_id": "tokenizers", "token_count": 11191 }
461
import { AgentExecutor, createOpenAIToolsAgent } from "langchain/agents"; import { pull } from "langchain/hub"; import { ChatOpenAI } from "@langchain/openai"; import type { ChatPromptTemplate } from "@langchain/core/prompts"; import { TavilySearchResults } from "@langchain/community/tools/tavily_search"; import { Calc...
langchainjs/examples/src/guides/debugging/simple_agent.ts/0
{ "file_path": "langchainjs/examples/src/guides/debugging/simple_agent.ts", "repo_id": "langchainjs", "token_count": 231 }
776
<jupyter_start><jupyter_text>Facebook Chat>[Messenger](https://en.wikipedia.org/wiki/Messenger_(software)) is an American proprietary instant messaging app and platform developed by `Meta Platforms`. Originally developed as `Facebook Chat` in 2008, the company revamped its messaging service in 2010.This notebook covers...
langchain/docs/docs/integrations/document_loaders/facebook_chat.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/facebook_chat.ipynb", "repo_id": "langchain", "token_count": 177 }
102
"""GitHub Toolkit."""
langchain/libs/langchain/langchain/agents/agent_toolkits/github/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/github/__init__.py", "repo_id": "langchain", "token_count": 9 }
478
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-vllm/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-vllm/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,336
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/rag.md/0
{ "file_path": "transformers/docs/source/en/model_doc/rag.md", "repo_id": "transformers", "token_count": 1273 }
462
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-awadb/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-awadb/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,336
#include <metal_stdlib> using namespace metal; template<typename TYPENAME, typename INDEX_TYPENAME> METAL_FUNC void index( constant size_t &dst_size, constant size_t &left_size, constant size_t &src_dim_size, constant size_t &right_size, constant size_t &ids_size, const device TYPENAME *i...
candle/candle-metal-kernels/src/indexing.metal/0
{ "file_path": "candle/candle-metal-kernels/src/indexing.metal", "repo_id": "candle", "token_count": 3203 }
54