text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# ruff: noqa: E501 # fmt: off template = ( """ Transform the hypothetical whatif statement into JSON. Don't guess at any of the parts. Write NONE if you are unsure. {format_instructions} statement: if cindy's pet count was 4 # JSON: {{ "entity_settings" : [ {{ "name": "cindy", "attribute": "...
langchain/libs/experimental/langchain_experimental/cpal/templates/univariate/intervention.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/cpal/templates/univariate/intervention.py", "repo_id": "langchain", "token_count": 287 }
446
import re from abc import ABC, abstractmethod from typing import Any, Callable, Dict, List, Literal, Optional, Sequence, Union from langchain_core.callbacks import CallbackManagerForRetrieverRun from langchain_core.documents import Document from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator, valid...
langchain/libs/community/langchain_community/retrievers/kendra.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/kendra.py", "repo_id": "langchain", "token_count": 5334 }
277
/* eslint-disable spaced-comment */ import { PromptTemplate, ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate, AIMessagePromptTemplate, } from "@langchain/core/prompts"; import { ConditionalPromptSelector, isChatModel, } from "@langchain/core/example_selectors"; export const DE...
langchainjs/langchain/src/chains/question_answering/refine_prompts.ts/0
{ "file_path": "langchainjs/langchain/src/chains/question_answering/refine_prompts.ts", "repo_id": "langchainjs", "token_count": 853 }
883
[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 = ["PlaygroundsSubgraphConnectorToolSpec", "PlaygroundsSubgraphInspectorToolSpec"] contains_e...
llama_index/llama-index-integrations/tools/llama-index-tools-playgrounds/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-playgrounds/pyproject.toml", "repo_id": "llama_index", "token_count": 704 }
1,523
--- sidebar_class_name: node-only --- # Qdrant [Qdrant](https://qdrant.tech/) is a vector similarity search engine. It provides a production-ready service with a convenient API to store, search, and manage points - vectors with an additional payload. :::tip Compatibility Only available on Node.js. ::: ## Setup 1. ...
langchainjs/docs/core_docs/docs/integrations/vectorstores/qdrant.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/vectorstores/qdrant.mdx", "repo_id": "langchainjs", "token_count": 834 }
750
import json from textwrap import dedent from typing import List from langchain.prompts import PromptTemplate from langchain.schema import BaseOutputParser from langchain_experimental.tot.thought import ThoughtValidity def get_cot_prompt() -> PromptTemplate: return PromptTemplate( template_format="jinja2...
langchain/libs/experimental/langchain_experimental/tot/prompts.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/tot/prompts.py", "repo_id": "langchain", "token_count": 1930 }
470
<jupyter_start><jupyter_text>Azure AI Search[Azure AI Search](https://learn.microsoft.com/azure/search/search-what-is-azure-search) (formerly known as `Azure Search` and `Azure Cognitive Search`) is a cloud search service that gives developers infrastructure, APIs, and tools for building a rich search experience over p...
langchain/docs/docs/integrations/vectorstores/azuresearch.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/azuresearch.ipynb", "repo_id": "langchain", "token_count": 4330 }
189
package indexparamcheck import ( "strconv" "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/pkg/util/metric" ) func Test_ivfSQChecker_CheckTrain(t *testing.T) { getValidParams := func(withNBits bool) map[string]string { validP...
milvus/pkg/util/indexparamcheck/ivf_sq_checker_test.go/0
{ "file_path": "milvus/pkg/util/indexparamcheck/ivf_sq_checker_test.go", "repo_id": "milvus", "token_count": 1742 }
1,971
# coding=utf-8 # Copyright 2020 The Trax 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 copy of the License at...
transformers/src/transformers/models/reformer/modeling_reformer.py/0
{ "file_path": "transformers/src/transformers/models/reformer/modeling_reformer.py", "repo_id": "transformers", "token_count": 51149 }
650
<jupyter_start><jupyter_text>Evaluating an Extraction Chain[](https://colab.research.google.com/github/langchain-ai/langsmith-cookbook/blob/main/testing-examples/data-extraction/contract-extraction.ipynb)Structured data [extraction](https://python.langchain.com/docs/use_cases/extraction) from unstructured text is a cor...
langsmith-cookbook/testing-examples/data-extraction/contract-extraction.ipynb/0
{ "file_path": "langsmith-cookbook/testing-examples/data-extraction/contract-extraction.ipynb", "repo_id": "langsmith-cookbook", "token_count": 1584 }
1,040
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/src/segcore/SegmentSealedImpl.cpp/0
{ "file_path": "milvus/internal/core/src/segcore/SegmentSealedImpl.cpp", "repo_id": "milvus", "token_count": 31527 }
1,800
"""Test few shot prompt template.""" from typing import Any, Dict, List, Sequence, Tuple import pytest from langchain_core.example_selectors import BaseExampleSelector from langchain_core.messages import AIMessage, HumanMessage, SystemMessage from langchain_core.prompts import ( AIMessagePromptTemplate, ChatP...
langchain/libs/core/tests/unit_tests/prompts/test_few_shot.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/prompts/test_few_shot.py", "repo_id": "langchain", "token_count": 5447 }
406
import { BaseMessage } from "@langchain/core/messages"; import { BaseTransformOutputParser, StringOutputParser, } from "@langchain/core/output_parsers"; export type HttpResponseOutputParserInput = { outputParser?: BaseTransformOutputParser; contentType?: "text/plain" | "text/event-stream"; }; /** * OutputPar...
langchainjs/langchain/src/output_parsers/http_response.ts/0
{ "file_path": "langchainjs/langchain/src/output_parsers/http_response.ts", "repo_id": "langchainjs", "token_count": 796 }
897
python_sources()
llama_index/llama-index-packs/llama-index-packs-trulens-eval-packs/llama_index/packs/trulens_eval_packs/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-trulens-eval-packs/llama_index/packs/trulens_eval_packs/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,614
"""DashVector reader.""" from typing import Dict, List, Optional from llama_index.legacy.readers.base import BaseReader from llama_index.legacy.schema import Document class DashVectorReader(BaseReader): """DashVector reader. Args: api_key (str): DashVector API key. endpoint (str): DashVecto...
llama_index/llama-index-legacy/llama_index/legacy/readers/dashvector.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/dashvector.py", "repo_id": "llama_index", "token_count": 1278 }
1,759
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/models/vae_flax.py/0
{ "file_path": "diffusers/src/diffusers/models/vae_flax.py", "repo_id": "diffusers", "token_count": 14479 }
241
<jupyter_start><jupyter_text>Bittensor>[Bittensor](https://bittensor.com/) is a mining network, similar to Bitcoin, that includes built-in incentives designed to encourage miners to contribute compute + knowledge.>>`NIBittensorLLM` is developed by [Neural Internet](https://neuralinternet.ai/), powered by `Bittensor`.>T...
langchain/docs/docs/integrations/llms/bittensor.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/bittensor.ipynb", "repo_id": "langchain", "token_count": 1560 }
116
import { MessageContent } from "../messages/index.js"; import { ImagePromptValue, ImageContent } from "../prompt_values.js"; import type { InputValues, PartialValues } from "../utils/types.js"; import { BasePromptTemplate, BasePromptTemplateInput, TypedPromptInputValues, } from "./base.js"; import { TemplateForma...
langchainjs/langchain-core/src/prompts/image.ts/0
{ "file_path": "langchainjs/langchain-core/src/prompts/image.ts", "repo_id": "langchainjs", "token_count": 1830 }
863
#!/usr/bin/env python # 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...
transformers/examples/legacy/seq2seq/run_eval.py/0
{ "file_path": "transformers/examples/legacy/seq2seq/run_eval.py", "repo_id": "transformers", "token_count": 2791 }
582
from llama_index.callbacks.uptrain.base import UpTrainCallbackHandler __all__ = ["UpTrainCallbackHandler"]
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-uptrain/llama_index/callbacks/uptrain/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-uptrain/llama_index/callbacks/uptrain/__init__.py", "repo_id": "llama_index", "token_count": 31 }
1,250
"""Use a single chain to route an input to one of multiple retrieval qa chains.""" from __future__ import annotations from typing import Any, Dict, List, Mapping, Optional from langchain_community.chat_models import ChatOpenAI from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts im...
langchain/libs/langchain/langchain/chains/router/multi_retrieval_qa.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/router/multi_retrieval_qa.py", "repo_id": "langchain", "token_count": 1504 }
475
<jupyter_start><jupyter_text>DeepInfra[DeepInfra](https://deepinfra.com/?utm_source=langchain) is a serverless inference as a service that provides access to a [variety of LLMs](https://deepinfra.com/models?utm_source=langchain) and [embeddings models](https://deepinfra.com/models?type=embeddings&utm_source=langchain)....
langchain/docs/docs/integrations/text_embedding/deepinfra.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/deepinfra.ipynb", "repo_id": "langchain", "token_count": 544 }
168
"""PlaygroundsSubgraphConnectorToolSpec.""" from typing import Optional, Union import requests from llama_index.tools.graphql.base import GraphQLToolSpec class PlaygroundsSubgraphConnectorToolSpec(GraphQLToolSpec): """ Connects to subgraphs on The Graph's decentralized network via the Playgrounds API. ...
llama_index/llama-index-integrations/tools/llama-index-tools-playgrounds/llama_index/tools/playgrounds/subgraph_connector/base.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-playgrounds/llama_index/tools/playgrounds/subgraph_connector/base.py", "repo_id": "llama_index", "token_count": 1068 }
1,496
from langchain_openai.chat_models import __all__ EXPECTED_ALL = ["ChatOpenAI", "AzureChatOpenAI"] def test_all_imports() -> None: assert sorted(EXPECTED_ALL) == sorted(__all__)
langchain/libs/partners/openai/tests/unit_tests/chat_models/test_imports.py/0
{ "file_path": "langchain/libs/partners/openai/tests/unit_tests/chat_models/test_imports.py", "repo_id": "langchain", "token_count": 68 }
677
from typing import Any, Dict, List, Optional from llama_index.legacy.schema import BaseNode from llama_index.legacy.vector_stores.types import ( VectorStore, VectorStoreQuery, VectorStoreQueryResult, ) class MockVectorStore(VectorStore): stores_text: bool = True def __init__(self, config_dict: O...
llama_index/llama-index-legacy/tests/indices/composability/test_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/composability/test_utils.py", "repo_id": "llama_index", "token_count": 429 }
1,549
```haskell Expr := LogicalExpr | NIL LogicalExpr := LogicalExpr BinaryLogicalOp LogicalExpr | UnaryLogicalOp LogicalExpr | "(" LogicalExpr ")" | SingleExpr BinaryLogicalOp := "&&" | "and" | "||" | "or" UnaryLogicalOp := "not" SingleExpr := TermExpr | CompareExpr TermExpr := IDENTI...
milvus/docs/design_docs/20220105-query_boolean_expr.md/0
{ "file_path": "milvus/docs/design_docs/20220105-query_boolean_expr.md", "repo_id": "milvus", "token_count": 736 }
1,722
#!/bin/bash # 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...
milvus/tests/scripts/install_milvus.sh/0
{ "file_path": "milvus/tests/scripts/install_milvus.sh", "repo_id": "milvus", "token_count": 2802 }
1,987
import { expect, test } from '@jest/globals'; import chroma from './initClient' import { DOCUMENTS, EMBEDDINGS, IDS } from './data'; import { METADATAS } from './data'; import { IncludeEnum } from "../src/types"; import {OpenAIEmbeddingFunction} from "../src/embeddings/OpenAIEmbeddingFunction"; import {CohereEmbeddingF...
chroma/clients/js/test/add.collections.test.ts/0
{ "file_path": "chroma/clients/js/test/add.collections.test.ts", "repo_id": "chroma", "token_count": 1542 }
34
# coding=utf-8 # Copyright 2021 Tel AViv University, AllenAI 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.apache.org/...
transformers/src/transformers/models/splinter/tokenization_splinter_fast.py/0
{ "file_path": "transformers/src/transformers/models/splinter/tokenization_splinter_fast.py", "repo_id": "transformers", "token_count": 3965 }
659
# Additional Readings [[additional-readings]] These are **optional readings** if you want to go deeper. ## Monte Carlo and TD Learning [[mc-td]] To dive deeper into Monte Carlo and Temporal Difference Learning: - <a href="https://stats.stackexchange.com/questions/355820/why-do-temporal-difference-td-methods-have-lo...
deep-rl-class/units/en/unit2/additional-readings.mdx/0
{ "file_path": "deep-rl-class/units/en/unit2/additional-readings.mdx", "repo_id": "deep-rl-class", "token_count": 297 }
156
# Conversation buffer memory This notebook shows how to use `BufferMemory`. This memory allows for storing of messages, then later formats the messages into a prompt input variable. We can first extract it as a string. import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <Integra...
langchainjs/docs/core_docs/docs/modules/memory/types/buffer.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/memory/types/buffer.mdx", "repo_id": "langchainjs", "token_count": 473 }
734
package indexparamcheck import ( "fmt" ) // ivfSQChecker checks if a IVF_SQ index can be built. type ivfSQChecker struct { ivfBaseChecker } func (c *ivfSQChecker) checkNBits(params map[string]string) error { // cgo will set this key to DefaultNBits (8), which is the only value Milvus supports. _, exist := params...
milvus/pkg/util/indexparamcheck/ivf_sq_checker.go/0
{ "file_path": "milvus/pkg/util/indexparamcheck/ivf_sq_checker.go", "repo_id": "milvus", "token_count": 316 }
2,057
"""Base classes for scoring the output of a model on a scale of 1-10.""" from __future__ import annotations import logging import re from typing import Any, Dict, List, Optional, Union from langchain_community.chat_models.azure_openai import AzureChatOpenAI from langchain_community.chat_models.openai import ChatOpenA...
langchain/libs/langchain/langchain/evaluation/scoring/eval_chain.py/0
{ "file_path": "langchain/libs/langchain/langchain/evaluation/scoring/eval_chain.py", "repo_id": "langchain", "token_count": 6688 }
504
# LM Format Enforcer [LM Format Enforcer](https://github.com/noamgat/lm-format-enforcer) is a library that enforces the output format (JSON Schema, Regex etc) of a language model. Instead of just "suggesting" the desired output structure to the LLM, LM Format Enforcer can actually "force" the LLM output to follow the ...
llama_index/docs/community/integrations/lmformatenforcer.md/0
{ "file_path": "llama_index/docs/community/integrations/lmformatenforcer.md", "repo_id": "llama_index", "token_count": 1213 }
1,167
# Custom text splitters If you want to implement your own custom Text Splitter, you only need to subclass TextSplitter and implement a single method: `splitText`. The method takes a string and returns a list of strings. The returned strings will be used as the chunks. ```typescript abstract class TextSplitter { abs...
langchainjs/docs/core_docs/docs/modules/data_connection/document_transformers/custom_text_splitter.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/document_transformers/custom_text_splitter.mdx", "repo_id": "langchainjs", "token_count": 96 }
786
# flake8: noqa JSON_FORMAT_INSTRUCTIONS = """The output should be formatted as a JSON instance that conforms to the JSON schema below. As an example, for the schema {{"properties": {{"foo": {{"title": "Foo", "description": "a list of strings", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}} ...
langchain/libs/core/langchain_core/output_parsers/format_instructions.py/0
{ "file_path": "langchain/libs/core/langchain_core/output_parsers/format_instructions.py", "repo_id": "langchain", "token_count": 170 }
425
from langchain_community.document_loaders.xorbits import XorbitsLoader __all__ = ["XorbitsLoader"]
langchain/libs/langchain/langchain/document_loaders/xorbits.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/xorbits.py", "repo_id": "langchain", "token_count": 32 }
541
import pytest from langchain.schema import AIMessage, HumanMessage, SystemMessage from langchain_experimental.chat_models import Orca from tests.unit_tests.chat_models.test_llm_wrapper_llama2chat import FakeLLM @pytest.fixture def model() -> Orca: return Orca(llm=FakeLLM()) @pytest.fixture def model_cfg_sys_ms...
langchain/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_orca.py/0
{ "file_path": "langchain/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_orca.py", "repo_id": "langchain", "token_count": 342 }
451
from typing import Generator, cast import numpy as np import pytest import chromadb from chromadb.api.types import ( Embeddable, EmbeddingFunction, Embeddings, Image, Document, ) from chromadb.test.property.strategies import hashing_embedding_function from chromadb.test.property.invariants import _e...
chroma/chromadb/test/ef/test_multimodal_ef.py/0
{ "file_path": "chroma/chromadb/test/ef/test_multimodal_ef.py", "repo_id": "chroma", "token_count": 2081 }
25
import { BaseOutputParser } from "@langchain/core/output_parsers"; /** * The NoOpOutputParser class is a type of output parser that does not * perform any operations on the output. It extends the BaseOutputParser * class and is part of the LangChain's output parsers module. This class * is useful in scenarios wher...
langchainjs/langchain/src/output_parsers/noop.ts/0
{ "file_path": "langchainjs/langchain/src/output_parsers/noop.ts", "repo_id": "langchainjs", "token_count": 338 }
938
<!--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/ja/perf_train_cpu.md/0
{ "file_path": "transformers/docs/source/ja/perf_train_cpu.md", "repo_id": "transformers", "token_count": 1663 }
486
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image_vision_llm/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image_vision_llm/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,362
import { test } from "@jest/globals"; test("Test vectorstore", async () => { // Your test here });
langchainjs/libs/create-langchain-integration/template/src/tests/vectorstores.test.ts/0
{ "file_path": "langchainjs/libs/create-langchain-integration/template/src/tests/vectorstores.test.ts", "repo_id": "langchainjs", "token_count": 34 }
970
<jupyter_start><jupyter_text>Spark SQLThis notebook shows how to use agents to interact with `Spark SQL`. Similar to [SQL Database Agent](https://python.langchain.com/docs/integrations/toolkits/sql_database), it is designed to address general inquiries about `Spark SQL` and facilitate error recovery.**NOTE: Note that, ...
langchain/docs/docs/integrations/toolkits/spark_sql.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/toolkits/spark_sql.ipynb", "repo_id": "langchain", "token_count": 1477 }
183
<jupyter_start>
langchain/docs/docs/integrations/document_loaders/microsoft_onenote.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/microsoft_onenote.ipynb", "repo_id": "langchain", "token_count": 8 }
107
compute_environment: LOCAL_MACHINE deepspeed_config: {} distributed_type: 'NO' downcast_bf16: 'no' fsdp_config: {} gpu_ids: all machine_rank: 0 main_process_ip: null main_process_port: null main_training_function: main megatron_lm_config: {} mixed_precision: 'no' num_machines: 1 num_processes: 1 rdzv_backend: static sa...
accelerate/tests/test_configs/latest.yaml/0
{ "file_path": "accelerate/tests/test_configs/latest.yaml", "repo_id": "accelerate", "token_count": 186 }
15
.PHONY: all format lint test tests integration_tests docker_tests help extended_tests # Default target executed when no arguments are given to make. all: help # Define a variable for the test file path. TEST_FILE ?= tests/unit_tests/ integration_test integration_tests: TEST_FILE=tests/integration_tests/ test tests i...
langchain/libs/partners/anthropic/Makefile/0
{ "file_path": "langchain/libs/partners/anthropic/Makefile", "repo_id": "langchain", "token_count": 723 }
679
"""LangSmith Client.""" from importlib import metadata try: __version__ = metadata.version(__package__) except metadata.PackageNotFoundError: # Case where package metadata is not available. __version__ = "" from langsmith.client import Client from langsmith.evaluation.evaluator import EvaluationResult, Ru...
langsmith-sdk/python/langsmith/__init__.py/0
{ "file_path": "langsmith-sdk/python/langsmith/__init__.py", "repo_id": "langsmith-sdk", "token_count": 189 }
1,079
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/bert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/bert.md", "repo_id": "transformers", "token_count": 4642 }
450
import { logVersion010MigrationWarning } from "../../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "llms/googlevertexai/web", }); export * from "@langchain/community/llms/googlevertexai/web";
langchainjs/langchain/src/llms/googlevertexai/web.ts/0
{ "file_path": "langchainjs/langchain/src/llms/googlevertexai/web.ts", "repo_id": "langchainjs", "token_count": 81 }
966
# candle-onnx This crate adds ONNX support to candle ## FAQ #### Missing protoc installation when compiling candle-onnx The candle-onnx dependency prost-build no longer comes bundled with prost binaries. This could cause the following error when attempting to compile candle-onnx: ``` error: failed to run custom bu...
candle/candle-onnx/README.md/0
{ "file_path": "candle/candle-onnx/README.md", "repo_id": "candle", "token_count": 180 }
65
# Copyright 2024 Google Brain 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 requ...
diffusers/src/diffusers/schedulers/scheduling_sde_ve.py/0
{ "file_path": "diffusers/src/diffusers/schedulers/scheduling_sde_ve.py", "repo_id": "diffusers", "token_count": 5399 }
278
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction // import all entrypoints to test, do not do this in your own app import "../../entrypoints.js"; // Import a few things we'll use to test the exports import { LLMChain } from "langchain/chains"; import { ChatOpenAI } from "langchain/chat_mo...
langchainjs/environment_tests/test-exports-vercel/src/pages/api/hello-edge.ts/0
{ "file_path": "langchainjs/environment_tests/test-exports-vercel/src/pages/api/hello-edge.ts", "repo_id": "langchainjs", "token_count": 766 }
777
from llama_index.core.storage.chat_store.base import BaseChatStore from llama_index.core.storage.chat_store.simple_chat_store import SimpleChatStore __all__ = ["BaseChatStore", "SimpleChatStore"]
llama_index/llama-index-core/llama_index/core/storage/chat_store/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/storage/chat_store/__init__.py", "repo_id": "llama_index", "token_count": 60 }
1,178
#!/usr/bin/env python """Example that shows how to use `per_req_config_modifier`. This is a simple example that shows how to use configurable runnables with per request configuration modification to achieve behavior that's different depending on the user. You can build on these concepts to implement a more complex ap...
langserve/examples/auth/per_req_config_modifier/server.py/0
{ "file_path": "langserve/examples/auth/per_req_config_modifier/server.py", "repo_id": "langserve", "token_count": 2844 }
1,023
import { authCondition } from "$lib/server/auth"; import { collections } from "$lib/server/database"; import { error } from "@sveltejs/kit"; import { ObjectId } from "mongodb"; import { z } from "zod"; import type { RequestHandler } from "./$types"; import { downloadFile } from "$lib/server/files/downloadFile"; export...
chat-ui/src/routes/conversation/[id]/output/[sha256]/+server.ts/0
{ "file_path": "chat-ui/src/routes/conversation/[id]/output/[sha256]/+server.ts", "repo_id": "chat-ui", "token_count": 439 }
103
from llama_index.readers.wordlift.base import WordLiftLoader __all__ = ["WordLiftLoader"]
llama_index/llama-index-integrations/readers/llama-index-readers-wordlift/llama_index/readers/wordlift/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-wordlift/llama_index/readers/wordlift/__init__.py", "repo_id": "llama_index", "token_count": 31 }
1,461
from langchain_community.utilities.max_compute import MaxComputeAPIWrapper __all__ = ["MaxComputeAPIWrapper"]
langchain/libs/langchain/langchain/utilities/max_compute.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/max_compute.py", "repo_id": "langchain", "token_count": 35 }
618
import { OpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { RetrievalQAChain } from "langchain/chains"; import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; import * as fs from "fs"; // Initialize the LLM to use to ans...
langchainjs/examples/src/chains/retrieval_qa_legacy.ts/0
{ "file_path": "langchainjs/examples/src/chains/retrieval_qa_legacy.ts", "repo_id": "langchainjs", "token_count": 369 }
763
# coding=utf-8 # Copyright 2021 The Facebook Inc. 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.apache.org/licenses/LI...
transformers/src/transformers/models/blenderbot_small/tokenization_blenderbot_small.py/0
{ "file_path": "transformers/src/transformers/models/blenderbot_small/tokenization_blenderbot_small.py", "repo_id": "transformers", "token_count": 4456 }
573
import { type ClientOptions, OpenAI as OpenAIClient } from "openai"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { Embeddings, type EmbeddingsParams } from "@langchain/core/embeddings"; import { chunkArray } from "@langchain/core/utils/chunk_array"; import { AzureOpenAIInput, OpenAICo...
langchainjs/libs/langchain-openai/src/embeddings.ts/0
{ "file_path": "langchainjs/libs/langchain-openai/src/embeddings.ts", "repo_id": "langchainjs", "token_count": 3422 }
1,009
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
accelerate/manim_animations/big_model_inference/stage_5.py/0
{ "file_path": "accelerate/manim_animations/big_model_inference/stage_5.py", "repo_id": "accelerate", "token_count": 4175 }
6
# Stable Diffusion Deep Dive <CourseFloatingBanner unit={3} classNames="absolute z-10 right-0 top-0" notebooks={[ {label: "Stable Diffusion Deep Dive", value: "https://colab.research.google.com/github/huggingface/diffusion-models-class/blob/main/units/en/unit3/stable_diffusion_deep_dive.ipynb"}, {label: "S...
diffusion-models-class/units/en/unit3/3.mdx/0
{ "file_path": "diffusion-models-class/units/en/unit3/3.mdx", "repo_id": "diffusion-models-class", "token_count": 20868 }
296
import s3fs from ..utils.deprecation_utils import deprecated @deprecated("Use s3fs.S3FileSystem instead.") class S3FileSystem(s3fs.S3FileSystem): """ `datasets.filesystems.S3FileSystem` is a subclass of [`s3fs.S3FileSystem`](https://s3fs.readthedocs.io/en/latest/api.html). Users can use this class to ac...
datasets/src/datasets/filesystems/s3filesystem.py/0
{ "file_path": "datasets/src/datasets/filesystems/s3filesystem.py", "repo_id": "datasets", "token_count": 2170 }
142
macro(set_option_category name) set(MILVUS_OPTION_CATEGORY ${name}) list(APPEND "MILVUS_OPTION_CATEGORIES" ${name}) endmacro() macro(define_option name description default) option(${name} ${description} ${default}) list(APPEND "MILVUS_${MILVUS_OPTION_CATEGORY}_OPTION_NAMES" ${name}) set("${name}_O...
milvus/internal/core/cmake/DefineOptions.cmake/0
{ "file_path": "milvus/internal/core/cmake/DefineOptions.cmake", "repo_id": "milvus", "token_count": 2304 }
1,720
from rag_momento_vector_index.chain import chain __all__ = ["chain"]
langchain/templates/rag-momento-vector-index/rag_momento_vector_index/__init__.py/0
{ "file_path": "langchain/templates/rag-momento-vector-index/rag_momento_vector_index/__init__.py", "repo_id": "langchain", "token_count": 23 }
735
"""Milvus reader.""" from typing import Any, Dict, List, Optional from uuid import uuid4 from llama_index.legacy.readers.base import BaseReader from llama_index.legacy.schema import Document class MilvusReader(BaseReader): """Milvus reader.""" def __init__( self, host: str = "localhost", ...
llama_index/llama-index-legacy/llama_index/legacy/readers/milvus.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/milvus.py", "repo_id": "llama_index", "token_count": 2225 }
1,764
libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: Rdkafka Description: RdKafka Version: @RDKAFKA_VERSION@ Libs: -L${libdir} -lrdkafka # Libs.private: -lz -lbz2 Cflags: -I${includedir}
milvus/internal/core/thirdparty/rdkafka/rdkafka.pc.in/0
{ "file_path": "milvus/internal/core/thirdparty/rdkafka/rdkafka.pc.in", "repo_id": "milvus", "token_count": 106 }
1,750
"""Managed index. A managed Index - where the index is accessible via some API that interfaces a managed service. """ import json import logging import os from concurrent.futures import ThreadPoolExecutor from hashlib import blake2b from typing import Any, Dict, List, Optional, Sequence, Type import requests from l...
llama_index/llama-index-integrations/indices/llama-index-indices-managed-vectara/llama_index/indices/managed/vectara/base.py/0
{ "file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-vectara/llama_index/indices/managed/vectara/base.py", "repo_id": "llama_index", "token_count": 6411 }
1,384
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
accelerate/src/accelerate/utils/torch_xla.py/0
{ "file_path": "accelerate/src/accelerate/utils/torch_xla.py", "repo_id": "accelerate", "token_count": 691 }
14
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/models/fnet/__init__.py/0
{ "file_path": "transformers/src/transformers/models/fnet/__init__.py", "repo_id": "transformers", "token_count": 1260 }
607
# coding=utf-8 # Copyright 2021 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...
transformers/tests/models/efficientformer/test_image_processing_efficientformer.py/0
{ "file_path": "transformers/tests/models/efficientformer/test_image_processing_efficientformer.py", "repo_id": "transformers", "token_count": 1379 }
798
from langchain_community.document_loaders.parsers import __all__ def test_parsers_public_api_correct() -> None: """Test public API of parsers for breaking changes.""" assert set(__all__) == { "AzureAIDocumentIntelligenceParser", "BS4HTMLParser", "DocAIParser", "GrobidParser", ...
langchain/libs/community/tests/unit_tests/document_loaders/parsers/test_public_api.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/parsers/test_public_api.py", "repo_id": "langchain", "token_count": 244 }
398
# From Q-Learning to Deep Q-Learning [[from-q-to-dqn]] We learned that **Q-Learning is an algorithm we use to train our Q-Function**, an **action-value function** that determines the value of being at a particular state and taking a specific action at that state. <figure> <img src="https://huggingface.co/datasets/h...
deep-rl-class/units/en/unit3/from-q-to-dqn.mdx/0
{ "file_path": "deep-rl-class/units/en/unit3/from-q-to-dqn.mdx", "repo_id": "deep-rl-class", "token_count": 733 }
161
.PHONY: start start: uvicorn main:app --reload --port 8080 .PHONY: format format: black . isort .
weblangchain/Makefile/0
{ "file_path": "weblangchain/Makefile", "repo_id": "weblangchain", "token_count": 42 }
2,210
# LlamaIndex Chat_Store Integration: Redis Chat Store
llama_index/llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-redis/README.md/0
{ "file_path": "llama_index/llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-redis/README.md", "repo_id": "llama_index", "token_count": 14 }
1,410
import pytest from test_utils import MockEncoder import langchain_experimental.rl_chain.base as rl_chain import langchain_experimental.rl_chain.pick_best_chain as pick_best_chain encoded_keyword = "[encoded]" @pytest.mark.requires("vowpal_wabbit_next") def test_pickbest_textembedder_missing_context_throws() -> None...
langchain/libs/experimental/tests/unit_tests/rl_chain/test_pick_best_text_embedder.py/0
{ "file_path": "langchain/libs/experimental/tests/unit_tests/rl_chain/test_pick_best_text_embedder.py", "repo_id": "langchain", "token_count": 6574 }
452
from llama_index.core.indices.base import BaseIndex from llama_index.indices.managed.colbert import ColbertIndex def test_class(): names_of_base_classes = [b.__name__ for b in ColbertIndex.__mro__] assert BaseIndex.__name__ in names_of_base_classes
llama_index/llama-index-integrations/indices/llama-index-indices-managed-colbert/tests/test_indices_managed_colbert.py/0
{ "file_path": "llama_index/llama-index-integrations/indices/llama-index-indices-managed-colbert/tests/test_indices_managed_colbert.py", "repo_id": "llama_index", "token_count": 88 }
1,382
from langchain_community.output_parsers.rail_parser import ( GuardrailsOutputParser, ) __all__ = ["GuardrailsOutputParser"]
langchain/libs/langchain/langchain/output_parsers/rail_parser.py/0
{ "file_path": "langchain/libs/langchain/langchain/output_parsers/rail_parser.py", "repo_id": "langchain", "token_count": 43 }
525
"""Test agent executor.""" import uuid from typing import Any, cast from llama_index.legacy.agent.runner.base import AgentRunner from llama_index.legacy.agent.runner.parallel import ParallelAgentRunner from llama_index.legacy.agent.types import ( BaseAgentWorker, Task, TaskStep, TaskStepOutput, ) from...
llama_index/llama-index-legacy/tests/agent/runner/test_base.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/agent/runner/test_base.py", "repo_id": "llama_index", "token_count": 3991 }
1,626
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,613
from langchain_community.llms.promptlayer_openai import ( PromptLayerOpenAI, PromptLayerOpenAIChat, ) __all__ = ["PromptLayerOpenAI", "PromptLayerOpenAIChat"]
langchain/libs/langchain/langchain/llms/promptlayer_openai.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/promptlayer_openai.py", "repo_id": "langchain", "token_count": 60 }
515
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/zh/fast_tokenizers.md/0
{ "file_path": "transformers/docs/source/zh/fast_tokenizers.md", "repo_id": "transformers", "token_count": 1249 }
548
from llama_index.packs.llava_completion.base import LlavaCompletionPack __all__ = ["LlavaCompletionPack"]
llama_index/llama-index-packs/llama-index-packs-llava-completion/llama_index/packs/llava_completion/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-llava-completion/llama_index/packs/llava_completion/__init__.py", "repo_id": "llama_index", "token_count": 36 }
1,659
from xml_agent.agent import agent_executor if __name__ == "__main__": question = "who won the womens world cup in 2023?" print(agent_executor.invoke({"question": question, "chat_history": []})) # noqa: T201
langchain/templates/xml-agent/main.py/0
{ "file_path": "langchain/templates/xml-agent/main.py", "repo_id": "langchain", "token_count": 75 }
760
<jupyter_start><jupyter_text>Advanced Prompt Techniques (Variable Mappings, Functions)In this notebook we show some advanced prompt techniques. These features allow you to define more custom/expressive prompts, re-use existing ones, and also express certain operations in fewer lines of code.We show the following featur...
llama_index/docs/examples/prompts/advanced_prompts.ipynb/0
{ "file_path": "llama_index/docs/examples/prompts/advanced_prompts.ipynb", "repo_id": "llama_index", "token_count": 1584 }
1,206
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-milvus/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-milvus/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,352
from llama_index.readers.qdrant.base import QdrantReader __all__ = ["QdrantReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-qdrant/llama_index/readers/qdrant/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-qdrant/llama_index/readers/qdrant/__init__.py", "repo_id": "llama_index", "token_count": 32 }
1,430
<jupyter_start><jupyter_text>Google Translate[Google Translate](https://translate.google.com/) is a multilingual neural machine translation service developed by Google to translate text, documents and websites from one language into another.The `GoogleTranslateTransformer` allows you to translate text and HTML with the...
langchain/docs/docs/integrations/document_transformers/google_translate.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_transformers/google_translate.ipynb", "repo_id": "langchain", "token_count": 1567 }
110
## Data Connector Examples Each of these notebooks showcase our readers which can read data from a variety of data sources.
llama_index/docs/examples/data_connectors/README.md/0
{ "file_path": "llama_index/docs/examples/data_connectors/README.md", "repo_id": "llama_index", "token_count": 26 }
1,095
<jupyter_start><jupyter_text>Google PlacesThis notebook goes through how to use Google Places API<jupyter_code>%pip install --upgrade --quiet googlemaps import os os.environ["GPLACES_API_KEY"] = "" from langchain.tools import GooglePlacesTool places = GooglePlacesTool() places.run("al fornos")<jupyter_output><empty_o...
langchain/docs/docs/integrations/tools/google_places.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/google_places.ipynb", "repo_id": "langchain", "token_count": 108 }
175
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/retrievers/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/retrievers/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,640
# as due to their complexity multi-gpu tests could impact other tests, and to aid debug we have those in a separate module. import os import sys from pathlib import Path import torch from transformers.testing_utils import TestCasePlus, execute_subprocess_async, require_torch_multi_gpu from utils import load_json C...
transformers/examples/research_projects/seq2seq-distillation/_test_seq2seq_examples_multi_gpu.py/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/_test_seq2seq_examples_multi_gpu.py", "repo_id": "transformers", "token_count": 2691 }
601
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/models/plbart/__init__.py/0
{ "file_path": "transformers/src/transformers/models/plbart/__init__.py", "repo_id": "transformers", "token_count": 932 }
668
<jupyter_start><jupyter_text>Prior to running the below make sure that you have an HF server running:You can run:```bashdocker compose -f examples/server_side_embeddings/huggingface/docker-compose.yml up -d```<jupyter_code>%cd ../../../ import chromadb from chromadb.utils.embedding_functions import HuggingFaceEmbeddin...
chroma/examples/server_side_embeddings/huggingface/test.ipynb/0
{ "file_path": "chroma/examples/server_side_embeddings/huggingface/test.ipynb", "repo_id": "chroma", "token_count": 218 }
42
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/llms/llama-index-llms-monsterapi/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-monsterapi/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,315
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-opendal/llama_index/readers/opendal/gcs/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-opendal/llama_index/readers/opendal/gcs/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,359
from langchain_community.document_loaders.ifixit import IFixitLoader def test_ifixit_loader() -> None: """Test iFixit loader.""" web_path = "https://www.ifixit.com/Guide/iPad+9+Battery+Replacement/151279" loader = IFixitLoader(web_path) assert loader.page_type == "Guide" assert loader.id == "15127...
langchain/libs/community/tests/integration_tests/document_loaders/test_ifixit.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_ifixit.py", "repo_id": "langchain", "token_count": 476 }
324
python_tests()
llama_index/llama-index-packs/llama-index-packs-sentence-window-retriever/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-sentence-window-retriever/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,676
# Milvus offline installation ## Manually downloading Docker images Milvus installation may fail when images are not properly loaded from public Docker registries. To pull all images and save them into a directory that can be moved to the target host and loaded manually, perform the following procedures: ### Step 1:...
milvus/deployments/offline/README.md/0
{ "file_path": "milvus/deployments/offline/README.md", "repo_id": "milvus", "token_count": 895 }
1,731