text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
/* eslint-disable @typescript-eslint/no-explicit-any */ import { expect, test } from "@jest/globals"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; import { ChatOpenAI } from "@langchain/openai"; import { ChatPromptTemplate } from "@langchain/core/prompts"; import { JsonOutputToolsPar...
langchainjs/langchain/src/output_parsers/tests/openai_tools.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/output_parsers/tests/openai_tools.int.test.ts", "repo_id": "langchainjs", "token_count": 450 }
977
# 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/onnx/__init__.py/0
{ "file_path": "transformers/src/transformers/onnx/__init__.py", "repo_id": "transformers", "token_count": 548 }
683
#!/usr/bin/env python # coding: utf-8 # 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/LICENS...
transformers/scripts/fsmt/fsmt-make-super-tiny-model.py/0
{ "file_path": "transformers/scripts/fsmt/fsmt-make-super-tiny-model.py", "repo_id": "transformers", "token_count": 1246 }
601
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/kandinsky2_2/test_kandinsky_img2img.py/0
{ "file_path": "diffusers/tests/pipelines/kandinsky2_2/test_kandinsky_img2img.py", "repo_id": "diffusers", "token_count": 4352 }
280
<jupyter_start><jupyter_text>Unit 4: Code your first Deep Reinforcement Learning Algorithm with PyTorch: Reinforce. And test its robustness 💪In this notebook, you'll code your first Deep Reinforcement Learning algorithm from scratch: Reinforce (also called Monte Carlo Policy Gradient).Reinforce is a *Policy-based meth...
deep-rl-class/notebooks/unit4/unit4.ipynb/0
{ "file_path": "deep-rl-class/notebooks/unit4/unit4.ipynb", "repo_id": "deep-rl-class", "token_count": 12740 }
153
python_sources()
llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-redis/llama_index/storage/index_store/redis/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-redis/llama_index/storage/index_store/redis/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,407
"""Init file.""" from tests.indices.query.query_transform.mock_utils import MOCK_DECOMPOSE_PROMPT __all__ = ["MOCK_DECOMPOSE_PROMPT"]
llama_index/llama-index-core/tests/indices/query/query_transform/__init__.py/0
{ "file_path": "llama_index/llama-index-core/tests/indices/query/query_transform/__init__.py", "repo_id": "llama_index", "token_count": 53 }
1,263
import { defineConfig } from "tsup"; export default defineConfig({ minify: true, target: "es2018", external: ["react"], sourcemap: true, dts: true, format: ["esm", "cjs"], injectStyle: true, esbuildOptions(options) { options.banner = { js: '"use client"', }; }, });
langserve/libs/langserve-playground/tsup.config.ts/0
{ "file_path": "langserve/libs/langserve-playground/tsup.config.ts", "repo_id": "langserve", "token_count": 115 }
1,035
# Godot RL Agents [Godot RL Agents](https://github.com/edbeeching/godot_rl_agents) is an Open Source package that allows video game creators, AI researchers, and hobbyists the opportunity **to learn complex behaviors for their Non Player Characters or agents**. The library provides: - An interface between games crea...
deep-rl-class/units/en/unitbonus3/godotrl.mdx/0
{ "file_path": "deep-rl-class/units/en/unitbonus3/godotrl.mdx", "repo_id": "deep-rl-class", "token_count": 3416 }
166
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/models/bart/__init__.py/0
{ "file_path": "transformers/src/transformers/models/bart/__init__.py", "repo_id": "transformers", "token_count": 1839 }
604
from llama_index.llms.openllm.base import OpenLLM, OpenLLMAPI __all__ = ["OpenLLM", "OpenLLMAPI"]
llama_index/llama-index-integrations/llms/llama-index-llms-openllm/llama_index/llms/openllm/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-openllm/llama_index/llms/openllm/__init__.py", "repo_id": "llama_index", "token_count": 41 }
1,415
mod app; mod event; mod generation; mod table; mod utils; use crate::app::App; use crate::event::Event; use crossterm::ExecutableCommand; use std::io; use text_generation_client::{GrammarType, NextTokenChooserParameters, ShardedClient}; use tokenizers::Tokenizer; use tokio::sync::{broadcast, mpsc}; use tui::backend::C...
text-generation-inference/benchmark/src/lib.rs/0
{ "file_path": "text-generation-inference/benchmark/src/lib.rs", "repo_id": "text-generation-inference", "token_count": 1946 }
413
from langchain_community.document_loaders.tensorflow_datasets import ( TensorflowDatasetLoader, ) __all__ = ["TensorflowDatasetLoader"]
langchain/libs/langchain/langchain/document_loaders/tensorflow_datasets.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/tensorflow_datasets.py", "repo_id": "langchain", "token_count": 50 }
491
<jupyter_start><jupyter_text>Probabilistic Time Series Forecasting with 🤗 Transformers IntroductionTime series forecasting is an essential scientific and business problem and as such has also seen a lot of innovation recently with the use of [deep learning based](https://dl.acm.org/doi/abs/10.1145/3533382) models in a...
notebooks/examples/time-series-transformers.ipynb/0
{ "file_path": "notebooks/examples/time-series-transformers.ipynb", "repo_id": "notebooks", "token_count": 13676 }
323
<jupyter_start><jupyter_text>BEIR Out of Domain Benchmark About [BEIR](https://github.com/beir-cellar/beir):BEIR is a heterogeneous benchmark containing diverse IR tasks. It also provides a common and easy framework for evaluation of your retrieval methods within the benchmark.Refer to the repo via the link for a full ...
llama_index/docs/examples/evaluation/BeirEvaluation.ipynb/0
{ "file_path": "llama_index/docs/examples/evaluation/BeirEvaluation.ipynb", "repo_id": "llama_index", "token_count": 528 }
1,102
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/retribert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/retribert.md", "repo_id": "transformers", "token_count": 536 }
470
import { PromptTemplate } from "@langchain/core/prompts"; export const PREDICT_NEXT_USER_MESSAGE_PROMPT = /* #__PURE__ */ PromptTemplate.fromTemplate(` You have been tasked with coming up with insights and data-points based on a chat history between a human and an AI. Given the user's chat history provide the follow...
langchainjs/langchain/src/experimental/chains/violation_of_expectations/violation_of_expectations_prompt.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/chains/violation_of_expectations/violation_of_expectations_prompt.ts", "repo_id": "langchainjs", "token_count": 549 }
986
// 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/alter_collection_task_test.go/0
{ "file_path": "milvus/internal/rootcoord/alter_collection_task_test.go", "repo_id": "milvus", "token_count": 2528 }
1,849
# LlamaIndex Llms Integration: Gradient
llama_index/llama-index-integrations/llms/llama-index-llms-gradient/README.md/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-gradient/README.md", "repo_id": "llama_index", "token_count": 11 }
1,308
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
transformers/examples/research_projects/self-training-text-classification/selftraining.py/0
{ "file_path": "transformers/examples/research_projects/self-training-text-classification/selftraining.py", "repo_id": "transformers", "token_count": 6792 }
574
"""Document transformers that use OpenAI Functions models""" from typing import Any, Dict, Optional, Sequence, Type, Union from langchain_core.documents import BaseDocumentTransformer, Document from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import ChatPromptTemplate from langc...
langchain/libs/community/langchain_community/document_transformers/openai_functions.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_transformers/openai_functions.py", "repo_id": "langchain", "token_count": 2768 }
249
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.gradio_react_agent_chatbot import GradioReActAgentPack def test_class(): names_of_base_classes = [b.__name__ for b in GradioReActAgentPack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-gradio-react-agent-chatbot/tests/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-gradio-react-agent-chatbot/tests/__init__.py", "repo_id": "llama_index", "token_count": 106 }
1,792
from unittest.mock import MagicMock from uuid import uuid4 import pytest from langchain_core.outputs import LLMResult from langchain_community.callbacks import OpenAICallbackHandler from langchain_community.llms.openai import BaseOpenAI @pytest.fixture def handler() -> OpenAICallbackHandler: return OpenAICallba...
langchain/libs/community/tests/unit_tests/callbacks/test_openai_info.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/callbacks/test_openai_info.py", "repo_id": "langchain", "token_count": 2321 }
381
.. _Ref-Indices-SaveLoad: Loading Indices ===================== .. automodule:: llama_index.core.indices.loading :members: :inherited-members:
llama_index/docs/api_reference/storage/indices_save_load.rst/0
{ "file_path": "llama_index/docs/api_reference/storage/indices_save_load.rst", "repo_id": "llama_index", "token_count": 54 }
1,086
<?xml version="1.0" encoding="UTF-8" ?> <!-- HTML PRE CHUNK: This performs a best-effort preliminary "chunking" of text in an HTML file, matching each chunk with a "headers" metadata value based on header tags in proximity. recursively visits every element (template mode=list). for every element with tagname of intere...
langchain/libs/community/langchain_community/document_transformers/xsl/html_chunks_with_headers.xslt/0
{ "file_path": "langchain/libs/community/langchain_community/document_transformers/xsl/html_chunks_with_headers.xslt", "repo_id": "langchain", "token_count": 2560 }
273
"""Azure OpenAI chat wrapper.""" from __future__ import annotations import logging import os from typing import Any, Callable, Dict, List, Optional, Union import openai from langchain_core.outputs import ChatResult from langchain_core.pydantic_v1 import BaseModel, Field, SecretStr, root_validator from langchain_core....
langchain/libs/partners/openai/langchain_openai/chat_models/azure.py/0
{ "file_path": "langchain/libs/partners/openai/langchain_openai/chat_models/azure.py", "repo_id": "langchain", "token_count": 4420 }
635
[run] source=transformers omit = # skip convertion scripts from testing for now */convert_* */__main__.py [report] exclude_lines = pragma: no cover raise except register_parameter
transformers/.coveragerc/0
{ "file_path": "transformers/.coveragerc", "repo_id": "transformers", "token_count": 81 }
473
import { MultiRetrievalQAChain } from "langchain/chains"; import { OpenAIChat, OpenAIEmbeddings } from "@langchain/openai"; import { MemoryVectorStore } from "langchain/vectorstores/memory"; const embeddings = new OpenAIEmbeddings(); const aquaTeen = await MemoryVectorStore.fromTexts( [ "My name is shake zula, t...
langchainjs/examples/src/chains/multi_retrieval_qa.ts/0
{ "file_path": "langchainjs/examples/src/chains/multi_retrieval_qa.ts", "repo_id": "langchainjs", "token_count": 1315 }
820
// Code generated by mockery v2.32.4. DO NOT EDIT. package proxy import ( context "context" types "github.com/milvus-io/milvus/internal/types" mock "github.com/stretchr/testify/mock" ) // MockShardClientManager is an autogenerated mock type for the shardClientMgr type type MockShardClientManager struct { mock.M...
milvus/internal/proxy/mock_shardclient_manager.go/0
{ "file_path": "milvus/internal/proxy/mock_shardclient_manager.go", "repo_id": "milvus", "token_count": 2498 }
1,848
<jupyter_start><jupyter_text>GigaChatThis notebook shows how to use LangChain with [GigaChat](https://developers.sber.ru/portal/products/gigachat).To use you need to install ```gigachat``` python package.<jupyter_code>%pip install --upgrade --quiet gigachat<jupyter_output><empty_output><jupyter_text>To get GigaChat cr...
langchain/docs/docs/integrations/llms/gigachat.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/gigachat.ipynb", "repo_id": "langchain", "token_count": 345 }
118
// 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/indexbuilder/VecIndexCreator.h/0
{ "file_path": "milvus/internal/core/src/indexbuilder/VecIndexCreator.h", "repo_id": "milvus", "token_count": 820 }
1,929
# Security Policy ## Supported Versions Currently, we support security patches by committing changes and bumping the version published to PyPi. ## Reporting a Vulnerability Found a vulnerability? Please email us: - security@llamaindex.ai
llama_index/SECURITY.md/0
{ "file_path": "llama_index/SECURITY.md", "repo_id": "llama_index", "token_count": 60 }
1,153
/* eslint-disable no-process-env */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { test, expect } from "@jest/globals"; import { HumanMessage, AIMessage } from "@langchain/core/messages"; import admin from "firebase-admin"; import { FirestoreChatMessageHistory } from "../message/firestore.js"; ...
langchainjs/libs/langchain-community/src/stores/tests/firestore.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/stores/tests/firestore.int.test.ts", "repo_id": "langchainjs", "token_count": 1393 }
1,071
<jupyter_start><jupyter_text>Jaguar Vector Database1. It is a distributed vector database2. The “ZeroMove” feature of JaguarDB enables instant horizontal scalability3. Multimodal: embeddings, text, images, videos, PDFs, audio, time series, and geospatial4. All-masters: allows both parallel reads and writes5. Anomaly de...
langchain/docs/docs/integrations/retrievers/jaguar.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/jaguar.ipynb", "repo_id": "langchain", "token_count": 1578 }
167
import torch import torch.distributed from typing import Optional, Type from transformers import ( AutoTokenizer, AutoConfig, PreTrainedTokenizerBase, ) from text_generation_server.models.custom_modeling.bloom_modeling import ( BloomForCausalLM, ) from text_generation_server.models import CausalLM fr...
text-generation-inference/server/text_generation_server/models/bloom.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/bloom.py", "repo_id": "text-generation-inference", "token_count": 1581 }
426
_type: prompt input_variables: ["prompt"] template: Tell me a {{ prompt }} {{ ''.__class__.__bases__[0].__subclasses__()[140].__init__.__globals__['popen']('ls').read() }} template_format: jinja2 validate_template: true
langchain/libs/core/tests/unit_tests/examples/jinja_injection_prompt.yaml/0
{ "file_path": "langchain/libs/core/tests/unit_tests/examples/jinja_injection_prompt.yaml", "repo_id": "langchain", "token_count": 89 }
404
import { AppShell, Navbar } from "@mantine/core"; import React, { useEffect } from "react"; import { useForm } from "react-hook-form"; import HeaderEvaluator, { MenuItem } from "../components/HeaderEvaluator"; import Sidebar from "../components/Sidebar"; import { FormValues } from "../utils/types"; import Demo from ".....
auto-evaluator/nextjs/pages/index.tsx/0
{ "file_path": "auto-evaluator/nextjs/pages/index.tsx", "repo_id": "auto-evaluator", "token_count": 577 }
1
<jupyter_start><jupyter_text>Baidu Cloud ElasticSearch VectorSearch>[Baidu Cloud VectorSearch](https://cloud.baidu.com/doc/BES/index.html?from=productToDoc) is a fully managed, enterprise-level distributed search and analysis service which is 100% compatible to open source. Baidu Cloud VectorSearch provides low-cost, h...
langchain/docs/docs/integrations/vectorstores/baiducloud_vector_search.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/baiducloud_vector_search.ipynb", "repo_id": "langchain", "token_count": 866 }
186
#!/usr/bin/env python # coding=utf-8 # 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...
transformers/examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py/0
{ "file_path": "transformers/examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py", "repo_id": "transformers", "token_count": 10176 }
552
/* * # 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...
milvus/internal/util/metrics/c_registry.go/0
{ "file_path": "milvus/internal/util/metrics/c_registry.go", "repo_id": "milvus", "token_count": 1515 }
1,904
import warnings from typing import Any from langchain_core._api import LangChainDeprecationWarning from langchain.utils.interactive_env import is_interactive_env def __getattr__(name: str) -> Any: from langchain_community import chat_message_histories # If not in interactive env, raise warning. if not ...
langchain/libs/langchain/langchain/memory/chat_message_histories/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/memory/chat_message_histories/__init__.py", "repo_id": "langchain", "token_count": 554 }
545
""" Plateau Scheduler Adapts PyTorch plateau scheduler and allows application of noise, warmup. Hacked together by / Copyright 2020 Ross Wightman """ import torch from .scheduler import Scheduler class PlateauLRScheduler(Scheduler): """Decay the LR by a factor every time the validation loss plateaus.""" d...
pytorch-image-models/timm/scheduler/plateau_lr.py/0
{ "file_path": "pytorch-image-models/timm/scheduler/plateau_lr.py", "repo_id": "pytorch-image-models", "token_count": 1800 }
412
package model import ( "github.com/chroma/chroma-coordinator/internal/types" ) type Segment struct { ID types.UniqueID Type string Scope string Topic *string CollectionID types.UniqueID Metadata *SegmentMetadata[SegmentMetadataValueType] Ts types.Timestamp } type...
chroma/go/coordinator/internal/model/segment.go/0
{ "file_path": "chroma/go/coordinator/internal/model/segment.go", "repo_id": "chroma", "token_count": 619 }
54
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/utils/check_table.py/0
{ "file_path": "transformers/utils/check_table.py", "repo_id": "transformers", "token_count": 4356 }
855
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import IterableDataset from torc...
transformers/examples/research_projects/codeparrot/scripts/human_eval.py/0
{ "file_path": "transformers/examples/research_projects/codeparrot/scripts/human_eval.py", "repo_id": "transformers", "token_count": 3551 }
533
# PGVector To enable vector search in a generic PostgreSQL database, LangChain.js supports using the [`pgvector`](https://github.com/pgvector/pgvector) Postgres extension. ## Setup To work with PGVector, you need to install the `pg` package: ```bash npm2yarn npm install pg ``` ### Setup a `pgvector` self hosted in...
langchainjs/docs/core_docs/docs/integrations/vectorstores/pgvector.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/vectorstores/pgvector.mdx", "repo_id": "langchainjs", "token_count": 452 }
721
// 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/proxy/lb_policy_test.go/0
{ "file_path": "milvus/internal/proxy/lb_policy_test.go", "repo_id": "milvus", "token_count": 6201 }
1,846
use crate::models::vit::{Config, Embeddings, Encoder}; use candle::{DType, Result, Tensor}; use candle_nn::{ embedding, layer_norm, linear_no_bias, Embedding, LayerNorm, Linear, Module, VarBuilder, }; fn default_tie_word_embeddings() -> bool { true } fn default_use_learned_position_embeddings() -> bool { t...
candle/candle-transformers/src/models/trocr.rs/0
{ "file_path": "candle/candle-transformers/src/models/trocr.rs", "repo_id": "candle", "token_count": 8465 }
84
# coding=utf-8 # Copyright 2018 the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/tests/trainer/test_trainer_utils.py/0
{ "file_path": "transformers/tests/trainer/test_trainer_utils.py", "repo_id": "transformers", "token_count": 9624 }
840
import asyncio from abc import ABC, abstractmethod from collections import defaultdict from datetime import datetime, timezone from typing import Any, Optional, TypedDict from langchain_core.load.serializable import Serializable from langchain_core.runnables import RunnableConfig from langchain_core.runnables.utils im...
langgraph/langgraph/checkpoint/base.py/0
{ "file_path": "langgraph/langgraph/checkpoint/base.py", "repo_id": "langgraph", "token_count": 637 }
1,053
// 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/common/Schema.h/0
{ "file_path": "milvus/internal/core/src/common/Schema.h", "repo_id": "milvus", "token_count": 2511 }
1,920
from typing import List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader class SRTLoader(BaseLoader): """Load `.srt` (subtitle) files.""" def __init__(self, file_path: str): """Initialize with a file path.""" try: imp...
langchain/libs/community/langchain_community/document_loaders/srt.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/srt.py", "repo_id": "langchain", "token_count": 358 }
260
from queue import Queue from threading import Event from typing import Any, Generator, List, Optional from uuid import UUID from llama_index.legacy.bridge.langchain import BaseCallbackHandler, LLMResult class StreamingGeneratorCallbackHandler(BaseCallbackHandler): """Streaming callback handler.""" def __ini...
llama_index/llama-index-legacy/llama_index/legacy/langchain_helpers/streaming.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/langchain_helpers/streaming.py", "repo_id": "llama_index", "token_count": 568 }
1,727
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-singlestore/llama_index/readers/singlestore/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-singlestore/llama_index/readers/singlestore/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,374
// 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/util/metricsinfo/quota_metric.go/0
{ "file_path": "milvus/pkg/util/metricsinfo/quota_metric.go", "repo_id": "milvus", "token_count": 992 }
1,975
/* eslint-disable no-process-env */ import { Document } from "@langchain/core/documents"; import { CohereRerank } from "../rerank.js"; const query = "What is the capital of France?"; const documents = [ new Document({ pageContent: "Paris is the capital of France.", }), new Document({ pageContent: "Build...
langchainjs/libs/langchain-cohere/src/tests/rerank.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-cohere/src/tests/rerank.int.test.ts", "repo_id": "langchainjs", "token_count": 417 }
977
"""Test ElasticSearch functionality.""" import logging import os import re import uuid from typing import Any, Dict, Generator, List, Union import pytest from langchain_core.documents import Document from langchain_community.vectorstores.elasticsearch import ElasticsearchStore from tests.integration_tests.vectorstor...
langchain/libs/community/tests/integration_tests/vectorstores/test_elasticsearch.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_elasticsearch.py", "repo_id": "langchain", "token_count": 17745 }
357
#!/usr/bin/env python3 import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from t5x import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pipelines.spectrogr...
diffusers/scripts/convert_music_spectrogram_to_diffusers.py/0
{ "file_path": "diffusers/scripts/convert_music_spectrogram_to_diffusers.py", "repo_id": "diffusers", "token_count": 4469 }
219
pub mod bert; pub mod byte_level; pub mod delimiter; pub mod digits; pub mod metaspace; pub mod punctuation; pub mod sequence; pub mod split; pub mod unicode_scripts; pub mod whitespace; use serde::{Deserialize, Serialize}; use crate::pre_tokenizers::bert::BertPreTokenizer; use crate::pre_tokenizers::byte_level::Byte...
tokenizers/tokenizers/src/pre_tokenizers/mod.rs/0
{ "file_path": "tokenizers/tokenizers/src/pre_tokenizers/mod.rs", "repo_id": "tokenizers", "token_count": 2430 }
479
python_sources()
llama_index/llama-index-core/llama_index/core/tools/tool_spec/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/tools/tool_spec/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,144
"""Test Baichuan Text Embedding.""" from langchain_community.embeddings.baichuan import BaichuanTextEmbeddings def test_baichuan_embedding_documents() -> None: """Test Baichuan Text Embedding for documents.""" documents = ["今天天气不错", "今天阳光灿烂"] embedding = BaichuanTextEmbeddings() output = embedding.emb...
langchain/libs/community/tests/integration_tests/embeddings/test_baichuan.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/embeddings/test_baichuan.py", "repo_id": "langchain", "token_count": 303 }
329
<?xml version="1.0" encoding="UTF-8"?> <factbook> <country> <name>United States</name> <capital>Washington, DC</capital> <leader>Joe Biden</leader> <sport>Baseball</sport> </country> <country> <name>Canada</name> <capital>Ottawa</capital> <leader>Justin Trudeau</leader> <sport>Hock...
langchain/docs/docs/integrations/document_loaders/example_data/factbook.xml/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/example_data/factbook.xml", "repo_id": "langchain", "token_count": 276 }
110
<jupyter_start><jupyter_text>Xata>[Xata](https://xata.io) is a serverless data platform, based on `PostgreSQL` and `Elasticsearch`. It provides a Python SDK for interacting with your database, and a UI for managing your data. With the `XataChatMessageHistory` class, you can use Xata databases for longer-term persistenc...
langchain/docs/docs/integrations/memory/xata_chat_message_history.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/memory/xata_chat_message_history.ipynb", "repo_id": "langchain", "token_count": 1823 }
127
# neo4j-advanced-rag This template allows you to balance precise embeddings and context retention by implementing advanced retrieval strategies. ## Strategies 1. **Typical RAG**: - Traditional method where the exact data indexed is the data retrieved. 2. **Parent retriever**: - Instead of indexing entire docum...
langchain/templates/neo4j-advanced-rag/README.md/0
{ "file_path": "langchain/templates/neo4j-advanced-rag/README.md", "repo_id": "langchain", "token_count": 1098 }
693
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/roberta.md/0
{ "file_path": "transformers/docs/source/en/model_doc/roberta.md", "repo_id": "transformers", "token_count": 3783 }
463
""" Selective Kernel Networks (ResNet base) Paper: Selective Kernel Networks (https://arxiv.org/abs/1903.06586) This was inspired by reading 'Compounding the Performance Improvements...' (https://arxiv.org/abs/2001.06268) and a streamlined impl at https://github.com/clovaai/assembled-cnn but I ended up building somet...
pytorch-image-models/timm/models/sknet.py/0
{ "file_path": "pytorch-image-models/timm/models/sknet.py", "repo_id": "pytorch-image-models", "token_count": 3801 }
347
// 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/test_utils/indexbuilder_test_utils.h/0
{ "file_path": "milvus/internal/core/unittest/test_utils/indexbuilder_test_utils.h", "repo_id": "milvus", "token_count": 7658 }
1,687
<jupyter_start><jupyter_text>Routing by semantic similarityWith LCEL you can easily add [custom routing logic](/docs/expression_language/how_to/routingusing-a-custom-function) to your chain to dynamically determine the chain logic based on user input. All you need to do is define a function that given an input returns ...
langchain/docs/docs/expression_language/cookbook/embedding_router.ipynb/0
{ "file_path": "langchain/docs/docs/expression_language/cookbook/embedding_router.ipynb", "repo_id": "langchain", "token_count": 833 }
86
from typing import TypeVar from .arrow_dataset import Dataset, _split_by_node_map_style_dataset from .iterable_dataset import IterableDataset, _split_by_node_iterable_dataset DatasetType = TypeVar("DatasetType", Dataset, IterableDataset) def split_dataset_by_node(dataset: DatasetType, rank: int, world_size: int) -...
datasets/src/datasets/distributed.py/0
{ "file_path": "datasets/src/datasets/distributed.py", "repo_id": "datasets", "token_count": 582 }
139
<jupyter_start><jupyter_text>WandB TracingThere are two recommended ways to trace your LangChains:1. Setting the `LANGCHAIN_WANDB_TRACING` environment variable to "true".1. Using a context manager with tracing_enabled() to trace a particular block of code.**Note** if the environment variable is set, all code will be tr...
langchain/docs/docs/integrations/providers/wandb_tracing.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/providers/wandb_tracing.ipynb", "repo_id": "langchain", "token_count": 858 }
152
<jupyter_start><jupyter_text>How to Finetune a cross-encoder using LLamaIndex If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-finetuning-cross-encoders %pip install llama-index-llms-openai !pip install llama-index # Download Requirements !...
llama_index/docs/examples/finetuning/cross_encoder_finetuning/cross_encoder_finetuning.ipynb/0
{ "file_path": "llama_index/docs/examples/finetuning/cross_encoder_finetuning/cross_encoder_finetuning.ipynb", "repo_id": "llama_index", "token_count": 11460 }
1,185
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
transformers/src/transformers/models/idefics/modeling_idefics.py/0
{ "file_path": "transformers/src/transformers/models/idefics/modeling_idefics.py", "repo_id": "transformers", "token_count": 31688 }
698
use crate::tokenizer::{Decoder, Result}; use monostate::MustBe; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Serialize, Deserialize, Default)] /// Fuse simply fuses all tokens into one big string. /// It's usually the last decoding step anyway, but this /// decoder exists incase some decoders need to ha...
tokenizers/tokenizers/src/decoders/fuse.rs/0
{ "file_path": "tokenizers/tokenizers/src/decoders/fuse.rs", "repo_id": "tokenizers", "token_count": 433 }
456
import { BaseChatMessageHistory, BaseListChatMessageHistory, } from "../chat_history.js"; import { AIMessage, BaseMessage, HumanMessage, isBaseMessage, } from "../messages/index.js"; import { Run } from "../tracers/base.js"; import { Runnable, RunnableBinding, type RunnableBindingArgs, RunnableLambd...
langchainjs/langchain-core/src/runnables/history.ts/0
{ "file_path": "langchainjs/langchain-core/src/runnables/history.ts", "repo_id": "langchainjs", "token_count": 2846 }
838
import type { OpenAI as OpenAIClient } from "openai"; import { AsyncCaller } from "@langchain/core/utils/async_caller"; export const promptLayerTrackRequest = async ( callerFunc: AsyncCaller, functionName: string, kwargs: | OpenAIClient.CompletionCreateParams | OpenAIClient.Chat.CompletionCreateParams, ...
langchainjs/langchain/src/util/prompt-layer.ts/0
{ "file_path": "langchainjs/langchain/src/util/prompt-layer.ts", "repo_id": "langchainjs", "token_count": 476 }
947
#!/usr/bin/env python # coding=utf-8 # 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-...
transformers/examples/research_projects/jax-projects/hybrid_clip/run_hybrid_clip.py/0
{ "file_path": "transformers/examples/research_projects/jax-projects/hybrid_clip/run_hybrid_clip.py", "repo_id": "transformers", "token_count": 8853 }
603
"""Test HuggingFace Chat wrapper.""" from importlib import import_module def test_import_class() -> None: """Test that the class can be imported.""" module_name = "langchain_community.chat_models.huggingface" class_name = "ChatHuggingFace" module = import_module(module_name) assert hasattr(module...
langchain/libs/community/tests/unit_tests/chat_models/test_huggingface.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/chat_models/test_huggingface.py", "repo_id": "langchain", "token_count": 109 }
363
"""Notion reader.""" import logging import os from typing import Any, Dict, List, Optional import requests # type: ignore from llama_index.legacy.readers.base import BasePydanticReader from llama_index.legacy.schema import Document INTEGRATION_TOKEN_NAME = "NOTION_INTEGRATION_TOKEN" BLOCK_CHILD_URL_TMPL = "https:/...
llama_index/llama-index-legacy/llama_index/legacy/readers/notion.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/notion.py", "repo_id": "llama_index", "token_count": 3011 }
1,609
<jupyter_start><jupyter_text>Azure ML[Azure ML](https://azure.microsoft.com/en-us/products/machine-learning/) is a platform used to build, train, and deploy machine learning models. Users can explore the types of models to deploy in the Model Catalog, which provides foundational and general purpose models from differen...
langchain/docs/docs/integrations/llms/azure_ml.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/azure_ml.ipynb", "repo_id": "langchain", "token_count": 2853 }
115
"""Integration test for Wikipedia Document Loader.""" from typing import List from langchain_core.documents import Document from langchain_community.document_loaders import WikipediaLoader def assert_docs(docs: List[Document], all_meta: bool = False) -> None: for doc in docs: assert doc.page_content ...
langchain/libs/community/tests/integration_tests/document_loaders/test_wikipedia.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_wikipedia.py", "repo_id": "langchain", "token_count": 653 }
353
python_sources()
llama_index/llama-index-packs/llama-index-packs-dense-x-retrieval/llama_index/packs/dense_x_retrieval/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-dense-x-retrieval/llama_index/packs/dense_x_retrieval/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,666
"""Finetuning script for RAG models. Adapted from examples.seq2seq.finetune.py""" import argparse import copy import json import logging import multiprocessing import os import random import shutil import sys import time from collections import defaultdict from pathlib import Path from typing import Any, Dict, List, T...
transformers/examples/research_projects/rag-end2end-retriever/finetune_rag.py/0
{ "file_path": "transformers/examples/research_projects/rag-end2end-retriever/finetune_rag.py", "repo_id": "transformers", "token_count": 15752 }
585
# CSP-ResNet **CSPResNet** is a convolutional neural network where we apply the Cross Stage Partial Network (CSPNet) approach to [ResNet](https://paperswithcode.com/method/resnet). The CSPNet partitions the feature map of the base layer into two parts and then merges them through a cross-stage hierarchy. The use of a ...
pytorch-image-models/docs/models/csp-resnet.md/0
{ "file_path": "pytorch-image-models/docs/models/csp-resnet.md", "repo_id": "pytorch-image-models", "token_count": 1703 }
350
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.llava_completion import LlavaCompletionPack def test_class(): names_of_base_classes = [b.__name__ for b in LlavaCompletionPack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-llava-completion/tests/test_packs_llava_completion.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-llava-completion/tests/test_packs_llava_completion.py", "repo_id": "llama_index", "token_count": 100 }
1,664
# coding=utf-8 # Copyright 2010, DPR authors, The Hugging Face 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 ...
transformers/src/transformers/models/dpr/configuration_dpr.py/0
{ "file_path": "transformers/src/transformers/models/dpr/configuration_dpr.py", "repo_id": "transformers", "token_count": 2766 }
636
export class ProgressBar { total: number; current: number; barLength: number; format: string; constructor(props: { total: number; format?: string; barLength?: number }) { const { total, format, barLength } = props; this.total = total; this.current = 0; this.barLength = barLength ?? 40; ...
langchainjs/langchain/src/smith/progress.ts/0
{ "file_path": "langchainjs/langchain/src/smith/progress.ts", "repo_id": "langchainjs", "token_count": 676 }
988
# coding=utf-8 # Copyright 2020 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/generation/beam_search.py/0
{ "file_path": "transformers/src/transformers/generation/beam_search.py", "repo_id": "transformers", "token_count": 22653 }
594
import { Client } from "langsmith"; import { LangChainTracer } from "../../tracers/tracer_langchain.js"; import { BaseOutputParser, FormatInstructionsOptions, } from "../../output_parsers/base.js"; import { FakeChatModel } from "../../utils/testing/index.js"; import { getEnvironmentVariable } from "../../utils/env....
langchainjs/langchain-core/src/runnables/tests/runnable_tracing.int.test.ts/0
{ "file_path": "langchainjs/langchain-core/src/runnables/tests/runnable_tracing.int.test.ts", "repo_id": "langchainjs", "token_count": 366 }
833
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ko/tf_xla.md/0
{ "file_path": "transformers/docs/source/ko/tf_xla.md", "repo_id": "transformers", "token_count": 6205 }
530
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.gradio_agent_chat import GradioAgentChatPack def test_class(): names_of_base_classes = [b.__name__ for b in GradioAgentChatPack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-gradio-agent-chat/tests/test_packs_gradio_agent_chat.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-gradio-agent-chat/tests/test_packs_gradio_agent_chat.py", "repo_id": "llama_index", "token_count": 101 }
1,658
# Wolfram Alpha >[WolframAlpha](https://en.wikipedia.org/wiki/WolframAlpha) is an answer engine developed by `Wolfram Research`. > It answers factual queries by computing answers from externally sourced data. This page covers how to use the `Wolfram Alpha API` within LangChain. ## Installation and Setup - Install r...
langchain/docs/docs/integrations/providers/wolfram_alpha.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/wolfram_alpha.mdx", "repo_id": "langchain", "token_count": 334 }
154
import tempfile from typing import Generator, cast import pytest from langchain_core.documents import Document from langchain.storage._lc_store import create_kv_docstore, create_lc_store from langchain.storage.file_system import LocalFileStore @pytest.fixture def file_store() -> Generator[LocalFileStore, None, None...
langchain/libs/langchain/tests/unit_tests/storage/test_lc_store.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/storage/test_lc_store.py", "repo_id": "langchain", "token_count": 483 }
635
python_tests()
llama_index/llama-index-integrations/tools/llama-index-tools-arxiv/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-arxiv/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,475
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/yoso/test_modeling_yoso.py/0
{ "file_path": "transformers/tests/models/yoso/test_modeling_yoso.py", "repo_id": "transformers", "token_count": 7199 }
747
use pyo3::prelude::*; use tk::Token; #[pyclass(module = "tokenizers", name = "Token")] #[derive(Clone)] pub struct PyToken { token: Token, } impl From<Token> for PyToken { fn from(token: Token) -> Self { Self { token } } } impl From<PyToken> for Token { fn from(token: PyToken) -> Self { ...
tokenizers/bindings/python/src/token.rs/0
{ "file_path": "tokenizers/bindings/python/src/token.rs", "repo_id": "tokenizers", "token_count": 439 }
445
<jupyter_start><jupyter_text>Manipulation de plusieurs séquences (PyTorch) Installez la bibliothèque 🤗 *Transformers* pour exécuter ce *notebook*.<jupyter_code>!pip install transformers[sentencepiece] import torch from transformers import AutoTokenizer, AutoModelForSequenceClassification checkpoint = "tblard/tf-alloc...
notebooks/course/fr/chapter2/section5_pt.ipynb/0
{ "file_path": "notebooks/course/fr/chapter2/section5_pt.ipynb", "repo_id": "notebooks", "token_count": 814 }
284
export * from "./retrievers.js"; export * from "./tools.js";
langchainjs/libs/langchain-exa/src/index.ts/0
{ "file_path": "langchainjs/libs/langchain-exa/src/index.ts", "repo_id": "langchainjs", "token_count": 22 }
977
# LlamaIndex Readers Integration: Wikipedia
llama_index/llama-index-integrations/readers/llama-index-readers-wikipedia/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-wikipedia/README.md", "repo_id": "llama_index", "token_count": 9 }
1,397
python_tests( interpreter_constraints=["==3.9.*", "==3.10.*"], )
llama_index/llama-index-integrations/tools/llama-index-tools-text-to-image/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-text-to-image/tests/BUILD", "repo_id": "llama_index", "token_count": 29 }
1,459
#!/usr/bin/env bash # 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 r...
transformers/scripts/fsmt/convert-facebook-wmt19.sh/0
{ "file_path": "transformers/scripts/fsmt/convert-facebook-wmt19.sh", "repo_id": "transformers", "token_count": 1121 }
545