text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# Conclusion That’s all for today. Congrats on finishing this unit and the tutorial! The best way to learn is to practice and try stuff. **Why not train another agent with a different configuration?** And don’t hesitate from time to time to check the [leaderboard](https://huggingface.co/spaces/huggingface-projects/A...
deep-rl-class/units/en/unit7/conclusion.mdx/0
{ "file_path": "deep-rl-class/units/en/unit7/conclusion.mdx", "repo_id": "deep-rl-class", "token_count": 117 }
165
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-assemblyai/llama_index/readers/assemblyai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-assemblyai/llama_index/readers/assemblyai/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,333
"""VectorStore agent.""" from typing import Any, Dict, Optional from langchain_core.language_models import BaseLanguageModel from langchain.agents.agent import AgentExecutor from langchain.agents.agent_toolkits.vectorstore.prompt import PREFIX, ROUTER_PREFIX from langchain.agents.agent_toolkits.vectorstore.toolkit im...
langchain/libs/langchain/langchain/agents/agent_toolkits/vectorstore/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/vectorstore/base.py", "repo_id": "langchain", "token_count": 1471 }
464
python_tests( name="tests", ) python_sources()
llama_index/llama-index-core/tests/tools/tool_spec/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/tools/tool_spec/BUILD", "repo_id": "llama_index", "token_count": 22 }
1,218
""" pnasnet5large implementation grabbed from Cadene's pretrained models Additional credit to https://github.com/creafz https://github.com/Cadene/pretrained-models.pytorch/blob/master/pretrainedmodels/models/pnasnet.py """ from collections import OrderedDict from functools import partial import torch import torch...
pytorch-image-models/timm/models/pnasnet.py/0
{ "file_path": "pytorch-image-models/timm/models/pnasnet.py", "repo_id": "pytorch-image-models", "token_count": 7653 }
405
kafka: enabled: false pulsar: enabled: true
milvus/tests/scripts/values/pulsar.yaml/0
{ "file_path": "milvus/tests/scripts/values/pulsar.yaml", "repo_id": "milvus", "token_count": 19 }
1,989
<jupyter_start><jupyter_text>"Optimization by Prompting" for RAGInspired by the [Optimization by Prompting paper](https://arxiv.org/pdf/2309.03409.pdf) by Yang et al., in this guide we test the ability of a "meta-prompt" to optimize our prompt for better RAG performance. The process is roughly as follows:1. The prompt ...
llama_index/docs/examples/prompts/prompt_optimization.ipynb/0
{ "file_path": "llama_index/docs/examples/prompts/prompt_optimization.ipynb", "repo_id": "llama_index", "token_count": 4153 }
1,101
from langchain_openai.chat_models import ( AzureChatOpenAI, ChatOpenAI, ) from langchain_openai.embeddings import ( AzureOpenAIEmbeddings, OpenAIEmbeddings, ) from langchain_openai.llms import AzureOpenAI, OpenAI __all__ = [ "OpenAI", "ChatOpenAI", "OpenAIEmbeddings", "AzureOpenAI", ...
langchain/libs/partners/openai/langchain_openai/__init__.py/0
{ "file_path": "langchain/libs/partners/openai/langchain_openai/__init__.py", "repo_id": "langchain", "token_count": 160 }
659
import { beforeEach, describe, expect, test } from "@jest/globals"; import { ZapierToolKit } from "../toolkits/zapier/zapier.js"; import { ZapierNLAWrapper, ZapierValues } from "../../tools/zapier.js"; describe("ZapierNLAWrapper", () => { let actions: ZapierValues[] = []; let zapier: ZapierNLAWrapper; beforeEac...
langchainjs/langchain/src/agents/tests/zapier_toolkit.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/agents/tests/zapier_toolkit.int.test.ts", "repo_id": "langchainjs", "token_count": 417 }
883
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration parser = HfArgumentParser(InitializationArguments) args = parser.parse_args() # Load codeparrot tokenizer trained for Python code tokenization tokenizer = AutoToke...
transformers/examples/research_projects/codeparrot/scripts/initialize_model.py/0
{ "file_path": "transformers/examples/research_projects/codeparrot/scripts/initialize_model.py", "repo_id": "transformers", "token_count": 296 }
595
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/levit/image_processing_levit.py/0
{ "file_path": "transformers/src/transformers/models/levit/image_processing_levit.py", "repo_id": "transformers", "token_count": 6797 }
690
# coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/siglip/configuration_siglip.py/0
{ "file_path": "transformers/src/transformers/models/siglip/configuration_siglip.py", "repo_id": "transformers", "token_count": 5034 }
742
"""Base interface that all chains should implement.""" import inspect import json import logging import warnings from abc import ABC, abstractmethod from pathlib import Path from typing import Any, Dict, List, Optional, Type, Union, cast import yaml from langchain_core._api import deprecated from langchain_core.callba...
langchain/libs/langchain/langchain/chains/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/base.py", "repo_id": "langchain", "token_count": 11996 }
485
# Module Guides We provide a few simple implementations to start, with more sophisticated modes coming soon! More specifically, the `SimpleChatEngine` does not make use of a knowledge base, whereas all others make use of a query engine over knowledge base. ```{toctree} --- maxdepth: 1 --- ReAct Chat Engine </example...
llama_index/docs/module_guides/deploying/chat_engines/modules.md/0
{ "file_path": "llama_index/docs/module_guides/deploying/chat_engines/modules.md", "repo_id": "llama_index", "token_count": 226 }
1,141
package httpserver import ( "net/http" "net/http/httptest" "testing" "github.com/cockroachdb/errors" "github.com/gin-gonic/gin" "github.com/stretchr/testify/assert" ) func TestWrapHandler(t *testing.T) { testWrapFunc := func(c *gin.Context) (interface{}, error) { Case := c.Param("case") switch Case { ca...
milvus/internal/distributed/proxy/httpserver/wrapper_test.go/0
{ "file_path": "milvus/internal/distributed/proxy/httpserver/wrapper_test.go", "repo_id": "milvus", "token_count": 617 }
1,710
# Generated content DO NOT EDIT from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Sequence from os import PathLike from candle.typing import _ArrayLike, Device, Scalar, Index, Shape from candle import Tensor, DType, QTensor class ONNXModel: """ A wrapper around an ONNX model. """ d...
candle/candle-pyo3/py_src/candle/onnx/__init__.pyi/0
{ "file_path": "candle/candle-pyo3/py_src/candle/onnx/__init__.pyi", "repo_id": "candle", "token_count": 939 }
67
--- hide_table_of_contents: true sidebar_class_name: hidden --- import CodeBlock from "@theme/CodeBlock"; # OpenAPI Calls :::tip Compatibility Must be used with an [OpenAI Functions](https://platform.openai.com/docs/guides/gpt/function-calling) model. ::: This chain can automatically select and call APIs based only...
langchainjs/docs/core_docs/docs/modules/chains/additional/openai_functions/openapi.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/chains/additional/openai_functions/openapi.mdx", "repo_id": "langchainjs", "token_count": 535 }
737
// 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/msgdispatcher/manager.go/0
{ "file_path": "milvus/pkg/mq/msgdispatcher/manager.go", "repo_id": "milvus", "token_count": 3418 }
1,812
"""Wrapper around the Tencent vector database.""" from __future__ import annotations import json import logging import time from typing import Any, Dict, Iterable, List, Optional, Tuple import numpy as np from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_cor...
langchain/libs/community/langchain_community/vectorstores/tencentvectordb.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/tencentvectordb.py", "repo_id": "langchain", "token_count": 6499 }
330
#!/usr/bin/env node /* eslint-disable import/no-extraneous-dependencies */ import Commander from "commander"; import Conf from "conf"; import fs from "fs"; import path from "path"; import { bold, cyan, green, red, yellow } from "picocolors"; import prompts from "prompts"; import checkForUpdate from "update-check"; impo...
langchainjs/libs/create-langchain-integration/index.ts/0
{ "file_path": "langchainjs/libs/create-langchain-integration/index.ts", "repo_id": "langchainjs", "token_count": 1760 }
1,037
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/src/common/File.h/0
{ "file_path": "milvus/internal/core/src/common/File.h", "repo_id": "milvus", "token_count": 742 }
1,744
{ "name": "test-exports-vite", "version": "0.0.0", "workspaces": [ "libs/*" ], "private": true, "type": "module", "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview", "test": "tsc" }, "dependencies": { "@langchain/anthropic": "workspace:*", "@langch...
langchainjs/environment_tests/test-exports-vite/package.json/0
{ "file_path": "langchainjs/environment_tests/test-exports-vite/package.json", "repo_id": "langchainjs", "token_count": 243 }
778
from llama_index.core.indices.vector_store.retrievers.auto_retriever.auto_retriever import ( VectorIndexAutoRetriever, ) __all__ = [ "VectorIndexAutoRetriever", ]
llama_index/llama-index-core/llama_index/core/indices/vector_store/retrievers/auto_retriever/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/vector_store/retrievers/auto_retriever/__init__.py", "repo_id": "llama_index", "token_count": 67 }
1,224
# DDIM Inversion <CourseFloatingBanner unit={4} classNames="absolute z-10 right-0 top-0" notebooks={[ {label: "DDIM Inversion", value: "https://colab.research.google.com/github/huggingface/diffusion-models-class/blob/main/units/en/unit4/ddim_inversion.ipynb"}, {label: "DDIM Inversion", value: "https://stud...
diffusion-models-class/units/en/unit4/2.mdx/0
{ "file_path": "diffusion-models-class/units/en/unit4/2.mdx", "repo_id": "diffusion-models-class", "token_count": 5413 }
297
<!--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_gpu_many.md/0
{ "file_path": "transformers/docs/source/ko/perf_train_gpu_many.md", "repo_id": "transformers", "token_count": 28484 }
504
"""Guru cards / collections reader.""" import logging import re import warnings from typing import Any, List, Optional import pandas as pd import requests from bs4 import BeautifulSoup from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document from requests.auth import HTTPBasic...
llama_index/llama-index-integrations/readers/llama-index-readers-guru/llama_index/readers/guru/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-guru/llama_index/readers/guru/base.py", "repo_id": "llama_index", "token_count": 2410 }
1,363
from llama_index.legacy.indices.managed.vectara.base import VectaraIndex from llama_index.legacy.indices.managed.vectara.retriever import ( VectaraAutoRetriever, VectaraRetriever, ) __all__ = ["VectaraIndex", "VectaraRetriever", "VectaraAutoRetriever"]
llama_index/llama-index-legacy/llama_index/legacy/indices/managed/vectara/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/managed/vectara/__init__.py", "repo_id": "llama_index", "token_count": 103 }
1,602
<jupyter_start><jupyter_text>PySparkThis notebook goes over how to load data from a [PySpark](https://spark.apache.org/docs/latest/api/python/) DataFrame.<jupyter_code>%pip install --upgrade --quiet pyspark from pyspark.sql import SparkSession spark = SparkSession.builder.getOrCreate() df = spark.read.csv("example_dat...
langchain/docs/docs/integrations/document_loaders/pyspark_dataframe.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/pyspark_dataframe.ipynb", "repo_id": "langchain", "token_count": 246 }
118
# langchain-examples This folder contains examples of how to use LangChain. ## Run an example What you'll usually want to do. First, build langchain. From the repository root, run: ```sh yarn yarn build ``` Most examples require API keys. Run `cp .env.example .env`, then edit `.env` with your API keys. Then from...
langchainjs/examples/src/README.md/0
{ "file_path": "langchainjs/examples/src/README.md", "repo_id": "langchainjs", "token_count": 230 }
780
from typing import Optional, Type from langchain.callbacks.manager import ( AsyncCallbackManagerForToolRun, CallbackManagerForToolRun, ) from langchain.pydantic_v1 import BaseModel, Field from langchain.tools import BaseTool response = ( "Create a final answer that says if they " "have any questions a...
langchain/templates/neo4j-semantic-ollama/neo4j_semantic_ollama/smalltalk_tool.py/0
{ "file_path": "langchain/templates/neo4j-semantic-ollama/neo4j_semantic_ollama/smalltalk_tool.py", "repo_id": "langchain", "token_count": 375 }
659
# Metric Card for Perplexity ## Metric Description Given a model and an input text sequence, perplexity measures how likely the model is to generate the input text sequence. This can be used in two main ways: 1. to evaluate how well the model has learned the distribution of the text it was trained on - In this cas...
datasets/metrics/perplexity/README.md/0
{ "file_path": "datasets/metrics/perplexity/README.md", "repo_id": "datasets", "token_count": 1345 }
128
# Rayyan Loader This loader fetches review articles from [Rayyan](https://www.rayyan.ai/) using the [Rayyan SDK](https://github.com/rayyansys/rayyan-python-sdk). All articles for a given review are fetched by default unless a filter is specified. ## Usage To use this loader, you need to specify the path to the Rayya...
llama_index/llama-index-integrations/readers/llama-index-readers-rayyan/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-rayyan/README.md", "repo_id": "llama_index", "token_count": 409 }
1,543
"""A fake callback handler for testing purposes.""" from itertools import chain from typing import Any, Dict, List, Optional, Union from uuid import UUID from langchain_core.messages import BaseMessage from langchain_core.pydantic_v1 import BaseModel from langchain.callbacks.base import AsyncCallbackHandler, BaseCall...
langchain/libs/langchain/tests/unit_tests/callbacks/fake_callback_handler.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/callbacks/fake_callback_handler.py", "repo_id": "langchain", "token_count": 4263 }
597
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-xinference/llama_index/llms/xinference/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-xinference/llama_index/llms/xinference/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,250
from langchain_community.document_loaders.baiducloud_bos_file import BaiduBOSFileLoader __all__ = ["BaiduBOSFileLoader"]
langchain/libs/langchain/langchain/document_loaders/baiducloud_bos_file.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/baiducloud_bos_file.py", "repo_id": "langchain", "token_count": 43 }
500
# Running a model In order to run an existing model, you will need to download and use existing weights. Most models are already available on https://huggingface.co/ in [`safetensors`](https://github.com/huggingface/safetensors) format. Let's get started by running an old model : `bert-base-uncased`.
candle/candle-book/src/inference/inference.md/0
{ "file_path": "candle/candle-book/src/inference/inference.md", "repo_id": "candle", "token_count": 88 }
26
// 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/rootcoord/create_db_task.go/0
{ "file_path": "milvus/internal/rootcoord/create_db_task.go", "repo_id": "milvus", "token_count": 585 }
1,850
import { BaseTransformOutputParser } from "./transform.js"; /** * OutputParser that parses LLMResult into the top likely string. * @example * ```typescript * const promptTemplate = PromptTemplate.fromTemplate( * "Tell me a joke about {topic}", * ); * * const chain = RunnableSequence.from([ * promptTemplat...
langchainjs/langchain-core/src/output_parsers/string.ts/0
{ "file_path": "langchainjs/langchain-core/src/output_parsers/string.ts", "repo_id": "langchainjs", "token_count": 384 }
876
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and is...
diffusers/src/diffusers/pipelines/kandinsky2_2/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/kandinsky2_2/__init__.py", "repo_id": "diffusers", "token_count": 1190 }
252
<div align="center"> <a href="https://www.youtube.com/watch?v=jlMAX2Oaht0"> <img width=560 width=315 alt="Making TGI deployment optimal" src="https://huggingface.co/datasets/Narsil/tgi_assets/resolve/main/thumbnail.png"> </a> # Text Generation Inference <a href="https://github.com/huggingface/text-generation-inf...
text-generation-inference/README.md/0
{ "file_path": "text-generation-inference/README.md", "repo_id": "text-generation-inference", "token_count": 3286 }
412
# 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/commands/run.py/0
{ "file_path": "transformers/src/transformers/commands/run.py", "repo_id": "transformers", "token_count": 1665 }
603
# 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...
transformers/src/transformers/models/siglip/tokenization_siglip.py/0
{ "file_path": "transformers/src/transformers/models/siglip/tokenization_siglip.py", "repo_id": "transformers", "token_count": 7215 }
667
// // 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"); ...
milvus/internal/proxy/task_upsert_test.go/0
{ "file_path": "milvus/internal/proxy/task_upsert_test.go", "repo_id": "milvus", "token_count": 5098 }
1,855
"""Test functionality of JSON tools.""" from pathlib import Path from langchain_community.tools.json.tool import JsonSpec def test_json_spec_from_file(tmp_path: Path) -> None: """Test JsonSpec can be constructed from a file.""" path = tmp_path / "test.json" path.write_text('{"foo": "bar"}') spec = Js...
langchain/libs/community/tests/unit_tests/tools/test_json.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/tools/test_json.py", "repo_id": "langchain", "token_count": 910 }
425
from neo4j_semantic_ollama.agent import agent_executor __all__ = ["agent_executor"]
langchain/templates/neo4j-semantic-ollama/neo4j_semantic_ollama/__init__.py/0
{ "file_path": "langchain/templates/neo4j-semantic-ollama/neo4j_semantic_ollama/__init__.py", "repo_id": "langchain", "token_count": 30 }
652
// 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/meta_watcher.go/0
{ "file_path": "milvus/tests/integration/meta_watcher.go", "repo_id": "milvus", "token_count": 1572 }
2,014
import inspect import re from typing import Callable, List, Optional, Union import numpy as np import PIL.Image import torch from packaging import version from transformers import CLIPImageProcessor, CLIPTokenizer import diffusers from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, SchedulerMixin fro...
diffusers/examples/community/lpw_stable_diffusion_onnx.py/0
{ "file_path": "diffusers/examples/community/lpw_stable_diffusion_onnx.py", "repo_id": "diffusers", "token_count": 24240 }
208
# Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
datasets/src/datasets/arrow_reader.py/0
{ "file_path": "datasets/src/datasets/arrow_reader.py", "repo_id": "datasets", "token_count": 11372 }
128
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.trulens_eval_packs import ( TruLensHarmlessPack, TruLensHelpfulPack, TruLensRAGTriadPack, ) def test_class(): names_of_base_classes = [b.__name__ for b in TruLensHarmlessPack.__mro__] assert BaseLlamaPack.__name__ in name...
llama_index/llama-index-packs/llama-index-packs-trulens-eval-packs/tests/test_packs_trulens_eval_packs.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-trulens-eval-packs/tests/test_packs_trulens_eval_packs.py", "repo_id": "llama_index", "token_count": 242 }
1,615
from llama_index.packs.chroma_autoretrieval.base import ChromaAutoretrievalPack __all__ = ["ChromaAutoretrievalPack"]
llama_index/llama-index-packs/llama-index-packs-chroma-autoretrieval/llama_index/packs/chroma_autoretrieval/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-chroma-autoretrieval/llama_index/packs/chroma_autoretrieval/__init__.py", "repo_id": "llama_index", "token_count": 41 }
1,835
import enum from typing import List from llama_index.core.bridge.pydantic import BaseModel, Field class NodeType(str, enum.Enum): """Enumeration representing the types of nodes in a filesystem.""" FILE = "file" FOLDER = "folder" class Node(BaseModel): """ Class representing a single node in a ...
llama_index/docs/examples/output_parsing/directory.py/0
{ "file_path": "llama_index/docs/examples/output_parsing/directory.py", "repo_id": "llama_index", "token_count": 520 }
1,154
"""Test LLM Math functionality.""" import pytest from langchain.chains.llm_math.base import LLMMathChain from langchain.chains.llm_math.prompt import _PROMPT_TEMPLATE from tests.unit_tests.llms.fake_llm import FakeLLM @pytest.fixture def fake_llm_math_chain() -> LLMMathChain: """Fake LLM Math chain for testing....
langchain/libs/langchain/tests/unit_tests/chains/test_llm_math.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/chains/test_llm_math.py", "repo_id": "langchain", "token_count": 581 }
621
# Yandex All functionality related to Yandex Cloud >[Yandex Cloud](https://cloud.yandex.com/en/) is a public cloud platform. ## Installation and Setup Yandex Cloud SDK can be installed via pip from PyPI: ```bash pip install yandexcloud ``` ## LLMs ### YandexGPT See a [usage example](/docs/integrations/llms/ya...
langchain/docs/docs/integrations/providers/yandex.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/yandex.mdx", "repo_id": "langchain", "token_count": 196 }
164
import os from pathlib import Path import pytest # Getting the absolute path of the current file's directory ABS_PATH = os.path.dirname(os.path.abspath(__file__)) # Getting the absolute path of the project's root directory PROJECT_DIR = os.path.abspath(os.path.join(ABS_PATH, os.pardir, os.pardir)) # Loading the .e...
langchain/libs/langchain/tests/integration_tests/conftest.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/conftest.py", "repo_id": "langchain", "token_count": 398 }
612
# Module Guides These guide provide an overview of how to use our agent classes. For more detailed guides on how to use specific tools, check out our [tools module guides](tools/root.md). ## OpenAI Agent ```{toctree} --- maxdepth: 1 --- /examples/agent/openai_agent.ipynb /examples/agent/openai_agent_with_query_engi...
llama_index/docs/module_guides/deploying/agents/modules.md/0
{ "file_path": "llama_index/docs/module_guides/deploying/agents/modules.md", "repo_id": "llama_index", "token_count": 667 }
1,138
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,772
import { ChatOpenAI } from "@langchain/openai"; const model = new ChatOpenAI({ temperature: 0.9, azureOpenAIApiKey: "SOME_SECRET_VALUE", // In Node.js defaults to process.env.AZURE_OPENAI_API_KEY azureOpenAIApiVersion: "YOUR-API-VERSION", // In Node.js defaults to process.env.AZURE_OPENAI_API_VERSION azureOpen...
langchainjs/examples/src/models/chat/integration_azure_openai.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/integration_azure_openai.ts", "repo_id": "langchainjs", "token_count": 205 }
799
from langchain_community.llms.koboldai import KoboldApiLLM __all__ = ["KoboldApiLLM"]
langchain/libs/langchain/langchain/llms/koboldai.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/koboldai.py", "repo_id": "langchain", "token_count": 36 }
548
// Code generated by mockery v2.32.4. DO NOT EDIT. package mocks import ( context "context" internalpb "github.com/milvus-io/milvus/internal/proto/internalpb" metadata "google.golang.org/grpc/metadata" mock "github.com/stretchr/testify/mock" ) // MockQueryStreamServer is an autogenerated mock type for the Quer...
milvus/internal/util/streamrpc/mocks/mock_query_stream_server.go/0
{ "file_path": "milvus/internal/util/streamrpc/mocks/mock_query_stream_server.go", "repo_id": "milvus", "token_count": 3527 }
2,026
from typing import Iterator, List, Optional, Sequence from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader class FaunaLoader(BaseLoader): """Load from `FaunaDB`. Attributes: query (str): The FQL query string to execute. page_content_...
langchain/libs/community/langchain_community/document_loaders/fauna.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/fauna.py", "repo_id": "langchain", "token_count": 1013 }
250
"""Adapter utils.""" from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Type import torch import transformers from sentence_transformers.util import cos_sim from torch import Tensor, nn from torch.optim import Optimizer from tqdm.autonotebook import trange from llama_index.legacy.embedd...
llama_index/llama-index-legacy/llama_index/legacy/finetuning/embeddings/adapter_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/finetuning/embeddings/adapter_utils.py", "repo_id": "llama_index", "token_count": 2148 }
1,654
# coding=utf-8 # Copyright 2022 Meta Platforms authors and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
transformers/src/transformers/models/flava/convert_dalle_to_flava_codebook.py/0
{ "file_path": "transformers/src/transformers/models/flava/convert_dalle_to_flava_codebook.py", "repo_id": "transformers", "token_count": 1300 }
672
package proxy import ( "context" "sync" "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" "github.com/milvus-io/milvus/internal/mocks" "github.com/milvus-io/milvus/internal/proto/internalpb" "github.co...
milvus/internal/proxy/privilege_interceptor_test.go/0
{ "file_path": "milvus/internal/proxy/privilege_interceptor_test.go", "repo_id": "milvus", "token_count": 3218 }
1,849
<jupyter_start><jupyter_text>**Fine-tuning Multi-Lingual Speech Model with 🤗 Transformers** This notebook shows how to fine-tune multi-lingual pretrained speech models for Automatic Speech Recognition. This notebook is built to run on the [Common Voice dataset](https://huggingface.co/datasets/common_voice) with any mu...
notebooks/examples/multi_lingual_speech_recognition.ipynb/0
{ "file_path": "notebooks/examples/multi_lingual_speech_recognition.ipynb", "repo_id": "notebooks", "token_count": 11516 }
301
from langchain.utilities import DuckDuckGoSearchAPIWrapper from langchain_community.chat_models import ChatOpenAI from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate, FewShotChatMessagePromptTemplate from langchain_core.runnables import RunnableLambda search ...
langchain/templates/stepback-qa-prompting/stepback_qa_prompting/chain.py/0
{ "file_path": "langchain/templates/stepback-qa-prompting/stepback_qa_prompting/chain.py", "repo_id": "langchain", "token_count": 850 }
694
package tasks import ( "context" "fmt" "strconv" "time" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/trace" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus/internal/proto/internalpb" "github.com/milvus-io/milvus/internal/proto/querypb" "github.com/milvus-io/milvu...
milvus/internal/querynodev2/tasks/query_task.go/0
{ "file_path": "milvus/internal/querynodev2/tasks/query_task.go", "repo_id": "milvus", "token_count": 1669 }
1,847
/// Single shard Client use crate::pb::generate::v2::text_generation_service_client::TextGenerationServiceClient; use crate::pb::generate::v2::*; use crate::Result; use grpc_metadata::InjectTelemetryContext; use std::cmp::min; use std::time::Duration; use tonic::transport::{Channel, Uri}; use tracing::instrument; /// ...
text-generation-inference/router/client/src/client.rs/0
{ "file_path": "text-generation-inference/router/client/src/client.rs", "repo_id": "text-generation-inference", "token_count": 3833 }
385
<!--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/tasks/translation.md/0
{ "file_path": "transformers/docs/source/ko/tasks/translation.md", "repo_id": "transformers", "token_count": 9727 }
533
# coding=utf-8 # Copyright 2021 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/vit/test_modeling_vit.py/0
{ "file_path": "transformers/tests/models/vit/test_modeling_vit.py", "repo_id": "transformers", "token_count": 4981 }
778
""" EVA EVA from https://github.com/baaivision/EVA , paper: https://arxiv.org/abs/2211.07636 @article{EVA, title={EVA: Exploring the Limits of Masked Visual Representation Learning at Scale}, author={Fang, Yuxin and Wang, Wen and Xie, Binhui and Sun, Quan and Wu, Ledell and Wang, Xinggang and Huang, Tiejun and ...
pytorch-image-models/timm/models/eva.py/0
{ "file_path": "pytorch-image-models/timm/models/eva.py", "repo_id": "pytorch-image-models", "token_count": 21637 }
384
from langchain_core.documents import BaseDocumentTransformer, Document __all__ = ["Document", "BaseDocumentTransformer"]
langchain/libs/langchain/langchain/schema/document.py/0
{ "file_path": "langchain/libs/langchain/langchain/schema/document.py", "repo_id": "langchain", "token_count": 31 }
541
"""Agent toolkits contain integrations with various resources and services. LangChain has a large ecosystem of integrations with various external resources like local and remote file systems, APIs and databases. These integrations allow developers to create versatile applications that combine the power of LLMs with t...
langchain/libs/community/langchain_community/agent_toolkits/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/__init__.py", "repo_id": "langchain", "token_count": 1107 }
203
import pytest from langchain_community.document_loaders.bigquery import BigQueryLoader try: from google.cloud import bigquery # noqa: F401 bigquery_installed = True except ImportError: bigquery_installed = False @pytest.mark.skipif(not bigquery_installed, reason="bigquery not installed") def test_bigq...
langchain/libs/community/tests/integration_tests/document_loaders/test_bigquery.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_bigquery.py", "repo_id": "langchain", "token_count": 533 }
342
from llama_index.packs.trulens_eval_packs.base import ( TruLensHarmlessPack, TruLensHelpfulPack, TruLensRAGTriadPack, ) __all__ = ["TruLensRAGTriadPack", "TruLensHarmlessPack", "TruLensHelpfulPack"]
llama_index/llama-index-packs/llama-index-packs-trulens-eval-packs/llama_index/packs/trulens_eval_packs/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-trulens-eval-packs/llama_index/packs/trulens_eval_packs/__init__.py", "repo_id": "llama_index", "token_count": 86 }
1,599
// Auto-generated by `scripts/create-entrypoints.js`. Do not edit manually. export interface OptionalImportMap {} export interface SecretMap { ANTHROPIC_API_KEY?: string; OPENAI_API_KEY?: string; PROMPTLAYER_API_KEY?: string; ZAPIER_NLA_API_KEY?: string; }
langchainjs/langchain/src/load/import_type.ts/0
{ "file_path": "langchainjs/langchain/src/load/import_type.ts", "repo_id": "langchainjs", "token_count": 93 }
917
import logging import re import string import threading from concurrent.futures import ThreadPoolExecutor, wait from typing import Any, Dict, List, Literal, Optional, Tuple, Type from google.api_core.exceptions import ( Aborted, DeadlineExceeded, InvalidArgument, ResourceExhausted, ServiceUnavailab...
langchain/libs/partners/google-vertexai/langchain_google_vertexai/embeddings.py/0
{ "file_path": "langchain/libs/partners/google-vertexai/langchain_google_vertexai/embeddings.py", "repo_id": "langchain", "token_count": 6517 }
653
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class LMSDiscreteScheduler(metaclass=DummyObject): _backends = ["torch", "scipy"] def __init__(self, *args, **kwargs): requires_backends(self, ["torch", "scipy"]) @class...
diffusers/src/diffusers/utils/dummy_torch_and_scipy_objects.py/0
{ "file_path": "diffusers/src/diffusers/utils/dummy_torch_and_scipy_objects.py", "repo_id": "diffusers", "token_count": 220 }
269
import pRetry from "p-retry"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { FileLoader, LoadValues } from "./load.js"; import { extname } from "./extname.js"; const fetchWithTimeout = async ( url: string, init: Omit<RequestInit, "signal"> & { timeout: number } ) => { const { timeo...
langchainjs/langchain/src/util/hub.ts/0
{ "file_path": "langchainjs/langchain/src/util/hub.ts", "repo_id": "langchainjs", "token_count": 646 }
919
from llama_index.core.vector_stores.types import VectorStore from llama_index.vector_stores.docarray import ( DocArrayHnswVectorStore, DocArrayInMemoryVectorStore, ) def test_class(): names_of_base_classes = [b.__name__ for b in DocArrayHnswVectorStore.__mro__] assert VectorStore.__name__ in names_of_...
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-docarray/tests/test_vector_stores_docarray.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-docarray/tests/test_vector_stores_docarray.py", "repo_id": "llama_index", "token_count": 169 }
1,603
#!/bin/bash # This script runs an SFT example end-to-end on a tiny model using different possible configurations # but defaults to QLoRA + PEFT OUTPUT_DIR="test_dpo/" MODEL_NAME="HuggingFaceM4/tiny-random-LlamaForCausalLM" MAX_STEPS=5 BATCH_SIZE=2 SEQ_LEN=128 # Handle extra arguments in case one passes accelerate conf...
trl/commands/run_dpo.sh/0
{ "file_path": "trl/commands/run_dpo.sh", "repo_id": "trl", "token_count": 597 }
805
<jupyter_start><jupyter_text>LangSmith Walkthrough[](https://colab.research.google.com/github/langchain-ai/langchain/blob/master/docs/docs/langsmith/walkthrough.ipynb)LangChain makes it easy to prototype LLM applications and Agents. However, delivering LLM applications to production can be deceptively difficult. You wi...
langchain/docs/docs/langsmith/walkthrough.ipynb/0
{ "file_path": "langchain/docs/docs/langsmith/walkthrough.ipynb", "repo_id": "langchain", "token_count": 5229 }
198
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/unittest/bench/bench_search.cpp/0
{ "file_path": "milvus/internal/core/unittest/bench/bench_search.cpp", "repo_id": "milvus", "token_count": 2169 }
1,764
# coding=utf-8 # Copyright 2020 HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
transformers/tests/models/funnel/test_modeling_funnel.py/0
{ "file_path": "transformers/tests/models/funnel/test_modeling_funnel.py", "repo_id": "transformers", "token_count": 9059 }
785
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-feishu-docs/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-feishu-docs/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,433
"""Test AI21 embeddings.""" from langchain_ai21.embeddings import AI21Embeddings def test_langchain_ai21_embedding_documents() -> None: """Test AI21 embeddings.""" documents = ["foo bar"] embedding = AI21Embeddings() output = embedding.embed_documents(documents) assert len(output) == 1 assert ...
langchain/libs/partners/ai21/tests/integration_tests/test_embeddings.py/0
{ "file_path": "langchain/libs/partners/ai21/tests/integration_tests/test_embeddings.py", "repo_id": "langchain", "token_count": 205 }
613
# (Gluon) ResNet **Residual Networks**, or **ResNets**, learn residual functions with reference to the layer inputs, instead of learning unreferenced functions. Instead of hoping each few stacked layers directly fit a desired underlying mapping, residual nets let these layers fit a residual mapping. They stack [residu...
pytorch-image-models/hfdocs/source/models/gloun-resnet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/gloun-resnet.mdx", "repo_id": "pytorch-image-models", "token_count": 7210 }
361
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/api/pipelines/stable_diffusion/sdxl_turbo.md/0
{ "file_path": "diffusers/docs/source/en/api/pipelines/stable_diffusion/sdxl_turbo.md", "repo_id": "diffusers", "token_count": 677 }
181
package rootcoord import ( "fmt" "github.com/milvus-io/milvus/pkg/util" ) const ( // ComponentPrefix prefix for rootcoord component ComponentPrefix = "root-coord" DatabaseMetaPrefix = ComponentPrefix + "/database" DBInfoMetaPrefix = DatabaseMetaPrefix + "/db-info" CollectionInfoMetaPrefix = Dat...
milvus/internal/metastore/kv/rootcoord/rootcoord_constant.go/0
{ "file_path": "milvus/internal/metastore/kv/rootcoord/rootcoord_constant.go", "repo_id": "milvus", "token_count": 720 }
1,809
# Vector Database ##### FAQ 1. [Do I need to use a vector database?](#1-do-i-need-to-use-a-vector-database) 2. [What's the difference between the vector databases?](#2-whats-the-difference-between-the-vector-databases) --- ##### 1. Do I need to use a vector database? LlamaIndex provides a in-memory vector database...
llama_index/docs/community/faq/vector_database.md/0
{ "file_path": "llama_index/docs/community/faq/vector_database.md", "repo_id": "llama_index", "token_count": 211 }
1,043
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-evaluator-benchmarker/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-evaluator-benchmarker/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,652
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-boarddocs/llama_index/readers/boarddocs/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-boarddocs/llama_index/readers/boarddocs/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,345
"""Document summary retrievers. This module contains retrievers for document summary indices. """ import logging from typing import Any, Callable, List, Optional from llama_index.legacy.callbacks.base import CallbackManager from llama_index.legacy.core.base_retriever import BaseRetriever from llama_index.legacy.ind...
llama_index/llama-index-legacy/llama_index/legacy/indices/document_summary/retrievers.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/document_summary/retrievers.py", "repo_id": "llama_index", "token_count": 3019 }
1,517
title: Model Pages
pytorch-image-models/docs/models/.pages/0
{ "file_path": "pytorch-image-models/docs/models/.pages", "repo_id": "pytorch-image-models", "token_count": 4 }
341
# rag-opensearch This Template performs RAG using [OpenSearch](https://python.langchain.com/docs/integrations/vectorstores/opensearch). ## Environment Setup Set the following environment variables. - `OPENAI_API_KEY` - To access OpenAI Embeddings and Models. And optionally set the OpenSearch ones if not using de...
langchain/templates/rag-opensearch/README.md/0
{ "file_path": "langchain/templates/rag-opensearch/README.md", "repo_id": "langchain", "token_count": 801 }
705
python_sources() poetry_requirements( name="poetry", module_mapping={"llamaindex-py-client": ["llama_index_client"]}, )
llama_index/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/BUILD", "repo_id": "llama_index", "token_count": 54 }
1,210
<jupyter_start><jupyter_text>Aleph AlphaThere are two possible ways to use Aleph Alpha's semantic embeddings. If you have texts with a dissimilar structure (e.g. a Document and a Query) you would want to use asymmetric embeddings. Conversely, for texts with comparable structures, symmetric embeddings are the suggested ...
langchain/docs/docs/integrations/text_embedding/aleph_alpha.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/aleph_alpha.ipynb", "repo_id": "langchain", "token_count": 335 }
161
from typing import Any, List, Optional, Sequence from llama_index.core.base.base_query_engine import BaseQueryEngine from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.base.response.schema import RESPONSE_TYPE from llama_index.core.callbacks.base import CallbackManager from llama_inde...
llama_index/llama-index-core/llama_index/core/query_engine/citation_query_engine.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/query_engine/citation_query_engine.py", "repo_id": "llama_index", "token_count": 5554 }
1,167
python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/agent/custom/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/agent/custom/BUILD", "repo_id": "llama_index", "token_count": 25 }
1,547
# 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/bloom/convert_bloom_original_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/bloom/convert_bloom_original_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 4802 }
653
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "tools/google_custom_search", }); export * from "@langchain/community/tools/google_custom_search";
langchainjs/langchain/src/tools/google_custom_search.ts/0
{ "file_path": "langchainjs/langchain/src/tools/google_custom_search.ts", "repo_id": "langchainjs", "token_count": 76 }
995