text stringlengths 3 1.68M | id stringlengths 13 169 | metadata dict | __index_level_0__ int64 0 2.21k |
|---|---|---|---|
from llama_index.packs.multi_tenancy_rag.base import MultiTenancyRAGPack
__all__ = ["MultiTenancyRAGPack"]
| llama_index/llama-index-packs/llama-index-packs-multi-tenancy-rag/llama_index/packs/multi_tenancy_rag/__init__.py/0 | {
"file_path": "llama_index/llama-index-packs/llama-index-packs-multi-tenancy-rag/llama_index/packs/multi_tenancy_rag/__init__.py",
"repo_id": "llama_index",
"token_count": 36
} | 1,680 |
import { VectorStore } from "@langchain/core/vectorstores";
import {
Comparator,
Comparators,
Comparison,
Operation,
Operator,
Operators,
StructuredQuery,
Visitor,
VisitorComparisonResult,
VisitorOperationResult,
VisitorResult,
VisitorStructuredQueryResult,
} from "../../chains/query_constructor... | langchainjs/langchain/src/retrievers/self_query/base.ts/0 | {
"file_path": "langchainjs/langchain/src/retrievers/self_query/base.ts",
"repo_id": "langchainjs",
"token_count": 2073
} | 944 |
// 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/proxy/service_test.go/0 | {
"file_path": "milvus/internal/distributed/proxy/service_test.go",
"repo_id": "milvus",
"token_count": 16465
} | 1,934 |
<jupyter_start><jupyter_text>MyScale Vector StoreIn this notebook we are going to show a quick demo of using the MyScaleVectorStore. If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-vector-stores-myscale
!pip install llama-index<jupyter_out... | llama_index/docs/examples/vector_stores/MyScaleIndexDemo.ipynb/0 | {
"file_path": "llama_index/docs/examples/vector_stores/MyScaleIndexDemo.ipynb",
"repo_id": "llama_index",
"token_count": 1176
} | 1,147 |
# 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/models/transformers/test_models_prior.py/0 | {
"file_path": "diffusers/tests/models/transformers/test_models_prior.py",
"repo_id": "diffusers",
"token_count": 2766
} | 284 |
// 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/segments/collection.go/0 | {
"file_path": "milvus/internal/querynodev2/segments/collection.go",
"repo_id": "milvus",
"token_count": 2710
} | 1,841 |
# coding=utf-8
# Copyright 2018 T5 Authors and 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... | transformers/src/transformers/models/t5/tokenization_t5.py/0 | {
"file_path": "transformers/src/transformers/models/t5/tokenization_t5.py",
"repo_id": "transformers",
"token_count": 8895
} | 752 |
export {
compare,
type Operation,
applyPatch,
} from "./fast-json-patch/index.js";
| langchainjs/langchain-core/src/utils/json_patch.ts/0 | {
"file_path": "langchainjs/langchain-core/src/utils/json_patch.ts",
"repo_id": "langchainjs",
"token_count": 32
} | 909 |
from langchain_community.tools.youtube.search import YouTubeSearchTool
__all__ = ["YouTubeSearchTool"]
| langchain/libs/langchain/langchain/tools/youtube/search.py/0 | {
"file_path": "langchain/libs/langchain/langchain/tools/youtube/search.py",
"repo_id": "langchain",
"token_count": 27
} | 614 |
<jupyter_start><jupyter_text>Exploring OpenAI V1 functionalityOn 11.06.23 OpenAI released a number of new features, and along with it bumped their Python SDK to 1.0.0. This notebook shows off the new features and how to use them with LangChain.<jupyter_code># need openai>=1.1.0, langchain>=0.0.335, langchain-experiment... | langchain/cookbook/openai_v1_cookbook.ipynb/0 | {
"file_path": "langchain/cookbook/openai_v1_cookbook.ipynb",
"repo_id": "langchain",
"token_count": 3123
} | 80 |
python_tests()
| llama_index/llama-index-integrations/tools/llama-index-tools-requests/tests/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-requests/tests/BUILD",
"repo_id": "llama_index",
"token_count": 5
} | 1,499 |
<jupyter_start><jupyter_text>AmadeusThis notebook walks you through connecting LangChain to the `Amadeus` travel APIs.This `Amadeus` toolkit allows agents to make decision when it comes to travel, especially searching and booking trips with flights.To use this toolkit, you will need to have your Amadeus API keys ready,... | langchain/docs/docs/integrations/toolkits/amadeus.ipynb/0 | {
"file_path": "langchain/docs/docs/integrations/toolkits/amadeus.ipynb",
"repo_id": "langchain",
"token_count": 1212
} | 180 |
<jupyter_start><jupyter_text>IntroductionIn this notebook, we will learn how to use [LoRA](https://arxiv.org/abs/2106.09685) from 🤗 PEFT to fine-tune a SegFormer model variant for semantic segmentation by ONLY using **14%** of the original trainable parameters of the model. LoRA adds low-rank "update matrices" to cert... | peft/examples/semantic_segmentation/semantic_segmentation_peft_lora.ipynb/0 | {
"file_path": "peft/examples/semantic_segmentation/semantic_segmentation_peft_lora.ipynb",
"repo_id": "peft",
"token_count": 8322
} | 331 |
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js";
/* #__PURE__ */ logVersion010MigrationWarning({
oldEntrypointName: "cache/upstash_redis",
newEntrypointName: "caches/upstash_redis",
});
export * from "@langchain/community/caches/upstash_redis";
| langchainjs/langchain/src/cache/upstash_redis.ts/0 | {
"file_path": "langchainjs/langchain/src/cache/upstash_redis.ts",
"repo_id": "langchainjs",
"token_count": 97
} | 876 |
MIME-Version: 1.0
Date: Fri, 23 Dec 2022 12:08:48 -0600
Message-ID: <CAPgNNXSzLVJ-d1OCX_TjFgJU7ugtQrjFybPtAMmmYZzphxNFYg@mail.gmail.com>
Subject: Fake email with attachment
From: Mallori Harrell <mallori@unstructured.io>
To: Mallori Harrell <mallori@unstructured.io>
Content-Type: multipart/mixed; boundary="000000000000... | langchain/libs/community/tests/integration_tests/examples/fake-email-attachment.eml/0 | {
"file_path": "langchain/libs/community/tests/integration_tests/examples/fake-email-attachment.eml",
"repo_id": "langchain",
"token_count": 697
} | 365 |
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core"]
[tool.codespell]
check-filenames = true
check-hidden = true
ignore-words-list = "Gere"
skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb"
[tool.llamahub]
classes = ["WandbCallbackHandler"]
contains_example = false
import_path = ... | llama_index/llama-index-integrations/callbacks/llama-index-callbacks-wandb/pyproject.toml/0 | {
"file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-wandb/pyproject.toml",
"repo_id": "llama_index",
"token_count": 661
} | 1,298 |
"""Conftest."""
from typing import List
import pytest
from llama_index.core.schema import Document
@pytest.fixture()
def documents() -> List[Document]:
"""Get documents."""
# NOTE: one document for now
doc_text = (
"Hello world.\n"
"This is a test.\n"
"This is another test.\n"
... | llama_index/llama-index-core/tests/tools/conftest.py/0 | {
"file_path": "llama_index/llama-index-core/tests/tools/conftest.py",
"repo_id": "llama_index",
"token_count": 162
} | 1,330 |
---
hide_table_of_contents: true
---
import CodeBlock from "@theme/CodeBlock";
# Upstash Redis-Backed Chat Memory
Because Upstash Redis works via a REST API, you can use this with [Vercel Edge](https://vercel.com/docs/concepts/functions/edge-functions/edge-runtime), [Cloudflare Workers](https://developers.cloudflare... | langchainjs/docs/core_docs/docs/integrations/chat_memory/upstash_redis.mdx/0 | {
"file_path": "langchainjs/docs/core_docs/docs/integrations/chat_memory/upstash_redis.mdx",
"repo_id": "langchainjs",
"token_count": 574
} | 701 |
# Module Usage
Currently the following LlamaIndex modules are supported within a QueryPipeline. Remember, you can define your own!
### LLMs (both completion and chat)
- Base class: `LLM`
- [Module Guide](/module_guides/models/llms.md)
- If chat model:
- Input: `messages`. Takes in any `List[ChatMessage]` or any st... | llama_index/docs/module_guides/querying/pipeline/module_usage.md/0 | {
"file_path": "llama_index/docs/module_guides/querying/pipeline/module_usage.md",
"repo_id": "llama_index",
"token_count": 788
} | 1,104 |
{
"compilerOptions": {
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleRe... | auto-evaluator/nextjs/tsconfig.json/0 | {
"file_path": "auto-evaluator/nextjs/tsconfig.json",
"repo_id": "auto-evaluator",
"token_count": 261
} | 5 |
import array
from uuid import UUID
from typing import Dict, Optional, Tuple, Union, cast
from chromadb.api.types import Embedding
import chromadb.proto.chroma_pb2 as proto
from chromadb.utils.messageid import bytes_to_int, int_to_bytes
from chromadb.types import (
Collection,
EmbeddingRecord,
Metadata,
... | chroma/chromadb/proto/convert.py/0 | {
"file_path": "chroma/chromadb/proto/convert.py",
"repo_id": "chroma",
"token_count": 3953
} | 18 |
import base64
import re
from typing import Any, Iterator
from langchain_core.chat_sessions import ChatSession
from langchain_core.messages import HumanMessage
from langchain_community.chat_loaders.base import BaseChatLoader
def _extract_email_content(msg: Any) -> HumanMessage:
from_email = None
for values i... | langchain/libs/community/langchain_community/chat_loaders/gmail.py/0 | {
"file_path": "langchain/libs/community/langchain_community/chat_loaders/gmail.py",
"repo_id": "langchain",
"token_count": 1641
} | 233 |
<jupyter_start><jupyter_text>Qdrant Sparse Vector Retriever>[Qdrant](https://qdrant.tech/) is an open-source, high-performance vector search engine/database.>`QdrantSparseVectorRetriever` uses [sparse vectors](https://qdrant.tech/articles/sparse-vectors/) introduced in Qdrant [v1.7.0](https://qdrant.tech/articles/qdran... | langchain/docs/docs/integrations/retrievers/qdrant-sparse.ipynb/0 | {
"file_path": "langchain/docs/docs/integrations/retrievers/qdrant-sparse.ipynb",
"repo_id": "langchain",
"token_count": 1406
} | 168 |
# Copyright 2024 Alibaba DAMO-VILAB and The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | diffusers/src/diffusers/models/unets/unet_i2vgen_xl.py/0 | {
"file_path": "diffusers/src/diffusers/models/unets/unet_i2vgen_xl.py",
"repo_id": "diffusers",
"token_count": 14062
} | 232 |
from typing import Callable
from unittest import mock
from llama_index.legacy.llm_predictor.vellum import (
VellumCompiledPrompt,
VellumPromptRegistry,
VellumRegisteredPrompt,
)
from llama_index.legacy.prompts.base import PromptTemplate
def test_from_prompt__new(
mock_vellum_client_factory: Callable[... | llama_index/llama-index-legacy/tests/llm_predictor/vellum/test_prompt_registry.py/0 | {
"file_path": "llama_index/llama-index-legacy/tests/llm_predictor/vellum/test_prompt_registry.py",
"repo_id": "llama_index",
"token_count": 1113
} | 1,806 |
from langchain import tools
from tests.unit_tests import assert_all_importable
EXPECTED_ALL = [
"AINAppOps",
"AINOwnerOps",
"AINRuleOps",
"AINTransfer",
"AINValueOps",
"AIPluginTool",
"APIOperation",
"ArxivQueryRun",
"AzureCogsFormRecognizerTool",
"AzureCogsImageAnalysisTool",
... | langchain/libs/langchain/tests/unit_tests/tools/test_imports.py/0 | {
"file_path": "langchain/libs/langchain/tests/unit_tests/tools/test_imports.py",
"repo_id": "langchain",
"token_count": 1353
} | 676 |
#![allow(unused)]
//! Wrappers around the Python API of Gymnasium (the new version of OpenAI gym)
use candle::{Device, Result, Tensor};
use pyo3::prelude::*;
use pyo3::types::PyDict;
/// The return value for a step.
#[derive(Debug)]
pub struct Step<A> {
pub state: Tensor,
pub action: A,
pub reward: f64,
... | candle/candle-examples/examples/reinforcement-learning/gym_env.rs/0 | {
"file_path": "candle/candle-examples/examples/reinforcement-learning/gym_env.rs",
"repo_id": "candle",
"token_count": 1716
} | 44 |
"""Generic utility functions."""
import contextlib
import enum
import functools
import logging
import os
import subprocess
import threading
from typing import (
Any,
Callable,
Dict,
Generator,
List,
Mapping,
Optional,
Sequence,
Tuple,
Union,
)
import requests
from urllib3.util ... | langsmith-sdk/python/langsmith/utils.py/0 | {
"file_path": "langsmith-sdk/python/langsmith/utils.py",
"repo_id": "langsmith-sdk",
"token_count": 4561
} | 1,081 |
#![allow(dead_code)]
//! # Diffusion pipelines and models
//!
//! Noise schedulers can be used to set the trade-off between
//! inference speed and quality.
use candle::{Result, Tensor};
pub trait SchedulerConfig: std::fmt::Debug {
fn build(&self, inference_steps: usize) -> Result<Box<dyn Scheduler>>;
}
/// This ... | candle/candle-transformers/src/models/stable_diffusion/schedulers.rs/0 | {
"file_path": "candle/candle-transformers/src/models/stable_diffusion/schedulers.rs",
"repo_id": "candle",
"token_count": 930
} | 76 |
import { OpenAIModerationChain, LLMChain } from "langchain/chains";
import { OpenAI } from "@langchain/openai";
import { PromptTemplate } from "@langchain/core/prompts";
// A string containing potentially offensive content from the user
const badString = "Bad naughty words from user";
try {
// Create a new instance... | langchainjs/examples/src/chains/openai_moderation.ts/0 | {
"file_path": "langchainjs/examples/src/chains/openai_moderation.ts",
"repo_id": "langchainjs",
"token_count": 452
} | 792 |
from transformers import DonutProcessor, VisionEncoderDecoderModel
import torch
device = "cuda" if torch.cuda.is_available() else "cpu"
def model_fn(model_dir):
# Load our model from Hugging Face
processor = DonutProcessor.from_pretrained(model_dir)
model = VisionEncoderDecoderModel.from_pretrained(model_... | notebooks/sagemaker/26_document_ai_donut/scripts/inference.py/0 | {
"file_path": "notebooks/sagemaker/26_document_ai_donut/scripts/inference.py",
"repo_id": "notebooks",
"token_count": 571
} | 322 |
<jupyter_start><jupyter_text><jupyter_code>!pip install transformers
!sudo apt-get install git-lfs
!git config --global user.email "julien@huggingface.co"
!git config --global user.name "Julien Chaumond"
!transformers-cli login
!pwd
!transformers-cli repo create policy-distilbert-7d
!git clone https://julien-c:...token... | notebooks/huggingface_hub/upload_hf_model.ipynb/0 | {
"file_path": "notebooks/huggingface_hub/upload_hf_model.ipynb",
"repo_id": "notebooks",
"token_count": 478
} | 315 |
# 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... | accelerate/tests/test_kwargs_handlers.py/0 | {
"file_path": "accelerate/tests/test_kwargs_handlers.py",
"repo_id": "accelerate",
"token_count": 2225
} | 18 |
# Testcases All-in-one
# pod kill
# standalone
# 3 pods(standalone-ha-blabla, etcd, minio)
# cluster-1-node
# 11 pods(proxy, rootcoord, querynode, querycoord, datanode, datacoord,
# indexnode, indexcoord, pulsar, etcd, minio)
# cluster-n-nodes
# 11 pods* n: kill one and kil... | milvus/tests/python_client/chaos/chaos_objects/container_kill/testcases.yaml/0 | {
"file_path": "milvus/tests/python_client/chaos/chaos_objects/container_kill/testcases.yaml",
"repo_id": "milvus",
"token_count": 398
} | 2,162 |
import importlib
import os
import pickle
import shutil
import tempfile
import time
from hashlib import sha256
from multiprocessing import Pool
from pathlib import Path
from unittest import TestCase
from unittest.mock import patch
import dill
import pyarrow as pa
import pytest
import requests
import datasets
from data... | datasets/tests/test_load.py/0 | {
"file_path": "datasets/tests/test_load.py",
"repo_id": "datasets",
"token_count": 33521
} | 155 |
<!---
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 applicable law or ... | transformers/examples/pytorch/audio-classification/README.md/0 | {
"file_path": "transformers/examples/pytorch/audio-classification/README.md",
"repo_id": "transformers",
"token_count": 2212
} | 575 |
#!/bin/bash
for FILE in converted/*; do
model_name=`basename $FILE`
huggingface-cli repo create $model_name -y
git clone https://huggingface.co/Helsinki-NLP/$model_name
mv $FILE/* $model_name/
cd $model_name
git add . && git commit -m "initial commit"
git push
cd ..
done
| transformers/scripts/tatoeba/upload_models.sh/0 | {
"file_path": "transformers/scripts/tatoeba/upload_models.sh",
"repo_id": "transformers",
"token_count": 109
} | 587 |
python_sources()
| llama_index/llama-index-packs/llama-index-packs-resume-screener/llama_index/packs/resume_screener/BUILD/0 | {
"file_path": "llama_index/llama-index-packs/llama-index-packs-resume-screener/llama_index/packs/resume_screener/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,696 |
#!/bin/bash
#SBATCH --job-name=multinode
#SBATCH -D .
#SBATCH --output=O-%x.%j
#SBATCH --error=E-%x.%j
#SBATCH --nodes=4 # number of nodes
#SBATCH --ntasks-per-node=1 # number of MP tasks
#SBATCH --gres=gpu:4 # number of GPUs per node
#SBATCH --cpus-per-task=160 # numbe... | accelerate/examples/slurm/submit_multinode.sh/0 | {
"file_path": "accelerate/examples/slurm/submit_multinode.sh",
"repo_id": "accelerate",
"token_count": 519
} | 11 |
//! VGG-16 model implementation.
//!
//! See Very Deep Convolutional Networks for Large-Scale Image Recognition
//! <https://arxiv.org/abs/1409.1556>
use candle::{ModuleT, Result, Tensor};
use candle_nn::{FuncT, VarBuilder};
// Enum representing the different VGG models
pub enum Models {
Vgg13,
Vgg16,
Vgg1... | candle/candle-transformers/src/models/vgg.rs/0 | {
"file_path": "candle/candle-transformers/src/models/vgg.rs",
"repo_id": "candle",
"token_count": 4303
} | 77 |
// 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/datacoord/client/client_test.go/0 | {
"file_path": "milvus/internal/distributed/datacoord/client/client_test.go",
"repo_id": "milvus",
"token_count": 24360
} | 1,813 |
---
sidebar_position: 0
---
# String output parser
The `StringOutputParser` takes language model output (either an entire response or as a stream) and converts
it into a string. This is useful for standardizing chat model and LLM output.
This output parser can act as a transform stream and work with streamed respons... | langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/types/string.mdx/0 | {
"file_path": "langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/types/string.mdx",
"repo_id": "langchainjs",
"token_count": 200
} | 764 |
"""Lilac reader that loads enriched and labeled Lilac datasets into GPTIndex and LangChain."""
from typing import TYPE_CHECKING, List, Optional
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
if TYPE_CHECKING:
from lilac import ColumnId, FilterLike, Path
class L... | llama_index/llama-index-integrations/readers/llama-index-readers-lilac/llama_index/readers/lilac/base.py/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-lilac/llama_index/readers/lilac/base.py",
"repo_id": "llama_index",
"token_count": 1833
} | 1,391 |
from __future__ import annotations
import logging
from typing import Any, Dict, List, Optional
from langchain_core.callbacks import CallbackManagerForToolRun
from langchain_core.pydantic_v1 import root_validator
from langchain_core.tools import BaseTool
from langchain_core.utils import get_from_dict_or_env
from lang... | langchain/libs/community/langchain_community/tools/azure_cognitive_services/form_recognizer.py/0 | {
"file_path": "langchain/libs/community/langchain_community/tools/azure_cognitive_services/form_recognizer.py",
"repo_id": "langchain",
"token_count": 2355
} | 302 |
export interface SerializedFields {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}
| langchainjs/libs/langchain-community/src/load/map_keys.ts/0 | {
"file_path": "langchainjs/libs/langchain-community/src/load/map_keys.ts",
"repo_id": "langchainjs",
"token_count": 46
} | 988 |
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | diffusers/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_img2img.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_img2img.py",
"repo_id": "diffusers",
"token_count": 7964
} | 261 |
# 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/wav2vec2_conformer/test_modeling_wav2vec2_conformer.py/0 | {
"file_path": "transformers/tests/models/wav2vec2_conformer/test_modeling_wav2vec2_conformer.py",
"repo_id": "transformers",
"token_count": 17966
} | 824 |
import itertools
from dataclasses import dataclass
from typing import Optional
import pyarrow as pa
import datasets
from datasets.table import table_cast
logger = datasets.utils.logging.get_logger(__name__)
@dataclass
class ArrowConfig(datasets.BuilderConfig):
"""BuilderConfig for Arrow."""
features: Opt... | datasets/src/datasets/packaged_modules/arrow/arrow.py/0 | {
"file_path": "datasets/src/datasets/packaged_modules/arrow/arrow.py",
"repo_id": "datasets",
"token_count": 1473
} | 143 |
// 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/primary_key.go/0 | {
"file_path": "milvus/internal/storage/primary_key.go",
"repo_id": "milvus",
"token_count": 3487
} | 1,930 |
"""Integration test for Bing Search API Wrapper."""
from langchain_community.utilities.bing_search import BingSearchAPIWrapper
def test_call() -> None:
"""Test that call gives the correct answer."""
search = BingSearchAPIWrapper()
output = search.run("Obama's first name")
assert "Barack Hussein Obama"... | langchain/libs/community/tests/integration_tests/utilities/test_bing_search.py/0 | {
"file_path": "langchain/libs/community/tests/integration_tests/utilities/test_bing_search.py",
"repo_id": "langchain",
"token_count": 216
} | 347 |
Elastic License 2.0 (ELv2)
**Acceptance**
By using the software, you agree to all of the terms and conditions below.
**Copyright License**
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative work... | auto-evaluator/LICENSE/0 | {
"file_path": "auto-evaluator/LICENSE",
"repo_id": "auto-evaluator",
"token_count": 810
} | 0 |
# SvelteKit
If you're looking to use LangChain in a [SvelteKit](https://kit.svelte.dev/) project, you can check out [svelte-chat-langchain](https://github.com/SimonPrammer/svelte-chat-langchain).
The app is a SvelteKit implementation of the QA Chatbot [Chat Langchain](https://github.com/langchain-ai/chat-langchain) a... | langchainjs/docs/core_docs/docs/guides/deployment/sveltekit.mdx/0 | {
"file_path": "langchainjs/docs/core_docs/docs/guides/deployment/sveltekit.mdx",
"repo_id": "langchainjs",
"token_count": 293
} | 719 |
import { ChatOpenAI } from "@langchain/openai";
import { PromptTemplate } from "@langchain/core/prompts";
const prompt = PromptTemplate.fromTemplate(`Tell me a joke about {subject}`);
const model = new ChatOpenAI({});
const chain = prompt.pipe(model.bind({ stop: ["\n"] }));
const result = await chain.invoke({ subje... | langchainjs/examples/src/guides/expression_language/cookbook_stop_sequence.ts/0 | {
"file_path": "langchainjs/examples/src/guides/expression_language/cookbook_stop_sequence.ts",
"repo_id": "langchainjs",
"token_count": 140
} | 805 |
/*!
**************************************************************************************************
* Deformable DETR
* Copyright (c) 2020 SenseTime. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 [see LICENSE for details]
***********************************************************************... | transformers/src/transformers/kernels/deformable_detr/cuda/ms_deform_attn_cuda.cu/0 | {
"file_path": "transformers/src/transformers/kernels/deformable_detr/cuda/ms_deform_attn_cuda.cu",
"repo_id": "transformers",
"token_count": 3180
} | 611 |
from functools import partial
from typing import Any, Dict, List, Optional, Sequence
from langchain_core.callbacks import (
AsyncCallbackManagerForLLMRun,
CallbackManagerForLLMRun,
)
from langchain_core.language_models.llms import LLM
from langchain_core.pydantic_v1 import root_validator
class CTransformers(... | langchain/libs/community/langchain_community/llms/ctransformers.py/0 | {
"file_path": "langchain/libs/community/langchain_community/llms/ctransformers.py",
"repo_id": "langchain",
"token_count": 1828
} | 267 |
# coding=utf-8
# Copyright 2023 The Fairseq Authors, Microsoft Research, and the HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www... | transformers/src/transformers/models/speecht5/number_normalizer.py/0 | {
"file_path": "transformers/src/transformers/models/speecht5/number_normalizer.py",
"repo_id": "transformers",
"token_count": 3534
} | 662 |
# 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/conftest.py/0 | {
"file_path": "transformers/conftest.py",
"repo_id": "transformers",
"token_count": 994
} | 489 |
# coding=utf-8
# Copyright 2023 The HuggingFace Team 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 clone of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/tests/generation/test_streamers.py/0 | {
"file_path": "transformers/tests/generation/test_streamers.py",
"repo_id": "transformers",
"token_count": 2340
} | 780 |
# Model arguments
model_name_or_path: mistralai/Mistral-7B-v0.1
model_revision: main
torch_dtype: bfloat16
use_flash_attention_2: true
# Data training arguments
dataset_mixer:
HuggingFaceH4/ultrachat_200k: 1.0
dataset_splits:
- train_sft
- test_sft
preprocessing_num_workers: 12
# SFT trainer config
bf16: true
do_ev... | alignment-handbook/tests/fixtures/config_sft_full.yaml/0 | {
"file_path": "alignment-handbook/tests/fixtures/config_sft_full.yaml",
"repo_id": "alignment-handbook",
"token_count": 357
} | 27 |
"""Weaviate Vector store index.
An index that is built on top of an existing vector store.
"""
import logging
from typing import Any, Dict, List, Optional, cast
from uuid import uuid4
from llama_index.core.bridge.pydantic import Field, PrivateAttr
from llama_index.core.schema import BaseNode
from llama_index.core.v... | llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/llama_index/vector_stores/weaviate/base.py/0 | {
"file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/llama_index/vector_stores/weaviate/base.py",
"repo_id": "llama_index",
"token_count": 5194
} | 1,543 |
from typing import Iterator, List
import pytest
from . import is_libcublas_available
@pytest.fixture(scope="module", autouse=True)
def check_spacy_model() -> Iterator[None]:
import spacy
if not spacy.util.is_package("en_core_web_lg"):
pytest.skip(reason="Spacy model 'en_core_web_lg' not installed")... | langchain/libs/experimental/tests/unit_tests/test_data_anonymizer.py/0 | {
"file_path": "langchain/libs/experimental/tests/unit_tests/test_data_anonymizer.py",
"repo_id": "langchain",
"token_count": 3010
} | 428 |
"""Context retriever agent."""
from typing import List, Optional, Type, Union
from llama_index.agent.openai_legacy.openai_agent import (
DEFAULT_MAX_FUNCTION_CALLS,
BaseOpenAIAgent,
)
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.base.llms.types import ChatMessage
from l... | llama_index/llama-index-integrations/agent/llama-index-agent-openai-legacy/llama_index/agent/openai_legacy/context_retriever_agent.py/0 | {
"file_path": "llama_index/llama-index-integrations/agent/llama-index-agent-openai-legacy/llama_index/agent/openai_legacy/context_retriever_agent.py",
"repo_id": "llama_index",
"token_count": 3134
} | 1,287 |
import tempfile
import torch
from diffusers import (
DEISMultistepScheduler,
DPMSolverMultistepScheduler,
DPMSolverSinglestepScheduler,
UniPCMultistepScheduler,
)
from .test_schedulers import SchedulerCommonTest
class UniPCMultistepSchedulerTest(SchedulerCommonTest):
scheduler_classes = (UniPCM... | diffusers/tests/schedulers/test_scheduler_unipc.py/0 | {
"file_path": "diffusers/tests/schedulers/test_scheduler_unipc.py",
"repo_id": "diffusers",
"token_count": 6988
} | 300 |
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/python-3
{
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
"customizations": {
"codespaces": {
"op... | streamlit-agent/.devcontainer/devcontainer.json/0 | {
"file_path": "streamlit-agent/.devcontainer/devcontainer.json",
"repo_id": "streamlit-agent",
"token_count": 717
} | 1,926 |
from typing import Any, Dict, Optional, Sequence
from llama_index.legacy.core.base_selector import (
BaseSelector,
MultiSelection,
SelectorResult,
SingleSelection,
)
from llama_index.legacy.llms.openai import OpenAI
from llama_index.legacy.program.openai_program import OpenAIPydanticProgram
from llama_... | llama_index/llama-index-legacy/llama_index/legacy/selectors/pydantic_selectors.py/0 | {
"file_path": "llama_index/llama-index-legacy/llama_index/legacy/selectors/pydantic_selectors.py",
"repo_id": "llama_index",
"token_count": 2109
} | 1,641 |
import { Ollama } from "@langchain/community/llms/ollama";
import * as fs from "node:fs/promises";
const imageData = await fs.readFile("./hotdog.jpg");
const model = new Ollama({
model: "llava",
baseUrl: "http://127.0.0.1:11434",
}).bind({
images: [imageData.toString("base64")],
});
const res = await model.invok... | langchainjs/examples/src/models/llm/ollama_multimodal.ts/0 | {
"file_path": "langchainjs/examples/src/models/llm/ollama_multimodal.ts",
"repo_id": "langchainjs",
"token_count": 189
} | 855 |
# coding=utf-8
# Copyright 2018 Google T5 Authors and 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 requ... | transformers/tests/models/t5/test_modeling_t5.py/0 | {
"file_path": "transformers/tests/models/t5/test_modeling_t5.py",
"repo_id": "transformers",
"token_count": 34412
} | 827 |
import type { ObjectId } from "mongodb";
import type { Conversation } from "./Conversation";
import type { Timestamps } from "./Timestamps";
export interface WebSearch extends Timestamps {
_id?: ObjectId;
convId?: Conversation["_id"];
prompt: string;
searchQuery: string;
results: WebSearchSource[];
context: st... | chat-ui/src/lib/types/WebSearch.ts/0 | {
"file_path": "chat-ui/src/lib/types/WebSearch.ts",
"repo_id": "chat-ui",
"token_count": 306
} | 111 |
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core"]
[tool.codespell]
check-filenames = true
check-hidden = true
skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb"
[tool.llamahub]
classes = ["GraphQLReader"]
contains_example = false
import_path = "llama_index.readers.graphql"
[to... | llama_index/llama-index-integrations/readers/llama-index-readers-graphql/pyproject.toml/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-graphql/pyproject.toml",
"repo_id": "llama_index",
"token_count": 684
} | 1,506 |
"""Test LLM Math functionality."""
import json
from typing import Any
import pytest
from langchain_community.utilities.requests import TextRequestsWrapper
from langchain.chains.api.base import APIChain
from langchain.chains.api.prompt import API_RESPONSE_PROMPT, API_URL_PROMPT
from langchain.chains.llm import LLMCha... | langchain/libs/langchain/tests/unit_tests/chains/test_api.py/0 | {
"file_path": "langchain/libs/langchain/tests/unit_tests/chains/test_api.py",
"repo_id": "langchain",
"token_count": 1399
} | 595 |
"""Init file."""
| llama_index/llama-index-core/tests/indices/vector_store/__init__.py/0 | {
"file_path": "llama_index/llama-index-core/tests/indices/vector_store/__init__.py",
"repo_id": "llama_index",
"token_count": 6
} | 1,209 |
python_sources()
| llama_index/llama-index-integrations/readers/llama-index-readers-reddit/llama_index/readers/reddit/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-reddit/llama_index/readers/reddit/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,364 |
from langchain_community.chat_models.vertexai import (
ChatVertexAI,
)
__all__ = [
"ChatVertexAI",
]
| langchain/libs/langchain/langchain/chat_models/vertexai.py/0 | {
"file_path": "langchain/libs/langchain/langchain/chat_models/vertexai.py",
"repo_id": "langchain",
"token_count": 46
} | 497 |
import { SonixAudioTranscriptionLoader } from "langchain/document_loaders/web/sonix_audio";
const loader = new SonixAudioTranscriptionLoader({
sonixAuthKey: "SONIX_AUTH_KEY",
request: {
audioFilePath: "LOCAL_AUDIO_FILE_PATH",
fileName: "FILE_NAME",
language: "en",
},
});
const docs = await loader.lo... | langchainjs/examples/src/document_loaders/sonix_audio_transcription.ts/0 | {
"file_path": "langchainjs/examples/src/document_loaders/sonix_audio_transcription.ts",
"repo_id": "langchainjs",
"token_count": 124
} | 856 |
<!--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/tasks_explained.md/0 | {
"file_path": "transformers/docs/source/ko/tasks_explained.md",
"repo_id": "transformers",
"token_count": 25797
} | 557 |
<jupyter_start><jupyter_text>Azure OpenAIThis notebook goes over how to use Langchain with [Azure OpenAI](https://aka.ms/azure-openai).The Azure OpenAI API is compatible with OpenAI's API. The `openai` Python package makes it easy to use both OpenAI and Azure OpenAI. You can call Azure OpenAI the same way you call Op... | langchain/docs/docs/integrations/llms/azure_openai.ipynb/0 | {
"file_path": "langchain/docs/docs/integrations/llms/azure_openai.ipynb",
"repo_id": "langchain",
"token_count": 1518
} | 126 |
from langchain_core.runnables.utils import (
Addable,
AddableDict,
AnyConfigurableField,
ConfigurableField,
ConfigurableFieldMultiOption,
ConfigurableFieldSingleOption,
ConfigurableFieldSpec,
GetLambdaSource,
Input,
IsFunctionArgDict,
IsLocalDict,
Output,
SupportsAdd,... | langchain/libs/langchain/langchain/schema/runnable/utils.py/0 | {
"file_path": "langchain/libs/langchain/langchain/schema/runnable/utils.py",
"repo_id": "langchain",
"token_count": 479
} | 546 |
"""TTS modules."""
from llama_index.legacy.tts.bark import BarkTTS
from llama_index.legacy.tts.elevenlabs import ElevenLabsTTS
__all__ = ["BarkTTS", "ElevenLabsTTS"]
| llama_index/llama-index-legacy/llama_index/legacy/tts/__init__.py/0 | {
"file_path": "llama_index/llama-index-legacy/llama_index/legacy/tts/__init__.py",
"repo_id": "llama_index",
"token_count": 70
} | 1,608 |
"""Local RAG CLI Pack."""
from llama_index.core.ingestion import IngestionPipeline, IngestionCache
from llama_index.core.query_pipeline.query import QueryPipeline
from llama_index.core.storage.docstore import SimpleDocumentStore
from llama_index.core.command_line.rag import RagCLI
from llama_index.core.text_splitter i... | llama_index/llama-index-packs/llama-index-packs-rag-cli-local/llama_index/packs/rag_cli_local/base.py/0 | {
"file_path": "llama_index/llama-index-packs/llama-index-packs-rag-cli-local/llama_index/packs/rag_cli_local/base.py",
"repo_id": "llama_index",
"token_count": 1699
} | 1,673 |
// 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/paramtable/autoindex_param_test.go/0 | {
"file_path": "milvus/pkg/util/paramtable/autoindex_param_test.go",
"repo_id": "milvus",
"token_count": 2922
} | 1,976 |
#!/bin/bash
#SBATCH --job-name=multigpu
#SBATCH -D .
#SBATCH --output=O-%x.%j
#SBATCH --error=E-%x.%j
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1 # number of MP tasks
#SBATCH --gres=gpu:4 # number of GPUs per node
#SBATCH --cpus-per-task=160 # number of cores per tasks
#SBATCH --time=0... | accelerate/examples/slurm/submit_multigpu.sh/0 | {
"file_path": "accelerate/examples/slurm/submit_multigpu.sh",
"repo_id": "accelerate",
"token_count": 326
} | 8 |
# TResNet
A **TResNet** is a variant on a [ResNet](https://paperswithcode.com/method/resnet) that aim to boost accuracy while maintaining GPU training and inference efficiency. They contain several design tricks including a SpaceToDepth stem, [Anti-Alias downsampling](https://paperswithcode.com/method/anti-alias-down... | pytorch-image-models/docs/models/tresnet.md/0 | {
"file_path": "pytorch-image-models/docs/models/tresnet.md",
"repo_id": "pytorch-image-models",
"token_count": 4197
} | 356 |
[tool.poetry]
name = "gemini-functions-agent"
version = "0.1.0"
description = "Agent using Gemini function calling to execute functions, including search"
authors = ["Harrison Chase"]
readme = "README.md"
[tool.poetry.dependencies]
python = ">=3.9,<4.0"
langchain = "^0.1"
tavily-python = "^0.1.9"
langchain-google-gena... | langchain/templates/gemini-functions-agent/pyproject.toml/0 | {
"file_path": "langchain/templates/gemini-functions-agent/pyproject.toml",
"repo_id": "langchain",
"token_count": 286
} | 692 |
<jupyter_start><jupyter_text>Oracle Cloud Infrastructure Generative AI Oracle Cloud Infrastructure (OCI) Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases, and which is available through a single API.Using the... | langchain/docs/docs/integrations/llms/oci_generative_ai.ipynb/0 | {
"file_path": "langchain/docs/docs/integrations/llms/oci_generative_ai.ipynb",
"repo_id": "langchain",
"token_count": 1199
} | 117 |
import json
from langchain_core.messages import message_to_dict
from langchain.memory import ConversationBufferMemory, SingleStoreDBChatMessageHistory
# Replace these with your mongodb connection string
TEST_SINGLESTOREDB_URL = "root:pass@localhost:3306/db"
def test_memory_with_message_store() -> None:
"""Test... | langchain/libs/langchain/tests/integration_tests/memory/test_singlestoredb.py/0 | {
"file_path": "langchain/libs/langchain/tests/integration_tests/memory/test_singlestoredb.py",
"repo_id": "langchain",
"token_count": 417
} | 583 |
"""Integration test for Wikipedia API Wrapper."""
from typing import List
import pytest
from langchain_core.documents import Document
from langchain_community.utilities import WikipediaAPIWrapper
@pytest.fixture
def api_client() -> WikipediaAPIWrapper:
return WikipediaAPIWrapper()
def test_run_success(api_cli... | langchain/libs/community/tests/integration_tests/utilities/test_wikipedia_api.py/0 | {
"file_path": "langchain/libs/community/tests/integration_tests/utilities/test_wikipedia_api.py",
"repo_id": "langchain",
"token_count": 809
} | 353 |
# 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/maskformer/test_modeling_maskformer_swin.py/0 | {
"file_path": "transformers/tests/models/maskformer/test_modeling_maskformer_swin.py",
"repo_id": "transformers",
"token_count": 8052
} | 824 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Exported Data</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<link href="css/style.css" rel="stylesheet"/>
<script src="js/script.js" type="text/javascript">
</script>
</head>
<body onload="CheckLocation();... | langchain/libs/community/tests/unit_tests/chat_loaders/data/telegram_chat_html/messages.html/0 | {
"file_path": "langchain/libs/community/tests/unit_tests/chat_loaders/data/telegram_chat_html/messages.html",
"repo_id": "langchain",
"token_count": 1224
} | 391 |
<jupyter_start><jupyter_text>Dense-X-Retrieval PackThis notebook walks through using the `DenseXRetrievalPack`, which parses documents into nodes, and then generates propositions from each node to assist with retreival.This follows the idea from the paper [Dense X Retrieval: What Retreival Granularity Should We Use?](h... | llama_index/llama-index-packs/llama-index-packs-dense-x-retrieval/examples/dense_x_retrieval.ipynb/0 | {
"file_path": "llama_index/llama-index-packs/llama-index-packs-dense-x-retrieval/examples/dense_x_retrieval.ipynb",
"repo_id": "llama_index",
"token_count": 1283
} | 1,782 |
// 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/indexnode/task.go/0 | {
"file_path": "milvus/internal/indexnode/task.go",
"repo_id": "milvus",
"token_count": 8802
} | 1,855 |
"""Test __ModuleName__ embeddings."""
from __module_name__.embeddings import __ModuleName__Embeddings
def test___module_name___embedding_documents() -> None:
"""Test cohere embeddings."""
documents = ["foo bar"]
embedding = __ModuleName__Embeddings()
output = embedding.embed_documents(documents)
a... | langchain/libs/cli/langchain_cli/integration_template/tests/integration_tests/test_embeddings.py/0 | {
"file_path": "langchain/libs/cli/langchain_cli/integration_template/tests/integration_tests/test_embeddings.py",
"repo_id": "langchain",
"token_count": 209
} | 214 |
import os
from typing import Generator
import pytest
import requests
from requests.exceptions import ConnectionError, HTTPError
from langchain_community.llms.llamafile import Llamafile
LLAMAFILE_SERVER_BASE_URL = os.getenv(
"LLAMAFILE_SERVER_BASE_URL", "http://localhost:8080"
)
def _ping_llamafile_server() -> ... | langchain/libs/community/tests/integration_tests/llms/test_llamafile.py/0 | {
"file_path": "langchain/libs/community/tests/integration_tests/llms/test_llamafile.py",
"repo_id": "langchain",
"token_count": 475
} | 359 |
"""A tracer that runs evaluators over completed runs."""
from langchain_core.tracers.evaluation import (
EvaluatorCallbackHandler,
wait_for_all_evaluators,
)
__all__ = ["wait_for_all_evaluators", "EvaluatorCallbackHandler"]
| langchain/libs/langchain/langchain/callbacks/tracers/evaluation.py/0 | {
"file_path": "langchain/libs/langchain/langchain/callbacks/tracers/evaluation.py",
"repo_id": "langchain",
"token_count": 80
} | 451 |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#ifndef _util_cuh
#define _util_cuh
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include <cstdint>
#include <cstdio>
#if defined(USE_ROCM)
#define cudaUnspecified hipErrorUnknown
#else
#define cudaUnspecified cudaErrorApiFailureBase
#endif
... | text-generation-inference/server/exllama_kernels/exllama_kernels/util.cuh/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/util.cuh",
"repo_id": "text-generation-inference",
"token_count": 283
} | 390 |
# Reddit
>[Reddit](https://www.reddit.com) is an American social news aggregation, content rating, and discussion website.
## Installation and Setup
First, you need to install a python package.
```bash
pip install praw
```
Make a [Reddit Application](https://www.reddit.com/prefs/apps/) and initialize the loader wi... | langchain/docs/docs/integrations/providers/reddit.mdx/0 | {
"file_path": "langchain/docs/docs/integrations/providers/reddit.mdx",
"repo_id": "langchain",
"token_count": 143
} | 146 |
import { ChatLlamaCpp } from "@langchain/community/chat_models/llama_cpp";
import { LLMChain } from "langchain/chains";
import { PromptTemplate } from "@langchain/core/prompts";
const llamaPath = "/Replace/with/path/to/your/model/gguf-llama2-q4_0.bin";
const model = new ChatLlamaCpp({ modelPath: llamaPath, temperatur... | langchainjs/examples/src/models/chat/integration_llama_cpp_chain.ts/0 | {
"file_path": "langchainjs/examples/src/models/chat/integration_llama_cpp_chain.ts",
"repo_id": "langchainjs",
"token_count": 277
} | 831 |
// This should reach 91.5% accuracy.
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use clap::{Parser, ValueEnum};
use rand::prelude::*;
use candle::{DType, Result, Tensor, D};
use candle_nn::{loss, ops, Conv2d, Linear, Module, ModuleT, Optimizer, VarB... | candle/candle-examples/examples/mnist-training/main.rs/0 | {
"file_path": "candle/candle-examples/examples/mnist-training/main.rs",
"repo_id": "candle",
"token_count": 4094
} | 47 |
# Copyright 2020 The HuggingFace 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 ... | datasets/metrics/bleurt/bleurt.py/0 | {
"file_path": "datasets/metrics/bleurt/bleurt.py",
"repo_id": "datasets",
"token_count": 1982
} | 126 |
[tool.poetry]
name = "skeleton-of-thought"
version = "0.0.1"
description = "Generate longer outputs by building sections from a skeleton outline"
authors = []
readme = "README.md"
[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
langchain = "^0.1"
openai = "^0.28.1"
[tool.poetry.group.dev.dependencies]
langchain-cl... | langchain/templates/skeleton-of-thought/pyproject.toml/0 | {
"file_path": "langchain/templates/skeleton-of-thought/pyproject.toml",
"repo_id": "langchain",
"token_count": 271
} | 689 |
"""Experimental implementation of lm-format-enforcer wrapped LLM."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, List, Optional
from langchain.callbacks.manager import CallbackManagerForLLMRun
from langchain.schema import LLMResult
from langchain_community.llms.huggingface_pipeline impor... | langchain/libs/experimental/langchain_experimental/llms/lmformatenforcer_decoder.py/0 | {
"file_path": "langchain/libs/experimental/langchain_experimental/llms/lmformatenforcer_decoder.py",
"repo_id": "langchain",
"token_count": 1148
} | 420 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.