text stringlengths 3 1.68M | id stringlengths 13 169 | metadata dict | __index_level_0__ int64 0 2.21k |
|---|---|---|---|
from typing import List
from llama_index.core.prompts.base import BasePromptTemplate
def get_empty_prompt_txt(prompt: BasePromptTemplate) -> str:
"""Get empty prompt text.
Substitute empty strings in parts of the prompt that have
not yet been filled out. Skip variables that have already
been partial... | llama_index/llama-index-core/llama_index/core/prompts/prompt_utils.py/0 | {
"file_path": "llama_index/llama-index-core/llama_index/core/prompts/prompt_utils.py",
"repo_id": "llama_index",
"token_count": 374
} | 1,193 |
<jupyter_start><jupyter_text>DashVector> [DashVector](https://help.aliyun.com/document_detail/2510225.html) is a fully managed vector DB service that supports high-dimension dense and sparse vectors, real-time insertion and filtered search. It is built to scale automatically and can adapt to different application requi... | langchain/docs/docs/integrations/retrievers/self_query/dashvector.ipynb/0 | {
"file_path": "langchain/docs/docs/integrations/retrievers/self_query/dashvector.ipynb",
"repo_id": "langchain",
"token_count": 1855
} | 170 |
"""Test HuggingFaceHub embeddings."""
import pytest
from langchain_community.embeddings import HuggingFaceHubEmbeddings
def test_huggingfacehub_embedding_documents() -> None:
"""Test huggingfacehub embeddings."""
documents = ["foo bar"]
embedding = HuggingFaceHubEmbeddings()
output = embedding.embed_... | langchain/libs/community/tests/integration_tests/embeddings/test_huggingface_hub.py/0 | {
"file_path": "langchain/libs/community/tests/integration_tests/embeddings/test_huggingface_hub.py",
"repo_id": "langchain",
"token_count": 513
} | 331 |
"""Test LLM program."""
import json
from typing import Sequence
from unittest.mock import MagicMock
from llama_index.legacy.bridge.pydantic import BaseModel
from llama_index.legacy.core.llms.types import (
CompletionResponse,
)
from llama_index.legacy.multi_modal_llms import MultiModalLLMMetadata
from llama_index... | llama_index/llama-index-legacy/tests/program/test_multi_modal_llm_program.py/0 | {
"file_path": "llama_index/llama-index-legacy/tests/program/test_multi_modal_llm_program.py",
"repo_id": "llama_index",
"token_count": 574
} | 1,543 |
from typing import List
import pytest
from llama_index.legacy.indices.managed.vectara.base import VectaraIndex
from llama_index.legacy.schema import Document
#
# For this test to run properly, please setup as follows:
# 1. Create a Vectara account: sign up at https://console.vectara.com/signup
# 2. Create a corpus in... | llama_index/llama-index-legacy/tests/indices/managed/test_vectara.py/0 | {
"file_path": "llama_index/llama-index-legacy/tests/indices/managed/test_vectara.py",
"repo_id": "llama_index",
"token_count": 1883
} | 1,736 |
<jupyter_start><jupyter_code>%env CUDA_VISIBLE_DEVICES=0
%env TOKENIZERS_PARALLELISM=false<jupyter_output>env: CUDA_VISIBLE_DEVICES=0
env: TOKENIZERS_PARALLELISM=false<jupyter_text>Initialize PolyModel<jupyter_code>import torch
from transformers import (
AutoModelForSeq2SeqLM,
AutoTokenizer,
default_data_co... | peft/examples/poly/peft_poly_seq2seq_with_generate.ipynb/0 | {
"file_path": "peft/examples/poly/peft_poly_seq2seq_with_generate.ipynb",
"repo_id": "peft",
"token_count": 4104
} | 328 |
python_sources()
| llama_index/llama-index-integrations/readers/llama-index-readers-stackoverflow/llama_index/readers/stackoverflow/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-stackoverflow/llama_index/readers/stackoverflow/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,381 |
<jupyter_start><jupyter_text>Building a Exa (formerly Metaphor) Data AgentThis tutorial walks through using the LLM tools provided by the [Exa API](https://exa.ai) to allow LLMs to easily search and retrieve HTML content from the Internet.To get started, you will need an [OpenAI api key](https://platform.openai.com/acc... | llama_index/llama-index-integrations/tools/llama-index-tools-exa/examples/exa.ipynb/0 | {
"file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-exa/examples/exa.ipynb",
"repo_id": "llama_index",
"token_count": 2702
} | 1,478 |
from typing import Optional
import typer
from typing_extensions import Annotated
from langchain_cli.namespaces import app as app_namespace
from langchain_cli.namespaces import integration as integration_namespace
from langchain_cli.namespaces import template as template_namespace
from langchain_cli.utils.packages imp... | langchain/libs/cli/langchain_cli/cli.py/0 | {
"file_path": "langchain/libs/cli/langchain_cli/cli.py",
"repo_id": "langchain",
"token_count": 750
} | 215 |
<jupyter_start><jupyter_text>HyDE Query Transform If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>!pip install llama-index<jupyter_output><empty_output><jupyter_text>Download Data<jupyter_code>!mkdir -p 'data/paul_graham/'
!wget 'https://raw.githubusercontent.com/... | llama_index/docs/examples/query_transformations/HyDEQueryTransformDemo.ipynb/0 | {
"file_path": "llama_index/docs/examples/query_transformations/HyDEQueryTransformDemo.ipynb",
"repo_id": "llama_index",
"token_count": 2196
} | 1,160 |
import warnings
from typing import Any, Dict, List, Optional
from langchain_core.callbacks import CallbackManagerForRetrieverRun
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.pydantic_v1 import root_validator
from langchain_core.retrievers import Bas... | langchain/libs/community/langchain_community/retrievers/zilliz.py/0 | {
"file_path": "langchain/libs/community/langchain_community/retrievers/zilliz.py",
"repo_id": "langchain",
"token_count": 1087
} | 293 |
import re
from typing import Any, Callable, Dict, Tuple
from langchain.chains.query_constructor.ir import (
Comparator,
Comparison,
Operation,
Operator,
StructuredQuery,
Visitor,
)
def _DEFAULT_COMPOSER(op_name: str) -> Callable:
"""
Default composer for logical operators.
Args:
... | langchain/libs/langchain/langchain/retrievers/self_query/myscale.py/0 | {
"file_path": "langchain/libs/langchain/langchain/retrievers/self_query/myscale.py",
"repo_id": "langchain",
"token_count": 1601
} | 560 |
// 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/datanode/flow_graph_time_ticker.go/0 | {
"file_path": "milvus/internal/datanode/flow_graph_time_ticker.go",
"repo_id": "milvus",
"token_count": 1608
} | 1,701 |
from llama_index.readers.feedly_rss.base import FeedlyRssReader
__all__ = ["FeedlyRssReader"]
| llama_index/llama-index-integrations/readers/llama-index-readers-feedly-rss/llama_index/readers/feedly_rss/__init__.py/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-feedly-rss/llama_index/readers/feedly_rss/__init__.py",
"repo_id": "llama_index",
"token_count": 35
} | 1,487 |
from langchain_community.agent_toolkits.powerbi.prompt import (
POWERBI_CHAT_PREFIX,
POWERBI_CHAT_SUFFIX,
POWERBI_PREFIX,
POWERBI_SUFFIX,
)
__all__ = [
"POWERBI_PREFIX",
"POWERBI_SUFFIX",
"POWERBI_CHAT_PREFIX",
"POWERBI_CHAT_SUFFIX",
]
| langchain/libs/langchain/langchain/agents/agent_toolkits/powerbi/prompt.py/0 | {
"file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/powerbi/prompt.py",
"repo_id": "langchain",
"token_count": 135
} | 463 |
"""Test mosaicml embeddings."""
from langchain_community.embeddings.mosaicml import MosaicMLInstructorEmbeddings
def test_mosaicml_embedding_documents() -> None:
"""Test MosaicML embeddings."""
documents = ["foo bar"]
embedding = MosaicMLInstructorEmbeddings()
output = embedding.embed_documents(docume... | langchain/libs/community/tests/integration_tests/embeddings/test_mosaicml.py/0 | {
"file_path": "langchain/libs/community/tests/integration_tests/embeddings/test_mosaicml.py",
"repo_id": "langchain",
"token_count": 751
} | 356 |
import { ChatOpenAI } from "@langchain/openai";
const model = new ChatOpenAI({
temperature: 0.9,
azureOpenAIApiKey: "SOME_SECRET_VALUE", // In Node.js defaults to process.env.AZURE_OPENAI_API_KEY
azureOpenAIApiVersion: "YOUR-API-VERSION", // In Node.js defaults to process.env.AZURE_OPENAI_API_VERSION
azureOpen... | langchainjs/examples/src/models/chat/integration_azure_openai_base_path.ts/0 | {
"file_path": "langchainjs/examples/src/models/chat/integration_azure_openai_base_path.ts",
"repo_id": "langchainjs",
"token_count": 217
} | 894 |
import { MaskingTransformer } from "./transformer.js";
import type { MaskingParserConfig } from "./types.js";
/**
* MaskingParser class for handling the masking and rehydrating of messages.
*/
export class MaskingParser {
private transformers: MaskingTransformer[];
private state: Map<string, string>;
private... | langchainjs/langchain/src/experimental/masking/parser.ts/0 | {
"file_path": "langchainjs/langchain/src/experimental/masking/parser.ts",
"repo_id": "langchainjs",
"token_count": 1791
} | 911 |
# Metric Card for chrF(++)
## Metric Description
ChrF and ChrF++ are two MT evaluation metrics that use the F-score statistic for character n-gram matches. ChrF++ additionally includes word n-grams, which correlate more strongly with direct assessment. We use the implementation that is already present in sacrebleu.
... | datasets/metrics/chrf/README.md/0 | {
"file_path": "datasets/metrics/chrf/README.md",
"repo_id": "datasets",
"token_count": 2254
} | 137 |
from base.client_base import TestcaseBase
from utils.util_log import test_log as log
class TestDeployBase(TestcaseBase):
def teardown_method(self, method):
log.info(("*" * 35) + " teardown " + ("*" * 35))
log.info("[teardown_method] Start teardown test case %s..." % method.__name__)
log.i... | milvus/tests/python_client/deploy/base.py/0 | {
"file_path": "milvus/tests/python_client/deploy/base.py",
"repo_id": "milvus",
"token_count": 133
} | 1,968 |
# Copyright 2024 NVIDIA and The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | diffusers/src/diffusers/schedulers/scheduling_karras_ve_flax.py/0 | {
"file_path": "diffusers/src/diffusers/schedulers/scheduling_karras_ve_flax.py",
"repo_id": "diffusers",
"token_count": 3954
} | 277 |
# Instagram ResNeXt WSL
A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transfo... | pytorch-image-models/docs/models/.templates/models/ig-resnext.md/0 | {
"file_path": "pytorch-image-models/docs/models/.templates/models/ig-resnext.md",
"repo_id": "pytorch-image-models",
"token_count": 2409
} | 346 |
from langchain_community.tools.amadeus.flight_search import (
AmadeusFlightSearch,
FlightSearchSchema,
)
__all__ = ["FlightSearchSchema", "AmadeusFlightSearch"]
| langchain/libs/langchain/langchain/tools/amadeus/flight_search.py/0 | {
"file_path": "langchain/libs/langchain/langchain/tools/amadeus/flight_search.py",
"repo_id": "langchain",
"token_count": 58
} | 550 |
// Licensed to the LF AI & Data foundation under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use th... | milvus/internal/datacoord/channel_manager_factory.go/0 | {
"file_path": "milvus/internal/datacoord/channel_manager_factory.go",
"repo_id": "milvus",
"token_count": 703
} | 1,771 |
<jupyter_start><jupyter_text>Deploy Zephyr 7B on AWS Inferentia2 using Amazon SageMakerThis tutorial will show how easy it is to deploy Zephyr 7B on AWS Infernetia2 using Amazon SageMaker. Zephyr is a 7B parameter LLM fine-tuned version of [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) th... | notebooks/sagemaker/29_deploy_llms_on_inferentia2/sagemaker-notebook.ipynb/0 | {
"file_path": "notebooks/sagemaker/29_deploy_llms_on_inferentia2/sagemaker-notebook.ipynb",
"repo_id": "notebooks",
"token_count": 3797
} | 317 |
<jupyter_start><jupyter_text>NVIDIA AI Foundation EndpointsThe `ChatNVIDIA` class is a LangChain chat model that connects to [NVIDIA AI Foundation Endpoints](https://www.nvidia.com/en-us/ai-data-science/foundation-models/).> [NVIDIA AI Foundation Endpoints](https://www.nvidia.com/en-us/ai-data-science/foundation-models... | langchain/docs/docs/integrations/chat/nvidia_ai_endpoints.ipynb/0 | {
"file_path": "langchain/docs/docs/integrations/chat/nvidia_ai_endpoints.ipynb",
"repo_id": "langchain",
"token_count": 6697
} | 97 |
"""Integration test for Dall-E image generator agent."""
from langchain_community.llms import OpenAI
from langchain.agents import AgentType, initialize_agent, load_tools
def test_call() -> None:
"""Test that the agent runs and returns output."""
llm = OpenAI(temperature=0.9)
tools = load_tools(["dalle-im... | langchain/libs/langchain/tests/integration_tests/chains/test_dalle_agent.py/0 | {
"file_path": "langchain/libs/langchain/tests/integration_tests/chains/test_dalle_agent.py",
"repo_id": "langchain",
"token_count": 183
} | 623 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | diffusers/docs/source/en/using-diffusers/sdxl_turbo.md/0 | {
"file_path": "diffusers/docs/source/en/using-diffusers/sdxl_turbo.md",
"repo_id": "diffusers",
"token_count": 1613
} | 175 |
import pytest
from langchain_community.utilities.reddit_search import RedditSearchAPIWrapper
@pytest.fixture
def api_client() -> RedditSearchAPIWrapper:
return RedditSearchAPIWrapper()
def assert_results_exists(results: list) -> None:
if len(results) > 0:
for result in results:
assert "... | langchain/libs/community/tests/integration_tests/utilities/test_reddit_search_api.py/0 | {
"file_path": "langchain/libs/community/tests/integration_tests/utilities/test_reddit_search_api.py",
"repo_id": "langchain",
"token_count": 794
} | 346 |
"""Tool for agent to sleep."""
from asyncio import sleep as asleep
from time import sleep
from typing import Optional, Type
from langchain_core.callbacks import (
AsyncCallbackManagerForToolRun,
CallbackManagerForToolRun,
)
from langchain_core.pydantic_v1 import BaseModel, Field
from langchain_core.tools impor... | langchain/libs/community/langchain_community/tools/sleep/tool.py/0 | {
"file_path": "langchain/libs/community/langchain_community/tools/sleep/tool.py",
"repo_id": "langchain",
"token_count": 441
} | 312 |
# 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/stable_diffusion_image_variation/test_stable_diffusion_image_variation.py/0 | {
"file_path": "diffusers/tests/pipelines/stable_diffusion_image_variation/test_stable_diffusion_image_variation.py",
"repo_id": "diffusers",
"token_count": 5831
} | 286 |
{
"graph_dict": {
"I": [
["wrote", "short stories"],
["wrote", "programs"],
["applied to", "grad schools"],
["realized that", "AI was a hoax"],
["took art classes at", "Harvard"],
["was in a PhD program in", "computer science"],
["applied to", "RISD"],
["applied to"... | llama_index/docs/examples/index_structs/knowledge_graph/storage/graph_store.json/0 | {
"file_path": "llama_index/docs/examples/index_structs/knowledge_graph/storage/graph_store.json",
"repo_id": "llama_index",
"token_count": 1919
} | 1,109 |
import logging
from urllib.parse import urlparse
from langchain_community.chat_models.mlflow import ChatMlflow
logger = logging.getLogger(__name__)
class ChatDatabricks(ChatMlflow):
"""`Databricks` chat models API.
To use, you should have the ``mlflow`` python package installed.
For more information, s... | langchain/libs/community/langchain_community/chat_models/databricks.py/0 | {
"file_path": "langchain/libs/community/langchain_community/chat_models/databricks.py",
"repo_id": "langchain",
"token_count": 539
} | 243 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 5,
"prefill": [
{
"id": 0,
"logprob": null,
"text": "<pad>"
}
],
"seed": 0,
"tokens": [
{
"id": 926,
"logprob": -4.3554688,
"special... | text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base.json",
"repo_id": "text-generation-inference",
"token_count": 532
} | 388 |
from llama_index.readers.boarddocs.base import BoardDocsReader
__all__ = ["BoardDocsReader"]
| llama_index/llama-index-integrations/readers/llama-index-readers-boarddocs/llama_index/readers/boarddocs/__init__.py/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-boarddocs/llama_index/readers/boarddocs/__init__.py",
"repo_id": "llama_index",
"token_count": 31
} | 1,329 |
[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 = ["LlamaAPI"]
contains_example = false
import_path = "llama_index.llms.llama_api"
[tool.myp... | llama_index/llama-index-integrations/llms/llama-index-llms-llama-api/pyproject.toml/0 | {
"file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-llama-api/pyproject.toml",
"repo_id": "llama_index",
"token_count": 670
} | 1,226 |
import { v4 as uuidv4, validate } from "uuid";
import { Run } from "langsmith/schemas";
import {
ChatPromptTemplate,
HumanMessagePromptTemplate,
SystemMessagePromptTemplate,
} from "../../prompts/chat.js";
import { BaseLLM } from "../../language_models/llms.js";
import { StringOutputParser } from "../../output_pa... | langchainjs/langchain-core/src/callbacks/tests/run_collector.test.ts/0 | {
"file_path": "langchainjs/langchain-core/src/callbacks/tests/run_collector.test.ts",
"repo_id": "langchainjs",
"token_count": 680
} | 860 |
// Licensed to the LF AI & Data foundation under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use th... | milvus/internal/util/typeutil/schema_test.go/0 | {
"file_path": "milvus/internal/util/typeutil/schema_test.go",
"repo_id": "milvus",
"token_count": 853
} | 2,027 |
# 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/src/transformers/models/auto/modeling_auto.py/0 | {
"file_path": "transformers/src/transformers/models/auto/modeling_auto.py",
"repo_id": "transformers",
"token_count": 28076
} | 564 |
"""Prompt class."""
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.prompts.base import (
BasePromptTemplate,
ChatPromptTemplate,
LangchainPromptTemplate,
Prompt,
PromptTemplate,
PromptType,
SelectorPromptTemplate,
)
from llama_index.core.prompts.... | llama_index/llama-index-core/llama_index/core/prompts/__init__.py/0 | {
"file_path": "llama_index/llama-index-core/llama_index/core/prompts/__init__.py",
"repo_id": "llama_index",
"token_count": 234
} | 1,165 |
// 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/conc/options.go/0 | {
"file_path": "milvus/pkg/util/conc/options.go",
"repo_id": "milvus",
"token_count": 978
} | 2,102 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | diffusers/docs/source/en/api/pipelines/paint_by_example.md/0 | {
"file_path": "diffusers/docs/source/en/api/pipelines/paint_by_example.md",
"repo_id": "diffusers",
"token_count": 762
} | 178 |
---
sidebar_class_name: node-only
---
import CodeBlock from "@theme/CodeBlock";
# Redis
[Redis](https://redis.io/) is a fast open source, in-memory data store.
As part of the [Redis Stack](https://redis.io/docs/stack/get-started/), [RediSearch](https://redis.io/docs/stack/search/) is the module that enables vector s... | langchainjs/docs/core_docs/docs/integrations/vectorstores/redis.mdx/0 | {
"file_path": "langchainjs/docs/core_docs/docs/integrations/vectorstores/redis.mdx",
"repo_id": "langchainjs",
"token_count": 645
} | 745 |
from langchain_community.utilities.arcee import (
ArceeDocument,
ArceeDocumentAdapter,
ArceeDocumentSource,
ArceeRoute,
ArceeWrapper,
DALMFilter,
DALMFilterType,
)
__all__ = [
"ArceeRoute",
"DALMFilterType",
"DALMFilter",
"ArceeDocumentSource",
"ArceeDocument",
"Arce... | langchain/libs/langchain/langchain/utilities/arcee.py/0 | {
"file_path": "langchain/libs/langchain/langchain/utilities/arcee.py",
"repo_id": "langchain",
"token_count": 167
} | 563 |
import * as fs from "fs";
import * as path from "path";
let dirname = new URL(".", import.meta.url).pathname;
// If on Windows, remove the leading slash
if (process.platform === "win32" && dirname.startsWith("/")) {
dirname = dirname.slice(1);
}
const mainPath = path.join(dirname, "../dist/cli/main.cjs");
const mai... | langsmith-sdk/js/scripts/create-cli.js/0 | {
"file_path": "langsmith-sdk/js/scripts/create-cli.js",
"repo_id": "langsmith-sdk",
"token_count": 298
} | 1,066 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... | transformers/src/transformers/generation/tf_utils.py/0 | {
"file_path": "transformers/src/transformers/generation/tf_utils.py",
"repo_id": "transformers",
"token_count": 77771
} | 572 |
"""Chain for chatting with a vector database."""
from __future__ import annotations
import inspect
import warnings
from abc import abstractmethod
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from langchain_core.callbacks import (
AsyncCallbackManagerForChainR... | langchain/libs/langchain/langchain/chains/conversational_retrieval/base.py/0 | {
"file_path": "langchain/libs/langchain/langchain/chains/conversational_retrieval/base.py",
"repo_id": "langchain",
"token_count": 7385
} | 465 |
<jupyter_start><jupyter_text>WeChatThere is not yet a straightforward way to export personal WeChat messages. However if you just need no more than few hundreds of messages for model fine-tuning or few-shot examples, this notebook shows how to create your own chat loader that works on copy-pasted WeChat messages to a l... | langchain/docs/docs/integrations/chat_loaders/wechat.ipynb/0 | {
"file_path": "langchain/docs/docs/integrations/chat_loaders/wechat.ipynb",
"repo_id": "langchain",
"token_count": 2416
} | 99 |
from langchain_community.tools.requests.tool import (
BaseRequestsTool,
RequestsDeleteTool,
RequestsGetTool,
RequestsPatchTool,
RequestsPostTool,
RequestsPutTool,
)
__all__ = [
"BaseRequestsTool",
"RequestsGetTool",
"RequestsPostTool",
"RequestsPatchTool",
"RequestsPutTool",... | langchain/libs/langchain/langchain/tools/requests/tool.py/0 | {
"file_path": "langchain/libs/langchain/langchain/tools/requests/tool.py",
"repo_id": "langchain",
"token_count": 140
} | 597 |
"""Test Together embeddings."""
from langchain_together.embeddings import TogetherEmbeddings
def test_langchain_together_embedding_documents() -> None:
"""Test cohere embeddings."""
documents = ["foo bar"]
embedding = TogetherEmbeddings(model="togethercomputer/m2-bert-80M-8k-retrieval")
output = embed... | langchain/libs/partners/together/tests/integration_tests/test_embeddings.py/0 | {
"file_path": "langchain/libs/partners/together/tests/integration_tests/test_embeddings.py",
"repo_id": "langchain",
"token_count": 238
} | 664 |
poetry_requirements(
name="poetry",
)
| llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-redis/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-redis/BUILD",
"repo_id": "llama_index",
"token_count": 18
} | 1,609 |
python_sources()
| llama_index/llama-index-legacy/llama_index/legacy/tools/BUILD/0 | {
"file_path": "llama_index/llama-index-legacy/llama_index/legacy/tools/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,605 |
from llama_index.legacy.storage.docstore.dynamodb_docstore import DynamoDBDocumentStore
from llama_index.legacy.storage.docstore.firestore_docstore import (
FirestoreDocumentStore,
)
from llama_index.legacy.storage.docstore.keyval_docstore import KVDocumentStore
from llama_index.legacy.storage.docstore.mongo_docsto... | llama_index/llama-index-legacy/llama_index/legacy/storage/docstore/__init__.py/0 | {
"file_path": "llama_index/llama-index-legacy/llama_index/legacy/storage/docstore/__init__.py",
"repo_id": "llama_index",
"token_count": 286
} | 1,540 |
# cassandra-synonym-caching
This template provides a simple chain template showcasing the usage of LLM Caching backed by Apache Cassandra® or Astra DB through CQL.
## Environment Setup
To set up your environment, you will need the following:
- an [Astra](https://astra.datastax.com) Vector Database (free tier is fi... | langchain/templates/cassandra-synonym-caching/README.md/0 | {
"file_path": "langchain/templates/cassandra-synonym-caching/README.md",
"repo_id": "langchain",
"token_count": 918
} | 703 |
from typing import Dict, List
from langchain_community.agent_toolkits.base import BaseToolkit
from langchain_community.tools import BaseTool
from langchain_community.tools.nasa.prompt import (
NASA_CAPTIONS_PROMPT,
NASA_MANIFEST_PROMPT,
NASA_METADATA_PROMPT,
NASA_SEARCH_PROMPT,
)
from langchain_communi... | langchain/libs/community/langchain_community/agent_toolkits/nasa/toolkit.py/0 | {
"file_path": "langchain/libs/community/langchain_community/agent_toolkits/nasa/toolkit.py",
"repo_id": "langchain",
"token_count": 916
} | 211 |
import warnings
from typing import Union
import numpy as np
import pandas as pd
from llama_index.core.evaluation import BaseEvaluator
from llama_index.core.llama_dataset.evaluator_evaluation import (
EvaluatorPredictionDataset,
LabelledEvaluatorDataset,
LabelledPairwiseEvaluatorDataset,
PairwiseEvaluat... | llama_index/llama-index-packs/llama-index-packs-evaluator-benchmarker/llama_index/packs/evaluator_benchmarker/base.py/0 | {
"file_path": "llama_index/llama-index-packs/llama-index-packs-evaluator-benchmarker/llama_index/packs/evaluator_benchmarker/base.py",
"repo_id": "llama_index",
"token_count": 2929
} | 1,668 |
package delegator
import (
"fmt"
"time"
"github.com/cockroachdb/errors"
"github.com/milvus-io/milvus/internal/proto/querypb"
"github.com/milvus-io/milvus/pkg/util/typeutil"
)
const (
rowIDFieldID FieldID = 0
timestampFieldID FieldID = 1
)
type (
// UniqueID is an identifier that is guaranteed to be uni... | milvus/internal/querynodev2/delegator/types.go/0 | {
"file_path": "milvus/internal/querynodev2/delegator/types.go",
"repo_id": "milvus",
"token_count": 510
} | 1,870 |
python_tests()
| llama_index/llama-index-integrations/readers/llama-index-readers-docstring-walker/tests/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-docstring-walker/tests/BUILD",
"repo_id": "llama_index",
"token_count": 5
} | 1,284 |
from langchain_core.documents import __all__
EXPECTED_ALL = ["Document", "BaseDocumentTransformer"]
def test_all_imports() -> None:
assert set(__all__) == set(EXPECTED_ALL)
| langchain/libs/core/tests/unit_tests/documents/test_imports.py/0 | {
"file_path": "langchain/libs/core/tests/unit_tests/documents/test_imports.py",
"repo_id": "langchain",
"token_count": 63
} | 424 |
import { buildPrompt } from "$lib/buildPrompt";
import type { TextGenerationStreamOutput } from "@huggingface/inference";
import type { Endpoint } from "../endpoints";
import { z } from "zod";
export const endpointOllamaParametersSchema = z.object({
weight: z.number().int().positive().default(1),
model: z.any(),
ty... | chat-ui/src/lib/server/endpoints/ollama/endpointOllama.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/ollama/endpointOllama.ts",
"repo_id": "chat-ui",
"token_count": 1123
} | 91 |
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/src/transformers/models/nougat/image_processing_nougat.py/0 | {
"file_path": "transformers/src/transformers/models/nougat/image_processing_nougat.py",
"repo_id": "transformers",
"token_count": 10003
} | 647 |
import { test } from "@jest/globals";
import { getEnvironmentVariable } from "@langchain/core/utils/env";
import { CloudflareWorkersAI } from "../llms.js";
test("Test CloudflareWorkersAI", async () => {
const model = new CloudflareWorkersAI({});
const res = await model.call("1 + 1 =");
console.log(res);
}, 50000... | langchainjs/libs/langchain-cloudflare/src/tests/llms.int.test.ts/0 | {
"file_path": "langchainjs/libs/langchain-cloudflare/src/tests/llms.int.test.ts",
"repo_id": "langchainjs",
"token_count": 547
} | 975 |
# 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 required by appl... | accelerate/src/accelerate/test_utils/scripts/external_deps/test_peak_memory_usage.py/0 | {
"file_path": "accelerate/src/accelerate/test_utils/scripts/external_deps/test_peak_memory_usage.py",
"repo_id": "accelerate",
"token_count": 4264
} | 14 |
"""Node PostProcessor module."""
from llama_index.core.postprocessor.llm_rerank import LLMRerank
from llama_index.core.postprocessor.metadata_replacement import (
MetadataReplacementPostProcessor,
)
from llama_index.core.postprocessor.node import (
AutoPrevNextNodePostprocessor,
KeywordNodePostprocessor,
... | llama_index/llama-index-core/llama_index/core/postprocessor/__init__.py/0 | {
"file_path": "llama_index/llama-index-core/llama_index/core/postprocessor/__init__.py",
"repo_id": "llama_index",
"token_count": 441
} | 1,193 |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets/metrics/recall/recall.py/0 | {
"file_path": "datasets/metrics/recall/recall.py",
"repo_id": "datasets",
"token_count": 2604
} | 123 |
# LLaVA Completion Pack
This LlamaPack creates the LLaVA multimodal model, and runs its `complete` endpoint to execute queries.
## CLI Usage
You can download llamapacks directly using `llamaindex-cli`, which comes installed with the `llama-index` python package:
```bash
llamaindex-cli download-llamapack LlavaComple... | llama_index/llama-index-packs/llama-index-packs-llava-completion/README.md/0 | {
"file_path": "llama_index/llama-index-packs/llama-index-packs-llava-completion/README.md",
"repo_id": "llama_index",
"token_count": 417
} | 1,677 |
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js";
/* #__PURE__ */ logVersion010MigrationWarning({
oldEntrypointName: "document_transformers/mozilla_readability",
});
export * from "@langchain/community/document_transformers/mozilla_readability";
| langchainjs/langchain/src/document_transformers/mozilla_readability.ts/0 | {
"file_path": "langchainjs/langchain/src/document_transformers/mozilla_readability.ts",
"repo_id": "langchainjs",
"token_count": 82
} | 950 |
python_tests()
| llama_index/llama-index-integrations/readers/llama-index-readers-remote/tests/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-remote/tests/BUILD",
"repo_id": "llama_index",
"token_count": 5
} | 1,546 |
---
sidebar_label: Hub
sidebar_position: 3
---
# LangChain Hub
Efficiently manage your LLM components with the [LangChain Hub](https://smith.langchain.com/hub). For dedicated documentation, please see the [hub docs](https://docs.smith.langchain.com/hub/quickstart).
- [RetrievalQA Chain](./retrieval-qa-chain/retrieval... | langsmith-cookbook/hub-examples/README.md/0 | {
"file_path": "langsmith-cookbook/hub-examples/README.md",
"repo_id": "langsmith-cookbook",
"token_count": 213
} | 1,060 |
import { Pipeline, pipeline } from "@xenova/transformers";
import { Embeddings, type EmbeddingsParams } from "@langchain/core/embeddings";
import { chunkArray } from "@langchain/core/utils/chunk_array";
export interface HuggingFaceTransformersEmbeddingsParams
extends EmbeddingsParams {
/** Model name to use */
m... | langchainjs/libs/langchain-community/src/embeddings/hf_transformers.ts/0 | {
"file_path": "langchainjs/libs/langchain-community/src/embeddings/hf_transformers.ts",
"repo_id": "langchainjs",
"token_count": 1002
} | 1,055 |
"""DynamoDB vector store index."""
from __future__ import annotations
from logging import getLogger
from typing import Any, Dict, List, cast
from llama_index.core.indices.query.embedding_utils import (
get_top_k_embeddings,
get_top_k_embeddings_learner,
)
from llama_index.core.schema import BaseNode
from llam... | llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-dynamodb/llama_index/vector_stores/dynamodb/base.py/0 | {
"file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-dynamodb/llama_index/vector_stores/dynamodb/base.py",
"repo_id": "llama_index",
"token_count": 2349
} | 1,654 |
# 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/models/reformer/convert_reformer_trax_checkpoint_to_pytorch.py/0 | {
"file_path": "transformers/src/transformers/models/reformer/convert_reformer_trax_checkpoint_to_pytorch.py",
"repo_id": "transformers",
"token_count": 3213
} | 650 |
from llama_index.core.llms.base import BaseLLM
from llama_index.llms.watsonx import WatsonX
def test_embedding_class():
names_of_base_classes = [b.__name__ for b in WatsonX.__mro__]
assert BaseLLM.__name__ in names_of_base_classes
| llama_index/llama-index-integrations/llms/llama-index-llms-watsonx/tests/test_llms_watsonx.py/0 | {
"file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-watsonx/tests/test_llms_watsonx.py",
"repo_id": "llama_index",
"token_count": 92
} | 1,378 |
# Copyright 2023 metric-space, 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 require... | trl/examples/scripts/ddpo.py/0 | {
"file_path": "trl/examples/scripts/ddpo.py",
"repo_id": "trl",
"token_count": 2703
} | 810 |
"""Test Cohere API wrapper."""
from pathlib import Path
from langchain_community.llms.cohere import Cohere
from langchain_community.llms.loading import load_llm
from tests.integration_tests.llms.utils import assert_llm_equality
def test_cohere_call() -> None:
"""Test valid call to cohere."""
llm = Cohere(ma... | langchain/libs/community/tests/integration_tests/llms/test_cohere.py/0 | {
"file_path": "langchain/libs/community/tests/integration_tests/llms/test_cohere.py",
"repo_id": "langchain",
"token_count": 260
} | 362 |
/* eslint-disable no-process-env */
import { test, expect } from "@jest/globals";
import { OpenAIEmbeddings } from "@langchain/openai";
import { Document } from "@langchain/core/documents";
import { MyScaleStore } from "../myscale.js";
test.skip("MyScaleStore.fromText", async () => {
const vectorStore = await MySc... | langchainjs/libs/langchain-community/src/vectorstores/tests/myscale.int.test.ts/0 | {
"file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/myscale.int.test.ts",
"repo_id": "langchainjs",
"token_count": 1044
} | 1,020 |
import { ChatPromptTemplate } from "@langchain/core/prompts";
import fs from "node:fs/promises";
const hotdogImage = await fs.readFile("hotdog.jpg");
// Convert the image to base64
const base64Image = hotdogImage.toString("base64");
const imageURL = "https://avatars.githubusercontent.com/u/126733545?s=200&v=4";
cons... | langchainjs/examples/src/prompts/multi_modal_inline.ts/0 | {
"file_path": "langchainjs/examples/src/prompts/multi_modal_inline.ts",
"repo_id": "langchainjs",
"token_count": 806
} | 858 |
<script lang="ts">
import type { readAndCompressImage } from "browser-image-resizer";
import type { Model } from "$lib/types/Model";
import type { Assistant } from "$lib/types/Assistant";
import { onMount } from "svelte";
import { applyAction, enhance } from "$app/forms";
import { base } from "$app/paths";
impo... | chat-ui/src/lib/components/AssistantSettings.svelte/0 | {
"file_path": "chat-ui/src/lib/components/AssistantSettings.svelte",
"repo_id": "chat-ui",
"token_count": 3724
} | 92 |
// 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/funcutil/slice_test.go/0 | {
"file_path": "milvus/pkg/util/funcutil/slice_test.go",
"repo_id": "milvus",
"token_count": 2004
} | 1,967 |
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?= -j auto
SPHINXBUILD ?= sphinx-build
SPHINXAUTOBUILD ?= sphinx-autobuild
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" wit... | langchain/docs/api_reference/Makefile/0 | {
"file_path": "langchain/docs/api_reference/Makefile",
"repo_id": "langchain",
"token_count": 276
} | 84 |
import logging
from typing import Any, List
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode
from llama_index.core.vector_stores.types import (
BasePydanticVectorStore,
VectorStoreQuery,
VectorStoreQueryResult,
)
from llama_index.core.vecto... | llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-pgvecto-rs/llama_index/vector_stores/pgvecto_rs/base.py/0 | {
"file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-pgvecto-rs/llama_index/vector_stores/pgvecto_rs/base.py",
"repo_id": "llama_index",
"token_count": 1091
} | 1,566 |
poetry_requirements(
name="poetry",
)
| llama_index/llama-index-integrations/indices/llama-index-indices-managed-zilliz/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-zilliz/BUILD",
"repo_id": "llama_index",
"token_count": 18
} | 1,297 |
# Documentation Guide
## A guide for docs contributors
The `docs` directory contains the sphinx source text for LlamaIndex docs, visit
https://docs.llamaindex.ai/en/stable/ to read the full documentation.
This guide is made for anyone who's interested in running LlamaIndex documentation locally,
making changes to it... | llama_index/docs/DOCS_README.md/0 | {
"file_path": "llama_index/docs/DOCS_README.md",
"repo_id": "llama_index",
"token_count": 465
} | 1,088 |
from transformers import PretrainedConfig
class CustomConfig(PretrainedConfig):
model_type = "custom"
def __init__(self, attribute=1, **kwargs):
self.attribute = attribute
super().__init__(**kwargs)
class NoSuperInitConfig(PretrainedConfig):
model_type = "custom"
def __init__(self,... | transformers/utils/test_module/custom_configuration.py/0 | {
"file_path": "transformers/utils/test_module/custom_configuration.py",
"repo_id": "transformers",
"token_count": 136
} | 768 |
<jupyter_start><jupyter_text>Recherche sémantique avec FAISS (PyTorch) Installez les bibliothèques 🤗 Transformers et 🤗 Datasets pour exécuter ce *notebook*.<jupyter_code>!pip install datasets evaluate transformers[sentencepiece]
!pip install faiss-gpu
from huggingface_hub import hf_hub_url
data_files = hf_hub_url(
... | notebooks/course/fr/chapter5/section6_pt.ipynb/0 | {
"file_path": "notebooks/course/fr/chapter5/section6_pt.ipynb",
"repo_id": "notebooks",
"token_count": 1233
} | 294 |
cluster:
enabled: true
log:
level: debug
image:
all:
repository: milvusdb/milvus
tag: master-latest
pullPolicy: IfNotPresent
indexNode:
resources:
requests:
cpu: 2
limits:
cpu: 8
etcd:
replicaCount: 3
image:
repository: milvusdb/etcd
tag: 3.5.5-r2
minio:
resourc... | milvus/tests/python_client/chaos/cluster-values.yaml/0 | {
"file_path": "milvus/tests/python_client/chaos/cluster-values.yaml",
"repo_id": "milvus",
"token_count": 1625
} | 2,029 |
# Copyright 2022 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/xtreme_s/xtreme_s.py/0 | {
"file_path": "datasets/metrics/xtreme_s/xtreme_s.py",
"repo_id": "datasets",
"token_count": 4467
} | 125 |
<jupyter_start><jupyter_text>SemaDB> [SemaDB](https://www.semafind.com/products/semadb) from [SemaFind](https://www.semafind.com) is a no fuss vector similarity database for building AI applications. The hosted `SemaDB Cloud` offers a no fuss developer experience to get started.The full documentation of the API along w... | langchain/docs/docs/integrations/vectorstores/semadb.ipynb/0 | {
"file_path": "langchain/docs/docs/integrations/vectorstores/semadb.ipynb",
"repo_id": "langchain",
"token_count": 927
} | 185 |
import os
from apache_beam.io.filesystems import FileSystems
from apache_beam.pipeline import Pipeline
from .logging import get_logger
CHUNK_SIZE = 2 << 20 # 2mb
logger = get_logger(__name__)
class BeamPipeline(Pipeline):
"""Wrapper over `apache_beam.pipeline.Pipeline` for convenience"""
def is_local(se... | datasets/src/datasets/utils/beam_utils.py/0 | {
"file_path": "datasets/src/datasets/utils/beam_utils.py",
"repo_id": "datasets",
"token_count": 847
} | 142 |
apiVersion: v1
kind: Service
metadata:
name: segment-server-lb
namespace: chroma
spec:
ports:
- name: segment-server-port
port: 50052
targetPort: 50051
selector:
app: segment-server
type: LoadBalancer
| chroma/k8s/test/segment_server_service.yml/0 | {
"file_path": "chroma/k8s/test/segment_server_service.yml",
"repo_id": "chroma",
"token_count": 88
} | 57 |
import { ChatOpenAI } from "@langchain/openai";
import { PromptTemplate } from "@langchain/core/prompts";
const model = new ChatOpenAI({
modelName: "badmodel",
});
const promptTemplate = PromptTemplate.fromTemplate(
"Tell me a joke about {topic}"
);
const chain = promptTemplate.pipe(model);
const result = await ... | langchainjs/examples/src/guides/expression_language/interface_batch_with_options.ts/0 | {
"file_path": "langchainjs/examples/src/guides/expression_language/interface_batch_with_options.ts",
"repo_id": "langchainjs",
"token_count": 712
} | 841 |
"""Wrapper around LLMRails vector database."""
from __future__ import annotations
import json
import logging
import os
import uuid
from typing import Any, Iterable, List, Optional, Tuple
import requests
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.... | langchain/libs/community/langchain_community/vectorstores/llm_rails.py/0 | {
"file_path": "langchain/libs/community/langchain_community/vectorstores/llm_rails.py",
"repo_id": "langchain",
"token_count": 3648
} | 329 |
from llama_index.readers.hatena_blog.base import HatenaBlogReader
__all__ = ["HatenaBlogReader"]
| llama_index/llama-index-integrations/readers/llama-index-readers-hatena-blog/llama_index/readers/hatena_blog/__init__.py/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-hatena-blog/llama_index/readers/hatena_blog/__init__.py",
"repo_id": "llama_index",
"token_count": 33
} | 1,507 |
"""Test text splitting functionality using NLTK and Spacy based sentence splitters."""
import pytest
from langchain.text_splitter import NLTKTextSplitter, SpacyTextSplitter
def test_nltk_text_splitting_args() -> None:
"""Test invalid arguments."""
with pytest.raises(ValueError):
NLTKTextSplitter(chun... | langchain/libs/langchain/tests/integration_tests/test_nlp_text_splitters.py/0 | {
"file_path": "langchain/libs/langchain/tests/integration_tests/test_nlp_text_splitters.py",
"repo_id": "langchain",
"token_count": 494
} | 643 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle::{IndexOp, D};
use clap::{Parser, ValueEnum};
#[derive(Clone, Copy, Debug, ValueEnum)]
enum Which {
SqueezeNet,
EfficientNet,
}
#[derive(Parser)]
struct Args {
#[arg(long)]
imag... | candle/candle-examples/examples/onnx/main.rs/0 | {
"file_path": "candle/candle-examples/examples/onnx/main.rs",
"repo_id": "candle",
"token_count": 1042
} | 48 |
import pytest
@pytest.fixture(scope="module")
def bloom_560m_sharded_handle(launcher):
with launcher("bigscience/bloom-560m", num_shard=2) as handle:
yield handle
@pytest.fixture(scope="module")
async def bloom_560m_sharded(bloom_560m_sharded_handle):
await bloom_560m_sharded_handle.health(240)
... | text-generation-inference/integration-tests/models/test_bloom_560m_sharded.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_bloom_560m_sharded.py",
"repo_id": "text-generation-inference",
"token_count": 511
} | 380 |
from typing import Any, Callable, Optional, Sequence
from llama_index.legacy.callbacks import CallbackManager
from llama_index.legacy.core.llms.types import (
ChatMessage,
CompletionResponse,
CompletionResponseGen,
LLMMetadata,
)
from llama_index.legacy.llms.base import llm_completion_callback
from lla... | llama_index/llama-index-legacy/llama_index/legacy/llms/mock.py/0 | {
"file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/mock.py",
"repo_id": "llama_index",
"token_count": 1182
} | 1,681 |
from __future__ import annotations
import logging
import uuid
from typing import Any, Iterable, List, Optional, Tuple
import numpy as np
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.vectorstores import VectorStore
from langchain_community.vectorst... | langchain/libs/community/langchain_community/vectorstores/dingo.py/0 | {
"file_path": "langchain/libs/community/langchain_community/vectorstores/dingo.py",
"repo_id": "langchain",
"token_count": 6179
} | 327 |
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | transformers/docs/source/en/perf_train_gpu_one.md/0 | {
"file_path": "transformers/docs/source/en/perf_train_gpu_one.md",
"repo_id": "transformers",
"token_count": 9952
} | 526 |
# Model arguments
model_name_or_path: teknium/OpenHermes-2.5-Mistral-7B
torch_dtype: null
# Data training arguments
dataset_mixer:
HuggingFaceH4/orca_dpo_pairs: 1.0
dataset_splits:
- train_prefs
- test_prefs
preprocessing_num_workers: 12
# Training arguments with sensible defaults
bf16: true
beta: 0.01
loss_type: s... | alignment-handbook/recipes/pref_align_scan/dpo/config_openhermes.yaml/0 | {
"file_path": "alignment-handbook/recipes/pref_align_scan/dpo/config_openhermes.yaml",
"repo_id": "alignment-handbook",
"token_count": 377
} | 19 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.