text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
"""Steam API toolkit"""
langchain/libs/community/langchain_community/tools/steam/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/steam/__init__.py", "repo_id": "langchain", "token_count": 7 }
296
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/models/bart/test_modeling_flax_bart.py/0
{ "file_path": "transformers/tests/models/bart/test_modeling_flax_bart.py", "repo_id": "transformers", "token_count": 17353 }
731
import CodeBlock from "@theme/CodeBlock"; # Datetime parser This OutputParser can be used to parse LLM output into datetime format. import Example from "@examples/prompts/datetime_parser.ts"; import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <IntegrationInstallTooltip></Integr...
langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/types/datetime.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/types/datetime.mdx", "repo_id": "langchainjs", "token_count": 135 }
738
from langchain_community.tools.slack.send_message import ( SendMessageSchema, SlackSendMessage, ) __all__ = ["SendMessageSchema", "SlackSendMessage"]
langchain/libs/langchain/langchain/tools/slack/send_message.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/slack/send_message.py", "repo_id": "langchain", "token_count": 54 }
611
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.roberta...
transformers/examples/research_projects/deebert/src/modeling_highway_roberta.py/0
{ "file_path": "transformers/examples/research_projects/deebert/src/modeling_highway_roberta.py", "repo_id": "transformers", "token_count": 3077 }
597
import asyncio import logging from typing import List, Optional, Sequence from langchain_core.callbacks import ( AsyncCallbackManagerForRetrieverRun, CallbackManagerForRetrieverRun, ) from langchain_core.documents import Document from langchain_core.language_models import BaseLanguageModel from langchain_core....
langchain/libs/langchain/langchain/retrievers/multi_query.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/multi_query.py", "repo_id": "langchain", "token_count": 2727 }
568
--- sidebar_class_name: hidden --- # Dynamically selecting from multiple prompts This notebook demonstrates how to use the `RouterChain` paradigm to create a chain that dynamically selects the prompt to use for a given input. Specifically we show how to use the `MultiPromptChain` to create a question-answering chain ...
langchainjs/docs/core_docs/docs/modules/chains/additional/multi_prompt_router.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/chains/additional/multi_prompt_router.mdx", "repo_id": "langchainjs", "token_count": 213 }
804
// 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/distributed/querycoord/service_test.go/0
{ "file_path": "milvus/internal/distributed/querycoord/service_test.go", "repo_id": "milvus", "token_count": 4747 }
1,790
import { OpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { ConversationalRetrievalQAChain } from "langchain/chains"; import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; import * as fs from "fs"; /* Initialize the LLM...
langchainjs/examples/src/chains/conversational_qa_external_memory_legacy.ts/0
{ "file_path": "langchainjs/examples/src/chains/conversational_qa_external_memory_legacy.ts", "repo_id": "langchainjs", "token_count": 390 }
799
[ { "suite_params": [ { "suite": "2_locust_search_5h.yaml", "image_type": "cpu" } ] } ]
milvus/tests/benchmark/milvus_benchmark/scheduler/loop_search.json/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/scheduler/loop_search.json", "repo_id": "milvus", "token_count": 122 }
2,083
# Getting the absolute path of the current file's directory import os 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 .env file if it exists def _load_env() -> ...
langchain/libs/community/tests/integration_tests/conftest.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/conftest.py", "repo_id": "langchain", "token_count": 200 }
341
# 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/models/seamless_m4t/test_tokenization_seamless_m4t.py/0
{ "file_path": "transformers/tests/models/seamless_m4t/test_tokenization_seamless_m4t.py", "repo_id": "transformers", "token_count": 15133 }
769
# coding=utf-8 # Copyright 2022, The LongT5 Authors and HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
transformers/src/transformers/models/longt5/configuration_longt5.py/0
{ "file_path": "transformers/src/transformers/models/longt5/configuration_longt5.py", "repo_id": "transformers", "token_count": 3475 }
684
<jupyter_start><jupyter_text>Pydantic Tree SummarizeIn this notebook, we demonstrate how to use tree summarize with structured outputs. Specifically, tree summarize is used to output pydantic objects.<jupyter_code>import os import openai os.environ["OPENAI_API_KEY"] = "sk-..." openai.api_key = os.environ["OPENAI_API_K...
llama_index/docs/examples/response_synthesizers/pydantic_tree_summarize.ipynb/0
{ "file_path": "llama_index/docs/examples/response_synthesizers/pydantic_tree_summarize.ipynb", "repo_id": "llama_index", "token_count": 787 }
1,084
from llama_index.packs.llama_dataset_metadata.base import LlamaDatasetMetadataPack __all__ = ["LlamaDatasetMetadataPack"]
llama_index/llama-index-packs/llama-index-packs-llama-dataset-metadata/llama_index/packs/llama_dataset_metadata/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-llama-dataset-metadata/llama_index/packs/llama_dataset_metadata/__init__.py", "repo_id": "llama_index", "token_count": 45 }
1,851
"use client"; import { usePathname } from 'next/navigation'; export function Navbar() { const pathname = usePathname(); return ( <nav className="mb-4"> <a className={`mr-4 ${pathname === "/" ? "text-white border-b" : ""}`} href="/">🏴‍☠️ Chat</a> <a className={`mr-4 ${pathname === "/structured_out...
langchain-nextjs-template/components/Navbar.tsx/0
{ "file_path": "langchain-nextjs-template/components/Navbar.tsx", "repo_id": "langchain-nextjs-template", "token_count": 329 }
70
use crate::backend::{BackendDevice, BackendStorage}; use crate::op::{BinaryOpT, CmpOp, ReduceOp, UnaryOpT}; use crate::{CpuStorage, DType, Layout, Result, Shape, WithDType}; pub use candle_kernels as kernels; pub use cudarc; use cudarc::cublas::{Gemm, GemmConfig, StridedBatchedConfig}; use cudarc::driver::{ CudaFun...
candle/candle-core/src/cuda_backend.rs/0
{ "file_path": "candle/candle-core/src/cuda_backend.rs", "repo_id": "candle", "token_count": 45635 }
38
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/models/unets/unet_3d_blocks.py/0
{ "file_path": "diffusers/src/diffusers/models/unets/unet_3d_blocks.py", "repo_id": "diffusers", "token_count": 48125 }
240
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/core/src/exec/expression/UnaryExpr.cpp/0
{ "file_path": "milvus/internal/core/src/exec/expression/UnaryExpr.cpp", "repo_id": "milvus", "token_count": 14073 }
1,751
import copy from transformers.configuration_utils import PretrainedConfig from transformers.utils import logging logger = logging.get_logger(__name__) class HybridCLIPConfig(PretrainedConfig): r""" :class:`HybridCLIPConfig` is the configuration class to store the configuration of a :class:`~HybridCLIPM...
transformers/examples/research_projects/jax-projects/hybrid_clip/configuration_hybrid_clip.py/0
{ "file_path": "transformers/examples/research_projects/jax-projects/hybrid_clip/configuration_hybrid_clip.py", "repo_id": "transformers", "token_count": 1634 }
545
from typing import Dict, Type from llama_index.core.llms.custom import CustomLLM from llama_index.core.llms.llm import LLM from llama_index.core.llms.mock import MockLLM RECOGNIZED_LLMS: Dict[str, Type[LLM]] = { MockLLM.class_name(): MockLLM, CustomLLM.class_name(): CustomLLM, } def load_llm(data: dict) -> ...
llama_index/llama-index-core/llama_index/core/llms/loading.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/llms/loading.py", "repo_id": "llama_index", "token_count": 292 }
1,188
import { browser } from "$app/environment"; import { invalidate } from "$app/navigation"; import { base } from "$app/paths"; import { UrlDependency } from "$lib/types/UrlDependency"; import type { ObjectId } from "mongodb"; import { getContext, setContext } from "svelte"; import { type Writable, writable, get } from "s...
chat-ui/src/lib/stores/settings.ts/0
{ "file_path": "chat-ui/src/lib/stores/settings.ts", "repo_id": "chat-ui", "token_count": 760 }
101
import { ChatGPTPluginRetriever } from "langchain/retrievers/remote"; export const run = async () => { const retriever = new ChatGPTPluginRetriever({ url: "http://0.0.0.0:8000", auth: { bearer: "super-secret-jwt-token-with-at-least-32-characters-long", }, }); const docs = await retriever.getRe...
langchainjs/examples/src/retrievers/chatgpt-plugin.ts/0
{ "file_path": "langchainjs/examples/src/retrievers/chatgpt-plugin.ts", "repo_id": "langchainjs", "token_count": 140 }
815
<jupyter_start><jupyter_text>Weaviate>[Weaviate](https://weaviate.io/) is an open-source vector database. It allows you to store data objects and vector embeddings from>your favorite ML models, and scale seamlessly into billions of data objects.In the notebook, we'll demo the `SelfQueryRetriever` wrapped around a `Weav...
langchain/docs/docs/integrations/retrievers/self_query/weaviate_self_query.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/self_query/weaviate_self_query.ipynb", "repo_id": "langchain", "token_count": 1502 }
159
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/tapex.md/0
{ "file_path": "transformers/docs/source/en/model_doc/tapex.md", "repo_id": "transformers", "token_count": 2167 }
503
python_sources()
llama_index/llama-index-packs/llama-index-packs-fusion-retriever/llama_index/packs/fusion_retriever/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-fusion-retriever/llama_index/packs/fusion_retriever/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,653
from typing import List import pytest from llama_index.core.indices.document_summary.base import DocumentSummaryIndex from llama_index.core.response_synthesizers import get_response_synthesizer from llama_index.core.schema import Document from llama_index.core.service_context import ServiceContext from tests.mock_util...
llama_index/llama-index-core/tests/indices/document_summary/conftest.py/0
{ "file_path": "llama_index/llama-index-core/tests/indices/document_summary/conftest.py", "repo_id": "llama_index", "token_count": 486 }
1,260
# Google All functionality related to [Google Cloud Platform](https://cloud.google.com/) and other `Google` products. ## Chat models ### Google AI Access GoogleAI `Gemini` models such as `gemini-pro` and `gemini-pro-vision` through the `ChatGoogleGenerativeAI` class. ```bash pip install -U langchain-google-genai `...
langchain/docs/docs/integrations/platforms/google.mdx/0
{ "file_path": "langchain/docs/docs/integrations/platforms/google.mdx", "repo_id": "langchain", "token_count": 5251 }
137
# Copyright 2020 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 # # Unless required by applicable law or a...
datasets/src/datasets/download/mock_download_manager.py/0
{ "file_path": "datasets/src/datasets/download/mock_download_manager.py", "repo_id": "datasets", "token_count": 4438 }
129
package indexcgowrapper /* #cgo pkg-config: milvus_indexbuilder #include <stdlib.h> // free #include "indexbuilder/index_c.h" */ import "C" import ( "context" "fmt" "path/filepath" "runtime" "unsafe" "github.com/golang/protobuf/proto" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvu...
milvus/internal/util/indexcgowrapper/index.go/0
{ "file_path": "milvus/internal/util/indexcgowrapper/index.go", "repo_id": "milvus", "token_count": 4824 }
1,800
# LlamaIndex Readers Integration: Metal
llama_index/llama-index-integrations/readers/llama-index-readers-metal/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-metal/README.md", "repo_id": "llama_index", "token_count": 9 }
1,480
--- sidebar_class_name: hidden --- # Dynamically selecting from multiple retrievers This notebook demonstrates how to use the `RouterChain` paradigm to create a chain that dynamically selects which Retrieval system to use. Specifically we show how to use the `MultiRetrievalQAChain` to create a question-answering chai...
langchainjs/docs/core_docs/docs/modules/chains/additional/multi_retrieval_qa_router.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/chains/additional/multi_retrieval_qa_router.mdx", "repo_id": "langchainjs", "token_count": 227 }
782
python_tests()
llama_index/llama-index-packs/llama-index-packs-deeplake-multimodal-retrieval/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-deeplake-multimodal-retrieval/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,840
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/adalora/__init__.py/0
{ "file_path": "peft/src/peft/tuners/adalora/__init__.py", "repo_id": "peft", "token_count": 429 }
347
"""Test HanaVector functionality.""" from langchain_community.vectorstores import HanaDB def test_int_sanitation_with_illegal_value() -> None: """Test sanitization of int with illegal value""" successful = True try: HanaDB._sanitize_int("HUGO") successful = False except ValueError: ...
langchain/libs/community/tests/unit_tests/vectorstores/test_hanavector.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/vectorstores/test_hanavector.py", "repo_id": "langchain", "token_count": 456 }
385
import json import os from unittest import mock import pytest from langchain_community.chat_models.azure_openai import AzureChatOpenAI @mock.patch.dict( os.environ, { "OPENAI_API_KEY": "test", "OPENAI_API_BASE": "https://oai.azure.com/", "OPENAI_API_VERSION": "2023-05-01", }, ) @...
langchain/libs/community/tests/unit_tests/chat_models/test_azureopenai.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/chat_models/test_azureopenai.py", "repo_id": "langchain", "token_count": 776 }
361
{ "name": "langserve-playground", "private": true, "version": "0.0.0", "type": "module", "scripts": { "dev": "vite", "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, "dependencies": { "@emoti...
langserve/langserve/playground/package.json/0
{ "file_path": "langserve/langserve/playground/package.json", "repo_id": "langserve", "token_count": 858 }
1,046
# coding=utf-8 # Copyright 2021 The EleutherAI and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
transformers/src/transformers/models/gptj/modeling_flax_gptj.py/0
{ "file_path": "transformers/src/transformers/models/gptj/modeling_flax_gptj.py", "repo_id": "transformers", "token_count": 12460 }
626
--- sidebar_label: Cohere sidebar_class_name: beta --- import CodeBlock from "@theme/CodeBlock"; # ChatCohere :::info The Cohere Chat API is still in beta. This means Cohere may make breaking changes at any time. ::: ## Setup In order to use the LangChain.js Cohere integration you'll need an API key. You can sign ...
langchainjs/docs/core_docs/docs/integrations/chat/cohere.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/chat/cohere.mdx", "repo_id": "langchainjs", "token_count": 1103 }
708
from langchain_community.embeddings.sagemaker_endpoint import ( EmbeddingsContentHandler, SagemakerEndpointEmbeddings, ) __all__ = ["EmbeddingsContentHandler", "SagemakerEndpointEmbeddings"]
langchain/libs/langchain/langchain/embeddings/sagemaker_endpoint.py/0
{ "file_path": "langchain/libs/langchain/langchain/embeddings/sagemaker_endpoint.py", "repo_id": "langchain", "token_count": 66 }
548
"""Agent toolkit for interacting with vector stores."""
langchain/libs/langchain/langchain/agents/agent_toolkits/vectorstore/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/vectorstore/__init__.py", "repo_id": "langchain", "token_count": 12 }
465
import asyncio import json import logging from typing import Any, Dict, List, Optional from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader logger = logging.getLogger(__name__) class SurrealDBLoader(BaseLoader): """Load SurrealDB documents.""" def ...
langchain/libs/community/langchain_community/document_loaders/surrealdb.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/surrealdb.py", "repo_id": "langchain", "token_count": 1385 }
250
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-qdrant/llama_index/vector_stores/qdrant/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-qdrant/llama_index/vector_stores/qdrant/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,495
# coding=utf-8 # Copyright 2023 HuggingFace Inc. team and MosaicML NLP 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 requ...
transformers/src/transformers/models/mpt/modeling_mpt.py/0
{ "file_path": "transformers/src/transformers/models/mpt/modeling_mpt.py", "repo_id": "transformers", "token_count": 17671 }
696
<jupyter_start><jupyter_text>Activeloop Deep Memory**How do we get +15% RAG hit_rate improvement for question answering on documentation?** Retrieval-Augmented Generators (RAGs) have recently gained significant attention. As advanced RAG techniques and agents emerge, they expand the potential of what RAGs can accomplis...
llama_index/docs/examples/retrievers/deep_memory.ipynb/0
{ "file_path": "llama_index/docs/examples/retrievers/deep_memory.ipynb", "repo_id": "llama_index", "token_count": 4557 }
1,085
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class Pop2PianoFeatureExtractor(metaclass=DummyObject): _backends = ["music"] def __init__(self, *args, **kwargs): requires_backends(self, ["music"]) class Pop2PianoTokeniz...
transformers/src/transformers/utils/dummy_music_objects.py/0
{ "file_path": "transformers/src/transformers/utils/dummy_music_objects.py", "repo_id": "transformers", "token_count": 169 }
716
<!--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/it/preprocessing.md/0
{ "file_path": "transformers/docs/source/it/preprocessing.md", "repo_id": "transformers", "token_count": 9558 }
511
from typing import Any, Dict, List, Mapping, Optional from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models.llms import LLM from langchain_core.pydantic_v1 import Extra, SecretStr, root_validator from langchain_core.utils import convert_to_secret_str, get_from_dict_or_env ...
langchain/libs/community/langchain_community/llms/nlpcloud.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/nlpcloud.py", "repo_id": "langchain", "token_count": 2157 }
271
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/ko/using-diffusers/conditional_image_generation.md/0
{ "file_path": "diffusers/docs/source/ko/using-diffusers/conditional_image_generation.md", "repo_id": "diffusers", "token_count": 1551 }
192
from datetime import datetime from typing import Dict, List, Optional, Union from uuid import UUID from pydantic import BaseModel # Floats between v1 and v2 from langserve.pydantic_v1 import BaseModel as BaseModelV1 class CustomUserType(BaseModelV1): """Inherit from this class to create a custom user type. ...
langserve/langserve/schema.py/0
{ "file_path": "langserve/langserve/schema.py", "repo_id": "langserve", "token_count": 939 }
1,067
from __module_name__ import __all__ EXPECTED_ALL = [ "__ModuleName__LLM", "Chat__ModuleName__", "__ModuleName__VectorStore", "__ModuleName__Embeddings", ] def test_all_imports() -> None: assert sorted(EXPECTED_ALL) == sorted(__all__)
langchain/libs/cli/langchain_cli/integration_template/tests/unit_tests/test_imports.py/0
{ "file_path": "langchain/libs/cli/langchain_cli/integration_template/tests/unit_tests/test_imports.py", "repo_id": "langchain", "token_count": 103 }
222
package migration import ( "fmt" "github.com/blang/semver/v4" "github.com/milvus-io/milvus/cmd/tools/migration/meta" "github.com/milvus-io/milvus/cmd/tools/migration/versions" ) type Migrator interface { Migrate(metas *meta.Meta) (*meta.Meta, error) } func NewMigrator(sourceVersion, targetVersion string) (Mig...
milvus/cmd/tools/migration/migration/migrator.go/0
{ "file_path": "milvus/cmd/tools/migration/migration/migrator.go", "repo_id": "milvus", "token_count": 278 }
1,899
python_sources()
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-argilla/llama_index/callbacks/argilla/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-argilla/llama_index/callbacks/argilla/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,243
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querynodev2/cluster/worker_test.go/0
{ "file_path": "milvus/internal/querynodev2/cluster/worker_test.go", "repo_id": "milvus", "token_count": 6790 }
1,867
# Learning Tools (Experimental 🧪) Using Large Language Models (LLMs) with tools has been a popular topic recently with awesome works such as [ToolFormer](https://arxiv.org/abs/2302.04761) and [ToolBench](https://arxiv.org/pdf/2305.16504.pdf). In TRL, we provide a simple example of how to teach LLM to use tools with r...
trl/docs/source/learning_tools.mdx/0
{ "file_path": "trl/docs/source/learning_tools.mdx", "repo_id": "trl", "token_count": 3876 }
817
// 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/meta/channel_dist_manager.go/0
{ "file_path": "milvus/internal/querycoordv2/meta/channel_dist_manager.go", "repo_id": "milvus", "token_count": 1656 }
1,841
# Use model after training Once you have trained a model using either the SFTTrainer, PPOTrainer, or DPOTrainer, you will have a fine-tuned model that can be used for text generation. In this section, we'll walk through the process of loading the fine-tuned model and generating text. If you need to run an inference se...
trl/docs/source/use_model.md/0
{ "file_path": "trl/docs/source/use_model.md", "repo_id": "trl", "token_count": 778 }
772
""" Interpolation helpers for timm layers RegularGridInterpolator from https://github.com/sbarratt/torch_interpolations Copyright Shane Barratt, Apache 2.0 license """ import torch from itertools import product class RegularGridInterpolator: """ Interpolate data defined on a rectilinear grid with even or uneven ...
pytorch-image-models/timm/layers/interpolate.py/0
{ "file_path": "pytorch-image-models/timm/layers/interpolate.py", "repo_id": "pytorch-image-models", "token_count": 1121 }
376
.. _Ref-Indices-StructStore: Structured Store Index ====================== .. automodule:: llama_index.core.indices.struct_store :members: :inherited-members: :exclude-members: delete, docstore, index_struct, index_struct_cls
llama_index/docs/api_reference/indices/struct_store.rst/0
{ "file_path": "llama_index/docs/api_reference/indices/struct_store.rst", "repo_id": "llama_index", "token_count": 80 }
1,111
python_test_utils( name="test_utils", ) python_tests( name="tests", skip_tests=True, ) python_sources()
llama_index/llama-index-legacy/tests/indices/tree/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/tree/BUILD", "repo_id": "llama_index", "token_count": 52 }
1,635
import { ChatPromptTemplate } from "@langchain/core/prompts"; import { RunnablePassthrough, RunnableSequence, } from "@langchain/core/runnables"; import { ChatOpenAI } from "@langchain/openai"; import { createStructuredOutputRunnable } from "langchain/chains/openai_functions"; import { createSqlQueryChain } from "l...
langchainjs/examples/src/use_cases/sql/large_db.ts/0
{ "file_path": "langchainjs/examples/src/use_cases/sql/large_db.ts", "repo_id": "langchainjs", "token_count": 1975 }
889
<jupyter_start><jupyter_text>OpenAI[OpenAI](https://platform.openai.com/docs/introduction) offers a spectrum of models with different levels of power suitable for different tasks.This example goes over how to use LangChain to interact with `OpenAI` [models](https://platform.openai.com/docs/models)<jupyter_code># get a ...
langchain/docs/docs/integrations/llms/openai.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/openai.ipynb", "repo_id": "langchain", "token_count": 640 }
131
<jupyter_start><jupyter_text>How to deploy Large Language Models (LLMs) to Amazon SageMaker using new Hugging Face LLM DLCThis is an example on how to deploy the open-source LLMs, like [BLOOM](bigscience/bloom) to Amazon SageMaker for inference using the new Hugging Face LLM Inference Container. We will deploy the 12B ...
notebooks/sagemaker/27_deploy_large_language_models/sagemaker-notebook.ipynb/0
{ "file_path": "notebooks/sagemaker/27_deploy_large_language_models/sagemaker-notebook.ipynb", "repo_id": "notebooks", "token_count": 4572 }
292
import { dereference } from "./dereference.js"; import { Schema, SchemaDraft } from "./types.js"; import { validate } from "./validate.js"; export class Validator { private readonly lookup: ReturnType<typeof dereference>; constructor( private readonly schema: Schema | boolean, private readonly draft: Sche...
langchainjs/langchain-core/src/utils/@cfworker/json-schema/src/validator.ts/0
{ "file_path": "langchainjs/langchain-core/src/utils/@cfworker/json-schema/src/validator.ts", "repo_id": "langchainjs", "token_count": 284 }
873
// 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/storage/pk_statistics.go/0
{ "file_path": "milvus/internal/storage/pk_statistics.go", "repo_id": "milvus", "token_count": 1139 }
2,012
from langchain_community.graphs.falkordb_graph import ( FalkorDBGraph, ) __all__ = [ "FalkorDBGraph", ]
langchain/libs/langchain/langchain/graphs/falkordb_graph.py/0
{ "file_path": "langchain/libs/langchain/langchain/graphs/falkordb_graph.py", "repo_id": "langchain", "token_count": 49 }
506
export * from "./src/index.js";
langchainjs/langchain-core/src/utils/@cfworker/json-schema/index.ts/0
{ "file_path": "langchainjs/langchain-core/src/utils/@cfworker/json-schema/index.ts", "repo_id": "langchainjs", "token_count": 12 }
906
#!/usr/bin/env python3 """ Checkpoint Averaging Script This script averages all model weights for checkpoints in specified path that match the specified filter wildcard. All checkpoints must be from the exact same model. For any hope of decent results, the checkpoints should be from the same or child (via resumes) tr...
pytorch-image-models/avg_checkpoints.py/0
{ "file_path": "pytorch-image-models/avg_checkpoints.py", "repo_id": "pytorch-image-models", "token_count": 2377 }
312
import torch import torch.distributed from typing import List, Optional, Tuple from transformers import ( AutoTokenizer, AutoConfig, ) from text_generation_server.models import Seq2SeqLM from text_generation_server.models.custom_modeling.t5_modeling import ( T5ForConditionalGeneration, ) from text_genera...
text-generation-inference/server/text_generation_server/models/t5.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/t5.py", "repo_id": "text-generation-inference", "token_count": 1617 }
400
"""Tests for the time-weighted retriever class.""" from datetime import datetime, timedelta from typing import Any, Iterable, List, Optional, Tuple, Type import pytest from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.vectorstores import VectorStore fr...
langchain/libs/langchain/tests/unit_tests/retrievers/test_time_weighted_retriever.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/retrievers/test_time_weighted_retriever.py", "repo_id": "langchain", "token_count": 2351 }
613
<script lang="ts"> import type { WebSearchUpdate } from "$lib/types/MessageUpdate"; import CarbonError from "~icons/carbon/error-filled"; import EosIconsLoading from "~icons/eos-icons/loading"; import IconInternet from "./icons/IconInternet.svelte"; export let classNames = ""; export let webSearchMessages: WebS...
chat-ui/src/lib/components/OpenWebSearchResults.svelte/0
{ "file_path": "chat-ui/src/lib/components/OpenWebSearchResults.svelte", "repo_id": "chat-ui", "token_count": 1726 }
86
# utils script # generation with retry import logging from typing import Any, Callable, Optional import google.api_core import vertexai from llama_index.core.base.llms.types import ChatMessage, MessageRole from tenacity import ( before_sleep_log, retry, retry_if_exception_type, stop_after_attempt, ...
llama_index/llama-index-integrations/llms/llama-index-llms-vertex/llama_index/llms/vertex/utils.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-vertex/llama_index/llms/vertex/utils.py", "repo_id": "llama_index", "token_count": 3357 }
1,335
"""Toolkit for interacting with a vector store.""" from typing import List from langchain_community.agent_toolkits.base import BaseToolkit from langchain_community.llms.openai import OpenAI from langchain_community.tools.vectorstore.tool import ( VectorStoreQATool, VectorStoreQAWithSourcesTool, ) from langchai...
langchain/libs/langchain/langchain/agents/agent_toolkits/vectorstore/toolkit.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/vectorstore/toolkit.py", "repo_id": "langchain", "token_count": 1185 }
449
<jupyter_start><jupyter_text>LLM Predictor 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-llms-langchain !pip install llama-index<jupyter_output><empty_output><jupyter_text>LangChain LLM<jupyter_code>f...
llama_index/docs/examples/llm/llm_predictor.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/llm_predictor.ipynb", "repo_id": "llama_index", "token_count": 713 }
1,144
python_sources()
llama_index/llama-index-core/llama_index/core/base/response/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/base/response/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,246
from __future__ import annotations import logging import re from typing import TYPE_CHECKING, Any, List, Optional, Pattern from urllib.parse import urlparse import numpy as np logger = logging.getLogger(__name__) if TYPE_CHECKING: from redis.client import Redis as RedisType def _array_to_buffer(array: List[fl...
langchain/libs/community/langchain_community/utilities/redis.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/redis.py", "repo_id": "langchain", "token_count": 3155 }
303
{ "feature_extractor_type": "Wav2Vec2FeatureExtractor", "processor_class": "Wav2Vec2Processor" }
transformers/tests/fixtures/dummy_feature_extractor_config.json/0
{ "file_path": "transformers/tests/fixtures/dummy_feature_extractor_config.json", "repo_id": "transformers", "token_count": 42 }
793
from rag_codellama_fireworks.chain import chain __all__ = ["chain"]
langchain/templates/rag-codellama-fireworks/rag_codellama_fireworks/__init__.py/0
{ "file_path": "langchain/templates/rag-codellama-fireworks/rag_codellama_fireworks/__init__.py", "repo_id": "langchain", "token_count": 23 }
671
from langchain_community.agent_toolkits.gmail.toolkit import SCOPES, GmailToolkit __all__ = ["SCOPES", "GmailToolkit"]
langchain/libs/langchain/langchain/agents/agent_toolkits/gmail/toolkit.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/gmail/toolkit.py", "repo_id": "langchain", "token_count": 42 }
444
import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { Tool } from "@langchain/core/tools"; /** * Interface for the results returned by the Searxng search. */ interface SearxngResults { query: string; number_of_results: number; results: Array<{ url: string; title: string; cont...
langchainjs/libs/langchain-community/src/tools/searxng_search.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/tools/searxng_search.ts", "repo_id": "langchainjs", "token_count": 2545 }
960
"""Google Places API Toolkit.""" from langchain_community.tools.google_places.tool import GooglePlacesTool __all__ = ["GooglePlacesTool"]
langchain/libs/community/langchain_community/tools/google_places/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/google_places/__init__.py", "repo_id": "langchain", "token_count": 41 }
310
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/util/initcore/init_core.go/0
{ "file_path": "milvus/internal/util/initcore/init_core.go", "repo_id": "milvus", "token_count": 1939 }
1,942
@base <https://swapi.co/resource/>. @prefix voc: <https://swapi.co/vocabulary/> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . { <human/11> a voc:Character , voc:Human ; rdfs:label "Anakin Skywalker", "Darth Vader" ; ...
langchain/libs/langchain/tests/integration_tests/chains/docker-compose-ontotext-graphdb/starwars-data.trig/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/chains/docker-compose-ontotext-graphdb/starwars-data.trig", "repo_id": "langchain", "token_count": 2791 }
580
python_sources()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum-intel/llama_index/embeddings/huggingface_optimum_intel/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum-intel/llama_index/embeddings/huggingface_optimum_intel/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,196
import argparse import logging import os import sys import tensorflow as tf from datasets import load_dataset from tqdm import tqdm from transformers import AutoTokenizer, TFAutoModelForSequenceClassification from transformers.file_utils import is_sagemaker_dp_enabled if os.environ.get("SDP_ENABLED") or is_sagemaker_...
notebooks/sagemaker/07_tensorflow_distributed_training_data_parallelism/scripts/train.py/0
{ "file_path": "notebooks/sagemaker/07_tensorflow_distributed_training_data_parallelism/scripts/train.py", "repo_id": "notebooks", "token_count": 2936 }
317
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py", "repo_id": "diffusers", "token_count": 34448 }
260
//! A `VarBuilder` is used to retrieve variables used by a model. These variables can either come //! from a pre-trained checkpoint, e.g. using `VarBuilder::from_mmaped_safetensors`, or initialized //! for training, e.g. using `VarBuilder::from_varmap`. use crate::VarMap; use candle::{safetensors::Load, DType, Device, ...
candle/candle-nn/src/var_builder.rs/0
{ "file_path": "candle/candle-nn/src/var_builder.rs", "repo_id": "candle", "token_count": 8632 }
57
from langchain_community.document_loaders.html import UnstructuredHTMLLoader __all__ = ["UnstructuredHTMLLoader"]
langchain/libs/langchain/langchain/document_loaders/html.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/html.py", "repo_id": "langchain", "token_count": 38 }
482
python_tests( name="tests", )
llama_index/llama-index-finetuning/tests/embeddings/BUILD/0
{ "file_path": "llama_index/llama-index-finetuning/tests/embeddings/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,222
# Copyright 2021 AlQuraishi Laboratory # Copyright 2021 DeepMind Technologies Limited # # 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...
transformers/src/transformers/models/esm/openfold_utils/residue_constants.py/0
{ "file_path": "transformers/src/transformers/models/esm/openfold_utils/residue_constants.py", "repo_id": "transformers", "token_count": 19142 }
643
from langchain_core.runnables.history import ( GetSessionHistoryCallable, MessagesOrDictWithMessages, RunnableWithMessageHistory, ) __all__ = [ "RunnableWithMessageHistory", "GetSessionHistoryCallable", "MessagesOrDictWithMessages", ]
langchain/libs/langchain/langchain/schema/runnable/history.py/0
{ "file_path": "langchain/libs/langchain/langchain/schema/runnable/history.py", "repo_id": "langchain", "token_count": 95 }
591
<jupyter_start><jupyter_text>Traduction (TensorFlow) Installez les bibliothèques 🤗 *Datasets* et 🤗 *Transformers* pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece] !apt install git-lfs<jupyter_output>Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab...
notebooks/course/fr/chapter7/section4_tf.ipynb/0
{ "file_path": "notebooks/course/fr/chapter7/section4_tf.ipynb", "repo_id": "notebooks", "token_count": 3062 }
300
"""RAGatouille Retriever Pack.""" from typing import Any, Dict, List, Optional from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.indices.query.schema import QueryBundle from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.llms.llm import LLM from llama_in...
llama_index/llama-index-packs/llama-index-packs-ragatouille-retriever/llama_index/packs/ragatouille_retriever/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-ragatouille-retriever/llama_index/packs/ragatouille_retriever/base.py", "repo_id": "llama_index", "token_count": 2044 }
1,668
from langchain_core.exceptions import LangChainException __all__ = ["LangChainException"]
langchain/libs/langchain/langchain/schema/exceptions.py/0
{ "file_path": "langchain/libs/langchain/langchain/schema/exceptions.py", "repo_id": "langchain", "token_count": 25 }
576
/* eslint-disable no-instanceof/no-instanceof */ import { ICacheClient, CreateCache } from "@gomomento/sdk-core"; /** * Utility function to ensure that a Momento cache exists. * If the cache does not exist, it is created. * * @param client The Momento cache client. * @param cacheName The name of the cache to ensu...
langchainjs/libs/langchain-community/src/utils/momento.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/utils/momento.ts", "repo_id": "langchainjs", "token_count": 243 }
976
# coding=utf-8 # Copyright 2022 The Open AI Team Authors and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
transformers/src/transformers/models/jukebox/tokenization_jukebox.py/0
{ "file_path": "transformers/src/transformers/models/jukebox/tokenization_jukebox.py", "repo_id": "transformers", "token_count": 7768 }
618
from typing import Any, Generator, Optional, Sequence, cast from llama_index.legacy.prompts import BasePromptTemplate from llama_index.legacy.prompts.default_prompt_selectors import ( DEFAULT_TEXT_QA_PROMPT_SEL, ) from llama_index.legacy.prompts.mixin import PromptDictType from llama_index.legacy.response_synthesi...
llama_index/llama-index-legacy/llama_index/legacy/response_synthesizers/simple_summarize.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/response_synthesizers/simple_summarize.py", "repo_id": "llama_index", "token_count": 1558 }
1,520
# Causal program-aided language (CPAL) chain see https://github.com/langchain-ai/langchain/pull/6255
langchain/libs/experimental/langchain_experimental/cpal/README.md/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/cpal/README.md", "repo_id": "langchain", "token_count": 35 }
445
from llama_index.storage.kvstore.postgres.base import PostgresKVStore __all__ = ["PostgresKVStore"]
llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-postgres/llama_index/storage/kvstore/postgres/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-postgres/llama_index/storage/kvstore/postgres/__init__.py", "repo_id": "llama_index", "token_count": 36 }
1,608
package indexparamcheck import ( "strconv" "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/pkg/util/metric" ) func Test_ivfPQChecker_CheckTrain(t *testing.T) { validParams := map[string]string{ DIM: strconv.Itoa(128), NL...
milvus/pkg/util/indexparamcheck/ivf_pq_checker_test.go/0
{ "file_path": "milvus/pkg/util/indexparamcheck/ivf_pq_checker_test.go", "repo_id": "milvus", "token_count": 2312 }
2,110