text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
<jupyter_start><jupyter_text>OpenAI 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>Basic Usage Call `complete` with a prompt<jupyter_code>from llama_index.ll...
llama_index/docs/examples/llm/openai.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/openai.ipynb", "repo_id": "llama_index", "token_count": 1585 }
1,145
<html> <main id="main-content"> Hello <span><em>World</em>!</span> </main> </html>
langchain/libs/community/tests/unit_tests/document_loaders/test_docs/readthedocs/nested_html_structure/test.html/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_docs/readthedocs/nested_html_structure/test.html", "repo_id": "langchain", "token_count": 41 }
401
import inspect import tempfile import unittest import numpy as np import transformers from transformers import CLIPConfig, CLIPTextConfig, CLIPVisionConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, slow from ...test_modeling_flax_common import ...
transformers/tests/models/clip/test_modeling_flax_clip.py/0
{ "file_path": "transformers/tests/models/clip/test_modeling_flax_clip.py", "repo_id": "transformers", "token_count": 11160 }
806
use crate::Result; use hf_hub::{api::sync::ApiBuilder, Repo, RepoType}; use std::collections::HashMap; use std::path::PathBuf; /// Defines the aditional parameters available for the `from_pretrained` function #[derive(Debug, Clone)] pub struct FromPretrainedParameters { pub revision: String, pub user_agent: Ha...
tokenizers/tokenizers/src/utils/from_pretrained.rs/0
{ "file_path": "tokenizers/tokenizers/src/utils/from_pretrained.rs", "repo_id": "tokenizers", "token_count": 913 }
436
<!--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/ko/perf_train_cpu.md/0
{ "file_path": "transformers/docs/source/ko/perf_train_cpu.md", "repo_id": "transformers", "token_count": 2391 }
505
from langchain_community.llms.predibase import Predibase __all__ = ["Predibase"]
langchain/libs/langchain/langchain/llms/predibase.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/predibase.py", "repo_id": "langchain", "token_count": 28 }
519
# Milvus >[Milvus](https://milvus.io/docs/overview.md) is a database that stores, indexes, and manages > massive embedding vectors generated by deep neural networks and other machine learning (ML) models. ## Installation and Setup Install the Python SDK: ```bash pip install pymilvus ``` ## Vector Store There exi...
langchain/docs/docs/integrations/providers/milvus.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/milvus.mdx", "repo_id": "langchain", "token_count": 188 }
149
# agent runner + agent worker from llama_index.legacy.agent.custom.pipeline_worker import QueryPipelineAgentWorker from llama_index.legacy.agent.custom.simple import CustomSimpleAgentWorker from llama_index.legacy.agent.legacy.context_retriever_agent import ( ContextRetrieverOpenAIAgent, ) from llama_index.legacy.a...
llama_index/llama-index-legacy/llama_index/legacy/agent/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/agent/__init__.py", "repo_id": "llama_index", "token_count": 683 }
1,503
import json import logging from typing import Any, AsyncIterator, Dict, List, Optional, cast import requests from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_models.chat_models import BaseChatModel from langchain_core.messages import...
langchain/libs/community/langchain_community/chat_models/pai_eas_endpoint.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/pai_eas_endpoint.py", "repo_id": "langchain", "token_count": 4696 }
240
<jupyter_start><jupyter_text>If you're opening this Notebook on colab, you will probably need to install ๐Ÿค— Transformers and ๐Ÿค— Datasets. Uncomment the following cell and run it. We also use the `sacrebleu` and `sentencepiece` libraries - you may need to install these even if you already have ๐Ÿค— Transformers!<jupyter_c...
notebooks/examples/translation-tf.ipynb/0
{ "file_path": "notebooks/examples/translation-tf.ipynb", "repo_id": "notebooks", "token_count": 8046 }
298
# coding=utf-8 # Copyright 2020 The Allen Institute for AI team 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...
transformers/src/transformers/models/longformer/modeling_longformer.py/0
{ "file_path": "transformers/src/transformers/models/longformer/modeling_longformer.py", "repo_id": "transformers", "token_count": 47033 }
637
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/pipelines/test_pipelines_image_to_text.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_image_to_text.py", "repo_id": "transformers", "token_count": 4579 }
839
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "base_language", newEntrypointName: "language_models/base", newPackageName: "@langchain/core", }); export { type SerializedLLM, type BaseLangChainParams, Ba...
langchainjs/langchain/src/base_language/index.ts/0
{ "file_path": "langchainjs/langchain/src/base_language/index.ts", "repo_id": "langchainjs", "token_count": 253 }
886
# ๐Ÿค— Transformers doc notebooks These notebooks are automatically generated from the [๐Ÿค— Transformers documentation](https://huggingface.co/transformers/) so you should not make any direct modification here. If there is a typo to fix or a sentence to add, open a pull request in the [๐Ÿค— Transformers repo](https://githu...
notebooks/transformers_doc/README.md/0
{ "file_path": "notebooks/transformers_doc/README.md", "repo_id": "notebooks", "token_count": 169 }
311
// 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/index/IndexStructure.h/0
{ "file_path": "milvus/internal/core/src/index/IndexStructure.h", "repo_id": "milvus", "token_count": 545 }
1,753
import os from langchain_community.graphs import MemgraphGraph def test_cypher_return_correct_schema() -> None: """Test that chain returns direct results.""" url = os.environ.get("MEMGRAPH_URI", "bolt://localhost:7687") username = os.environ.get("MEMGRAPH_USERNAME", "") password = os.environ.get("MEM...
langchain/libs/community/tests/integration_tests/graphs/test_memgraph.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/graphs/test_memgraph.py", "repo_id": "langchain", "token_count": 826 }
352
import { Client, RequestParams, errors } from "@opensearch-project/opensearch"; import * as uuid from "uuid"; import type { EmbeddingsInterface } from "@langchain/core/embeddings"; import { VectorStore } from "@langchain/core/vectorstores"; import { Document } from "@langchain/core/documents"; type OpenSearchEngine = ...
langchainjs/libs/langchain-community/src/vectorstores/opensearch.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/opensearch.ts", "repo_id": "langchainjs", "token_count": 5294 }
967
# coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers/scripts/convert_original_controlnet_to_diffusers.py/0
{ "file_path": "diffusers/scripts/convert_original_controlnet_to_diffusers.py", "repo_id": "diffusers", "token_count": 1608 }
232
# Shale Protocol [Shale Protocol](https://shaleprotocol.com) provides production-ready inference APIs for open LLMs. It's a Plug & Play API as it's hosted on a highly scalable GPU cloud infrastructure. Our free tier supports up to 1K daily requests per key as we want to eliminate the barrier for anyone to start buil...
langchain/docs/docs/integrations/providers/shaleprotocol.md/0
{ "file_path": "langchain/docs/docs/integrations/providers/shaleprotocol.md", "repo_id": "langchain", "token_count": 461 }
145
"""Vector DB tool spec.""" from typing import List from llama_index.core.indices.base import BaseIndex from llama_index.core.query_engine import RetrieverQueryEngine from llama_index.core.retrievers import VectorIndexRetriever from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.core.vector...
llama_index/llama-index-integrations/tools/llama-index-tools-vector-db/llama_index/tools/vector_db/base.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-vector-db/llama_index/tools/vector_db/base.py", "repo_id": "llama_index", "token_count": 720 }
1,636
python_sources()
llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-postgres/llama_index/storage/docstore/postgres/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-postgres/llama_index/storage/docstore/postgres/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,403
<jupyter_start><jupyter_text>AimAim makes it super easy to visualize and debug LangChain executions. Aim tracks inputs and outputs of LLMs and tools, as well as actions of agents. With Aim, you can easily debug and examine an individual execution:Additionally, you have the option to compare multiple executions side by ...
langchain/docs/docs/integrations/providers/aim_tracking.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/providers/aim_tracking.ipynb", "repo_id": "langchain", "token_count": 1612 }
139
# 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 required by appl...
transformers/src/transformers/models/pop2piano/convert_pop2piano_weights_to_hf.py/0
{ "file_path": "transformers/src/transformers/models/pop2piano/convert_pop2piano_weights_to_hf.py", "repo_id": "transformers", "token_count": 3446 }
718
from llama_index.core.readers.base import BaseReader from llama_index.readers.nougat_ocr import PDFNougatOCR def test_class(): names_of_base_classes = [b.__name__ for b in PDFNougatOCR.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-nougat-ocr/tests/test_readers_nougat_ocr.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-nougat-ocr/tests/test_readers_nougat_ocr.py", "repo_id": "llama_index", "token_count": 97 }
1,349
<jupyter_start><jupyter_text>IBM watsonx.ai>[WatsonxLLM](https://ibm.github.io/watsonx-ai-python-sdk/fm_extensions.htmllangchain) is a wrapper for IBM [watsonx.ai](https://www.ibm.com/products/watsonx-ai) foundation models.This example shows how to communicate with `watsonx.ai` models using `LangChain`. Setting upInst...
langchain/docs/docs/integrations/llms/ibm_watsonx.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/ibm_watsonx.ipynb", "repo_id": "langchain", "token_count": 1588 }
119
# Dealing with API Errors If the model provider returns an error from their API, by default LangChain will retry up to 6 times on an exponential backoff. This enables error recovery without any additional effort from you. If you want to change this behavior, you can pass a `maxRetries` option when you instantiate the ...
langchainjs/docs/core_docs/docs/modules/model_io/chat/dealing_with_api_errors.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/chat/dealing_with_api_errors.mdx", "repo_id": "langchainjs", "token_count": 180 }
767
import { test, expect } from "@jest/globals"; import { TransformChain } from "../transform.js"; test("TransformChain", async () => { const chain = new TransformChain({ transform: async (values: { a: number; b: number }) => ({ c: values.a + values.b, }), inputVariables: ["a", "b"], outputVariabl...
langchainjs/langchain/src/chains/tests/transform.test.ts/0
{ "file_path": "langchainjs/langchain/src/chains/tests/transform.test.ts", "repo_id": "langchainjs", "token_count": 151 }
963
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querycoordv2/dist/dist_controller_test.go/0
{ "file_path": "milvus/internal/querycoordv2/dist/dist_controller_test.go", "repo_id": "milvus", "token_count": 2036 }
1,758
<jupyter_start><jupyter_text>Pebblo Safe DocumentLoader> [Pebblo](https://github.com/daxa-ai/pebblo) enables developers to safely load data and promote their Gen AI app to deployment without worrying about the organizationโ€™s compliance and security requirements. The project identifies semantic topics and entities found...
langchain/docs/docs/integrations/document_loaders/pebblo.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/pebblo.ipynb", "repo_id": "langchain", "token_count": 541 }
108
<jupyter_start><jupyter_text>Adding memoryThis shows how to add memory to an arbitrary chain. Right now, you can use the memory classes but need to hook it up manually<jupyter_code>%pip install --upgrade --quiet langchain langchain-openai from operator import itemgetter from langchain.memory import ConversationBuffer...
langchain/docs/docs/expression_language/cookbook/memory.ipynb/0
{ "file_path": "langchain/docs/docs/expression_language/cookbook/memory.ipynb", "repo_id": "langchain", "token_count": 413 }
83
python_tests( name="tests", skip_tests=True, ) python_sources()
llama_index/llama-index-legacy/tests/tools/tool_spec/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/tools/tool_spec/BUILD", "repo_id": "llama_index", "token_count": 32 }
1,683
# ๐Ÿฆœ๏ธ๐ŸŒ WebLangChain This repo is an example of performing retrieval using the entire internet as a document store. **Try it live:** [weblangchain.vercel.app](https://weblangchain.vercel.app) ## โœ… Running locally By default, WebLangChain uses [Tavily](https://tavily.com) to fetch content from webpages. You can get ...
weblangchain/README.md/0
{ "file_path": "weblangchain/README.md", "repo_id": "weblangchain", "token_count": 1294 }
2,063
import { BaseStringPromptTemplate } from "./string.js"; import type { BasePromptTemplateInput, TypedPromptInputValues, Example, } from "./base.js"; import type { BaseExampleSelector } from "../example_selectors/base.js"; import { type TemplateFormat, checkValidTemplate, renderTemplate, } from "./template.js...
langchainjs/langchain-core/src/prompts/few_shot.ts/0
{ "file_path": "langchainjs/langchain-core/src/prompts/few_shot.ts", "repo_id": "langchainjs", "token_count": 4793 }
855
use super::gym_env::{GymEnv, Step}; use candle::{DType, Device, Error, Module, Result, Tensor}; use candle_nn::{ linear, ops::log_softmax, ops::softmax, sequential::seq, Activation, AdamW, Optimizer, ParamsAdamW, VarBuilder, VarMap, }; use rand::{distributions::Distribution, rngs::ThreadRng, Rng}; fn new_model...
candle/candle-examples/examples/reinforcement-learning/policy_gradient.rs/0
{ "file_path": "candle/candle-examples/examples/reinforcement-learning/policy_gradient.rs", "repo_id": "candle", "token_count": 2333 }
46
from typing import List from langchain_community.document_loaders.unstructured import ( UnstructuredFileLoader, satisfies_min_unstructured_version, ) class UnstructuredEPubLoader(UnstructuredFileLoader): """Load `EPub` files using `Unstructured`. You can run the loader in one of two modes: "single" ...
langchain/libs/community/langchain_community/document_loaders/epub.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/epub.py", "repo_id": "langchain", "token_count": 534 }
236
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-weaviate/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-weaviate/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,388
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-maps/llama_index/readers/maps/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-maps/llama_index/readers/maps/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,423
from typing import Dict import pytest from pytest_mock import MockerFixture from langchain_community.llms import GradientLLM _MODEL_ID = "my_model_valid_id" _GRADIENT_SECRET = "secret_valid_token_123456" _GRADIENT_WORKSPACE_ID = "valid_workspace_12345" _GRADIENT_BASE_URL = "https://api.gradient.ai/api" class MockR...
langchain/libs/community/tests/unit_tests/llms/test_gradient_ai.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/llms/test_gradient_ai.py", "repo_id": "langchain", "token_count": 1308 }
377
from rag_gemini_multi_modal.chain import chain __all__ = ["chain"]
langchain/templates/rag-gemini-multi-modal/rag_gemini_multi_modal/__init__.py/0
{ "file_path": "langchain/templates/rag-gemini-multi-modal/rag_gemini_multi_modal/__init__.py", "repo_id": "langchain", "token_count": 24 }
696
// Code generated by mockery v2.32.4. DO NOT EDIT. package cluster import ( context "context" mock "github.com/stretchr/testify/mock" ) // MockManager is an autogenerated mock type for the Manager type type MockManager struct { mock.Mock } type MockManager_Expecter struct { mock *mock.Mock } func (_m *MockMan...
milvus/internal/querynodev2/cluster/mock_manager.go/0
{ "file_path": "milvus/internal/querynodev2/cluster/mock_manager.go", "repo_id": "milvus", "token_count": 944 }
2,039
from typing import Optional from langchain_core.pydantic_v1 import Field from langchain_core.runnables import RunnableConfig from langchain_core.runnables.utils import ConfigurableFieldSpec from langgraph.checkpoint.base import BaseCheckpointSaver, Checkpoint class MemorySaver(BaseCheckpointSaver): storage: dic...
langgraph/langgraph/checkpoint/memory.py/0
{ "file_path": "langgraph/langgraph/checkpoint/memory.py", "repo_id": "langgraph", "token_count": 410 }
1,033
from llama_index.core.vector_stores.types import BasePydanticVectorStore from llama_index.vector_stores.deeplake import DeepLakeVectorStore def test_class(): names_of_base_classes = [b.__name__ for b in DeepLakeVectorStore.__mro__] assert BasePydanticVectorStore.__name__ in names_of_base_classes
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-deeplake/tests/test_vector_stores_deeplake.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-deeplake/tests/test_vector_stores_deeplake.py", "repo_id": "llama_index", "token_count": 102 }
1,601
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-firestore/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-firestore/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,598
<jupyter_start><jupyter_text>Quantizing a model with ONNX Runtime for text classification tasks This notebook shows how to apply different post-training quantization approaches such as static and dynamic quantization using [ONNX Runtime](https://onnxruntime.ai), for any tasks of the GLUE benchmark. This is made possibl...
notebooks/examples/text_classification_quantization_ort.ipynb/0
{ "file_path": "notebooks/examples/text_classification_quantization_ort.ipynb", "repo_id": "notebooks", "token_count": 4607 }
326
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,531
import base64 import logging from typing import List, Sequence import requests from llama_index.legacy.schema import ImageDocument logger = logging.getLogger(__name__) def load_image_urls(image_urls: List[str]) -> List[ImageDocument]: # load remote image urls into image documents image_documents = [] f...
llama_index/llama-index-legacy/llama_index/legacy/multi_modal_llms/generic_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/multi_modal_llms/generic_utils.py", "repo_id": "llama_index", "token_count": 728 }
1,686
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datacoord/channel_manager_test.go/0
{ "file_path": "milvus/internal/datacoord/channel_manager_test.go", "repo_id": "milvus", "token_count": 16803 }
1,762
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/agent/react_multimodal/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/agent/react_multimodal/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,578
<jupyter_start><jupyter_text>Parallel Processing SimpleDirectoryReader In this notebook, we demonstrate how to use parallel processing when loading data with `SimpleDirectoryReader`. Parallel processing can be useful with heavier workloads i.e., loading from a directory consisting of many files. (NOTE: if using Windows...
llama_index/docs/examples/data_connectors/simple_directory_reader_parallel.ipynb/0
{ "file_path": "llama_index/docs/examples/data_connectors/simple_directory_reader_parallel.ipynb", "repo_id": "llama_index", "token_count": 1675 }
1,178
--- sidebar_position: 2 --- # Caching LangChain provides an optional caching layer for LLMs. This is useful for two reasons: It can save you money by reducing the number of API calls you make to the LLM provider, if you're often requesting the same completion multiple times. It can speed up your application by reduc...
langchainjs/docs/core_docs/docs/modules/model_io/llms/llm_caching.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/llms/llm_caching.mdx", "repo_id": "langchainjs", "token_count": 2016 }
769
# Agents ## Concept Data Agents are LLM-powered knowledge workers in LlamaIndex that can intelligently perform various tasks over your data, in both a โ€œreadโ€ and โ€œwriteโ€ function. They are capable of the following: - Perform automated search and retrieval over different types of data - unstructured, semi-structured,...
llama_index/docs/module_guides/deploying/agents/root.md/0
{ "file_path": "llama_index/docs/module_guides/deploying/agents/root.md", "repo_id": "llama_index", "token_count": 906 }
1,097
from langchain_community.tools.searx_search.tool import ( SearxSearchResults, SearxSearchRun, ) __all__ = ["SearxSearchRun", "SearxSearchResults"]
langchain/libs/langchain/langchain/tools/searx_search/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/searx_search/tool.py", "repo_id": "langchain", "token_count": 58 }
610
""" MobileNet V3 A PyTorch impl of MobileNet-V3, compatible with TF weights from official impl. Paper: Searching for MobileNetV3 - https://arxiv.org/abs/1905.02244 Hacked together by / Copyright 2019, Ross Wightman """ from functools import partial from typing import Callable, List, Optional, Tuple import torch imp...
pytorch-image-models/timm/models/mobilenetv3.py/0
{ "file_path": "pytorch-image-models/timm/models/mobilenetv3.py", "repo_id": "pytorch-image-models", "token_count": 17103 }
404
"""Get evaluation utils. NOTE: These are beta functions, might change. """ import asyncio import os import subprocess import tempfile from collections import defaultdict from typing import Any, List, Optional, Tuple import numpy as np import pandas as pd from llama_index_client import ProjectCreate from llama_inde...
llama_index/llama-index-core/llama_index/core/evaluation/eval_utils.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/evaluation/eval_utils.py", "repo_id": "llama_index", "token_count": 2457 }
1,255
python_sources()
llama_index/llama-index-packs/llama-index-packs-gradio-react-agent-chatbot/llama_index/packs/gradio_react_agent_chatbot/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-gradio-react-agent-chatbot/llama_index/packs/gradio_react_agent_chatbot/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,706
from langchain_community.vectorstores.starrocks import ( StarRocks, StarRocksSettings, ) __all__ = [ "StarRocksSettings", "StarRocks", ]
langchain/libs/langchain/langchain/vectorstores/starrocks.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/starrocks.py", "repo_id": "langchain", "token_count": 62 }
631
from llama_index.core.llms.base import BaseLLM from llama_index.llms.everlyai import EverlyAI def test_embedding_class(): names_of_base_classes = [b.__name__ for b in EverlyAI.__mro__] assert BaseLLM.__name__ in names_of_base_classes
llama_index/llama-index-integrations/llms/llama-index-llms-everlyai/tests/test_llms_everlyai.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-everlyai/tests/test_llms_everlyai.py", "repo_id": "llama_index", "token_count": 94 }
1,351
// Variables are wrappers around tensors that can be modified, they are typically used for holding // weights and being modified by gradient descent. // We do not expose a public way to create variables as this would break the invariant that the // tensor within a variable is actually with `is_variable` set to `true`. ...
candle/candle-core/src/variable.rs/0
{ "file_path": "candle/candle-core/src/variable.rs", "repo_id": "candle", "token_count": 2057 }
39
import { expect, test } from "@jest/globals"; import chroma from "./initClient"; import { IncludeEnum } from "../src/types"; import { IDS, DOCUMENTS, EMBEDDINGS, METADATAS } from "./data"; test("it should get embedding with matching documents", async () => { await chroma.reset(); const collection = await chroma.cr...
chroma/clients/js/test/update.collection.test.ts/0
{ "file_path": "chroma/clients/js/test/update.collection.test.ts", "repo_id": "chroma", "token_count": 853 }
38
from langchain_core.documents import Document from langchain_community.vectorstores import Bagel from tests.integration_tests.vectorstores.fake_embeddings import ( FakeEmbeddings, ) def test_similarity_search() -> None: """Test similarity search""" from bagel.config import Settings setting = Setting...
langchain/libs/community/tests/integration_tests/vectorstores/test_bagel.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_bagel.py", "repo_id": "langchain", "token_count": 2395 }
374
# coding=utf-8 # Copyright 2022 SenseTime and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
transformers/src/transformers/models/deformable_detr/modeling_deformable_detr.py/0
{ "file_path": "transformers/src/transformers/models/deformable_detr/modeling_deformable_detr.py", "repo_id": "transformers", "token_count": 51434 }
629
from llama_index.readers.mangoapps_guides.base import MangoppsGuidesReader __all__ = ["MangoppsGuidesReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-mangoapps-guides/llama_index/readers/mangoapps_guides/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mangoapps-guides/llama_index/readers/mangoapps_guides/__init__.py", "repo_id": "llama_index", "token_count": 40 }
1,403
<jupyter_start><jupyter_text>JSON Query EngineThe JSON query engine is useful for querying JSON documents that conform to a JSON schema.This JSON schema is then used in the context of a prompt to convert a natural language query into a structured JSON Path query. This JSON Path query is then used to retrieve data to an...
llama_index/docs/examples/query_engine/json_query_engine.ipynb/0
{ "file_path": "llama_index/docs/examples/query_engine/json_query_engine.ipynb", "repo_id": "llama_index", "token_count": 2604 }
1,127
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-ionic-shopping/llama_index/tools/ionic_shopping/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-ionic-shopping/llama_index/tools/ionic_shopping/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,515
# Bonus: Learn to create your own environments with Unity and MLAgents **You can create your own reinforcement learning environments with Unity and MLAgents**. Using a game engine such as Unity can be intimidating at first, but here are the steps you can take to learn smoothly. ## Step 1: Know how to use Unity - The...
deep-rl-class/units/en/unit5/bonus.mdx/0
{ "file_path": "deep-rl-class/units/en/unit5/bonus.mdx", "repo_id": "deep-rl-class", "token_count": 360 }
171
--- hide_table_of_contents: true --- import CodeBlock from "@theme/CodeBlock"; # Gmail Tool The Gmail Tool allows your agent to create and view messages from a linked email account. ## Setup You will need to get an API key from [Google here](https://developers.google.com/gmail/api/guides) and [enable the new Gmail...
langchainjs/docs/core_docs/docs/integrations/tools/gmail.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/tools/gmail.mdx", "repo_id": "langchainjs", "token_count": 286 }
739
# The builder image, used to build the virtual environment FROM python:3.11-buster as builder RUN apt-get update && apt-get install -y git RUN pip install poetry==1.4.2 ENV POETRY_NO_INTERACTION=1 \ POETRY_VIRTUALENVS_IN_PROJECT=1 \ POETRY_VIRTUALENVS_CREATE=1 \ POETRY_CACHE_DIR=/tmp/poetry_cache # A di...
streamlit-agent/Dockerfile/0
{ "file_path": "streamlit-agent/Dockerfile", "repo_id": "streamlit-agent", "token_count": 325 }
2,001
// 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/tests/integration/refreshconfig/refresh_config_test.go/0
{ "file_path": "milvus/tests/integration/refreshconfig/refresh_config_test.go", "repo_id": "milvus", "token_count": 1918 }
1,879
""" Test Time Pooling (Average-Max Pool) Hacked together by / Copyright 2020 Ross Wightman """ import logging from torch import nn import torch.nn.functional as F from .adaptive_avgmax_pool import adaptive_avgmax_pool2d _logger = logging.getLogger(__name__) class TestTimePoolHead(nn.Module): def __init__(sel...
pytorch-image-models/timm/layers/test_time_pool.py/0
{ "file_path": "pytorch-image-models/timm/layers/test_time_pool.py", "repo_id": "pytorch-image-models", "token_count": 881 }
379
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-docugami/llama_index/readers/docugami/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-docugami/llama_index/readers/docugami/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,484
<jupyter_start><jupyter_text>Rerank can speed up an LLM query without sacrificing accuracy (and in fact, probably improving it). It does so by pruning away irrelevant nodes from the context. If you're opening this Notebook on colab, you will probably need to install LlamaIndex ๐Ÿฆ™.<jupyter_code>%pip install llama-index-...
llama_index/docs/examples/node_postprocessor/SentenceTransformerRerank.ipynb/0
{ "file_path": "llama_index/docs/examples/node_postprocessor/SentenceTransformerRerank.ipynb", "repo_id": "llama_index", "token_count": 1336 }
1,153
eetq_commit := 71adb5e191bb8290069a580abff0355d7b2dd5c9 eetq: # Clone eetq pip install packaging git clone https://github.com/NetEase-FuXi/EETQ.git eetq build-eetq: eetq cd eetq && git fetch && git checkout $(eetq_commit) && git submodule update --init --recursive cd eetq && python setup.py build install-eet...
text-generation-inference/server/Makefile-eetq/0
{ "file_path": "text-generation-inference/server/Makefile-eetq", "repo_id": "text-generation-inference", "token_count": 155 }
432
from llama_index.packs.agent_search_retriever.base import ( AgentSearchRetriever, AgentSearchRetrieverPack, ) __all__ = ["AgentSearchRetriever", "AgentSearchRetrieverPack"]
llama_index/llama-index-packs/llama-index-packs-agent-search-retriever/llama_index/packs/agent_search_retriever/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-agent-search-retriever/llama_index/packs/agent_search_retriever/__init__.py", "repo_id": "llama_index", "token_count": 64 }
1,641
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,399
<jupyter_start><jupyter_code>! pip install --quiet langchain_community tiktoken langchain-openai langchainhub chromadb langchain langgraph tavily-python langchain-mistralai gpt4all<jupyter_output><empty_output><jupyter_text>Corrective RAGSelf-reflection can enhance RAG, enabling correction of poor quality retrieval or ...
langgraph/examples/rag/langgraph_crag_mistral.ipynb/0
{ "file_path": "langgraph/examples/rag/langgraph_crag_mistral.ipynb", "repo_id": "langgraph", "token_count": 5856 }
990
const getTimezoneOffsetInHours = () => { const offsetInMinutes = new Date().getTimezoneOffset(); const offsetInHours = -offsetInMinutes / 60; return offsetInHours; }; export { getTimezoneOffsetInHours };
langchainjs/libs/langchain-community/src/tools/google_calendar/utils/get-timezone-offset-in-hours.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/google_calendar/utils/get-timezone-offset-in-hours.ts", "repo_id": "langchainjs", "token_count": 63 }
1,041
# Flyte > [Flyte](https://github.com/flyteorg/flyte) is an open-source orchestrator that facilitates building production-grade data and ML pipelines. > It is built for scalability and reproducibility, leveraging Kubernetes as its underlying platform. The purpose of this notebook is to demonstrate the integration of a...
langchain/docs/docs/integrations/providers/flyte.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/flyte.mdx", "repo_id": "langchain", "token_count": 2018 }
133
# Copyright 2024 TencentARC and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
diffusers/src/diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_adapter.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_adapter.py", "repo_id": "diffusers", "token_count": 20708 }
253
#!/usr/bin/env python3 # coding=utf-8 # 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 #...
peft/tests/test_poly.py/0
{ "file_path": "peft/tests/test_poly.py", "repo_id": "peft", "token_count": 1541 }
352
"""Fake Chat Model wrapper for testing purposes.""" import asyncio import re import time from typing import Any, AsyncIterator, Dict, Iterator, List, Optional, Union, cast from langchain_core.callbacks.manager import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_mode...
langchain/libs/core/tests/unit_tests/fake/chat_model.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/fake/chat_model.py", "repo_id": "langchain", "token_count": 5455 }
405
import json import logging from typing import Any, List, Optional, Union from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models.llms import LLM from langchain_core.messages import ( AIMessage, BaseMessage, FunctionMessage, HumanMessage, SystemMessage, ) fr...
langchain/libs/community/langchain_community/llms/chatglm3.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/chatglm3.py", "repo_id": "langchain", "token_count": 2101 }
285
# flake8: noqa PREFIX = """Assistant is a large language model trained by OpenAI. Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human...
langchain/libs/langchain/langchain/agents/conversational_chat/prompt.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/conversational_chat/prompt.py", "repo_id": "langchain", "token_count": 668 }
451
from llama_index.core.readers.base import BaseReader from llama_index.readers.joplin import JoplinReader def test_class(): names_of_base_classes = [b.__name__ for b in JoplinReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-joplin/tests/test_readers_joplin.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-joplin/tests/test_readers_joplin.py", "repo_id": "llama_index", "token_count": 91 }
1,417
# LlamaIndex Llms Integration: Llama Api
llama_index/llama-index-integrations/llms/llama-index-llms-llama-api/README.md/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-llama-api/README.md", "repo_id": "llama_index", "token_count": 13 }
1,312
<jupyter_start><jupyter_text>Cassandra Vector Store [Apache Cassandraยฎ](https://cassandra.apache.org) is a NoSQL, row-oriented, highly scalable and highly available database. Starting with version 5.0, the database ships with [vector search](https://cassandra.apache.org/doc/trunk/cassandra/vector-search/overview.html) ...
llama_index/docs/examples/vector_stores/CassandraIndexDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/CassandraIndexDemo.ipynb", "repo_id": "llama_index", "token_count": 4058 }
1,081
<!--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 agree...
diffusers/docs/source/en/training/text_inversion.md/0
{ "file_path": "diffusers/docs/source/en/training/text_inversion.md", "repo_id": "diffusers", "token_count": 4383 }
192
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.sub_question_weaviate import WeaviateSubQuestionPack def test_class(): names_of_base_classes = [b.__name__ for b in WeaviateSubQuestionPack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-sub-question-weaviate/tests/test_packs_sub_question_weaviate.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-sub-question-weaviate/tests/test_packs_sub_question_weaviate.py", "repo_id": "llama_index", "token_count": 104 }
1,875
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/models/imagegpt/__init__.py/0
{ "file_path": "transformers/src/transformers/models/imagegpt/__init__.py", "repo_id": "transformers", "token_count": 1004 }
647
<!--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/tf_xla.md/0
{ "file_path": "transformers/docs/source/ja/tf_xla.md", "repo_id": "transformers", "token_count": 4383 }
523
from typing import Any, Optional, Sequence from langchain_core.documents import BaseDocumentTransformer, Document from langchain_core.utils import get_from_env class DoctranTextTranslator(BaseDocumentTransformer): """Translate text documents using doctran. Arguments: openai_api_key: OpenAI API key. ...
langchain/libs/community/langchain_community/document_transformers/doctran_text_translate.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_transformers/doctran_text_translate.py", "repo_id": "langchain", "token_count": 991 }
266
// 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/mmap/Column.h/0
{ "file_path": "milvus/internal/core/src/mmap/Column.h", "repo_id": "milvus", "token_count": 6589 }
1,758
import { HuggingFaceTransformersEmbeddings } from "@langchain/community/embeddings/hf_transformers"; const model = new HuggingFaceTransformersEmbeddings({ modelName: "Xenova/all-MiniLM-L6-v2", }); /* Embed queries */ const res = await model.embedQuery( "What would be a good company name for a company that makes c...
langchainjs/examples/src/models/embeddings/hf_transformers.ts/0
{ "file_path": "langchainjs/examples/src/models/embeddings/hf_transformers.ts", "repo_id": "langchainjs", "token_count": 146 }
840
# 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...
diffusers/src/diffusers/models/adapter.py/0
{ "file_path": "diffusers/src/diffusers/models/adapter.py", "repo_id": "diffusers", "token_count": 10101 }
229
<jupyter_start><jupyter_text>ElasticSearch BM25>[Elasticsearch](https://www.elastic.co/elasticsearch/) is a distributed, RESTful search and analytics engine. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.>In information retrieval, [Okapi...
langchain/docs/docs/integrations/retrievers/elastic_search_bm25.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/elastic_search_bm25.ipynb", "repo_id": "langchain", "token_count": 657 }
160
from langchain_community.utilities.golden_query import ( GoldenQueryAPIWrapper, ) __all__ = ["GoldenQueryAPIWrapper"]
langchain/libs/langchain/langchain/utilities/golden_query.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/golden_query.py", "repo_id": "langchain", "token_count": 41 }
571
python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/agent/openai/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/agent/openai/BUILD", "repo_id": "llama_index", "token_count": 25 }
1,728
# Copyright 2024 Katherine Crowson, The HuggingFace Team and hlky. 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 # # ...
diffusers/src/diffusers/schedulers/scheduling_heun_discrete.py/0
{ "file_path": "diffusers/src/diffusers/schedulers/scheduling_heun_discrete.py", "repo_id": "diffusers", "token_count": 8979 }
262
"""Verify that file system blob loader works as expected.""" import os import tempfile from pathlib import Path from typing import Generator import pytest from langchain_community.document_loaders.blob_loaders import FileSystemBlobLoader @pytest.fixture def toy_dir() -> Generator[Path, None, None]: """Yield a p...
langchain/libs/community/tests/unit_tests/document_loaders/blob_loaders/test_filesystem_blob_loader.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/blob_loaders/test_filesystem_blob_loader.py", "repo_id": "langchain", "token_count": 2148 }
370
# 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/transformers/t5_film_transformer.py/0
{ "file_path": "diffusers/src/diffusers/models/transformers/t5_film_transformer.py", "repo_id": "diffusers", "token_count": 7147 }
238
# Using the hub Install the [`hf-hub`](https://github.com/huggingface/hf-hub) crate: ```bash cargo add hf-hub ``` Then let's start by downloading the [model file](https://huggingface.co/bert-base-uncased/tree/main). ```rust # extern crate candle_core; # extern crate hf_hub; use hf_hub::api::sync::Api; use candle_c...
candle/candle-book/src/inference/hub.md/0
{ "file_path": "candle/candle-book/src/inference/hub.md", "repo_id": "candle", "token_count": 1098 }
23