text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from typing import Optional import torch import torch.nn as nn import torch.nn.functional as F from .config import use_fused_attn from .mlp import Mlp from .weight_init import trunc_normal_tf_ class AttentionPoolLatent(nn.Module): """ Attention pooling w/ latent query """ fused_attn: torch.jit.Final[boo...
pytorch-image-models/timm/layers/attention_pool.py/0
{ "file_path": "pytorch-image-models/timm/layers/attention_pool.py", "repo_id": "pytorch-image-models", "token_count": 1758 }
330
# RSS News Loader This loader allows fetching text from an RSS feed. It uses the `feedparser` module to fetch the feed and the `NewsArticleReader` to load each article. ## Usage To use this loader, pass in an array of URLs of RSS feeds. It will download the pages referenced in each feed and combine them: ```python ...
llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/rss_news/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/rss_news/README.md", "repo_id": "llama_index", "token_count": 308 }
1,434
from typing import Any, Iterator, List, Optional, Sequence, Tuple, cast from langchain_core._api.deprecation import deprecated from langchain_core.stores import BaseStore, ByteStore class _UpstashRedisStore(BaseStore[str, str]): """BaseStore implementation using Upstash Redis as the underlying store.""" def...
langchain/libs/community/langchain_community/storage/upstash_redis.py/0
{ "file_path": "langchain/libs/community/langchain_community/storage/upstash_redis.py", "repo_id": "langchain", "token_count": 2653 }
276
[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 = ["S3Reader"] contains_example = false import_path = "llama_index.readers.s3" [tool.mypy] d...
llama_index/llama-index-integrations/readers/llama-index-readers-s3/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-s3/pyproject.toml", "repo_id": "llama_index", "token_count": 675 }
1,415
from llama_index.core.readers.base import BaseReader from llama_index.readers.reddit import RedditReader def test_class(): names_of_base_classes = [b.__name__ for b in RedditReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-reddit/tests/test_readers_reddit.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-reddit/tests/test_readers_reddit.py", "repo_id": "llama_index", "token_count": 85 }
1,365
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/yoso.md/0
{ "file_path": "transformers/docs/source/en/model_doc/yoso.md", "repo_id": "transformers", "token_count": 1243 }
520
"""Test EdenAI Chat API wrapper.""" from typing import List import pytest from langchain_core.messages import BaseMessage, HumanMessage, SystemMessage from langchain_community.chat_models.edenai import ( _format_edenai_messages, _message_role, ) @pytest.mark.parametrize( ("messages", "expected"), [ ...
langchain/libs/community/tests/unit_tests/chat_models/test_edenai.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/chat_models/test_edenai.py", "repo_id": "langchain", "token_count": 491 }
384
import { Document } from "@langchain/core/documents"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { BaseDocumentLoader } from "../base.js"; type JSONPrimitive = string | number | boolean | null; type JSONValue = JSONPrimitive | JSONObject | JSONArray; interface JSONObject { [key: strin...
langchainjs/langchain/src/document_loaders/web/searchapi.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/web/searchapi.ts", "repo_id": "langchainjs", "token_count": 1833 }
927
<jupyter_start><jupyter_text>RELLM[RELLM](https://github.com/r2d4/rellm) is a library that wraps local Hugging Face pipeline models for structured decoding.It works by generating tokens one at a time. At each step, it masks tokens that don't conform to the provided partial regular expression.**Warning - this module is ...
langchain/docs/docs/integrations/llms/rellm_experimental.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/rellm_experimental.ipynb", "repo_id": "langchain", "token_count": 780 }
132
import { WebGoogleAuth, WebGoogleAuthOptions, } from "../../utils/googlevertexai-webauth.js"; import { GoogleVertexAILLMConnection } from "../../utils/googlevertexai-connection.js"; import { GoogleVertexAIBaseLLMInput } from "../../types/googlevertexai-types.js"; import { BaseGoogleVertexAI } from "./common.js"; /...
langchainjs/libs/langchain-community/src/llms/googlevertexai/web.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/llms/googlevertexai/web.ts", "repo_id": "langchainjs", "token_count": 634 }
1,026
apiVersion: chaos-mesh.org/v1alpha1 kind: PodChaos metadata: name: test-datanode-pod-failure namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: app.kubernetes.io/instance: milvus-chaos component: datanode mode: fixed value: "1" action: pod-failure ...
milvus/tests/python_client/chaos/chaos_objects/pod_failure/chaos_datanode_pod_failure.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/pod_failure/chaos_datanode_pod_failure.yaml", "repo_id": "milvus", "token_count": 144 }
1,887
import { AIMessage, type BaseMessage, getBufferString, } from "../messages/index.js"; import type { BasePromptValueInterface } from "../prompt_values.js"; import { type LLMResult, RUN_KEY, type Generation, GenerationChunk, } from "../outputs.js"; import { type BaseCallbackConfig, CallbackManager, ty...
langchainjs/langchain-core/src/language_models/llms.ts/0
{ "file_path": "langchainjs/langchain-core/src/language_models/llms.ts", "repo_id": "langchainjs", "token_count": 6292 }
925
[tool.poetry] name = "astradb_entomology_rag" version = "0.0.1" description = "RAG using AstraDB" authors = [ "Stefano Lottini <stefano.lottini@datastax.com>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" openai = "<2" tiktoken = "^0.5.1" astrapy = "^0.5.3" [tool.po...
langchain/templates/rag-astradb/pyproject.toml/0
{ "file_path": "langchain/templates/rag-astradb/pyproject.toml", "repo_id": "langchain", "token_count": 302 }
673
from langchain_core.prompts.few_shot import ( FewShotChatMessagePromptTemplate, FewShotPromptTemplate, _FewShotPromptTemplateMixin, ) __all__ = [ "FewShotPromptTemplate", "FewShotChatMessagePromptTemplate", "_FewShotPromptTemplateMixin", ]
langchain/libs/langchain/langchain/prompts/few_shot.py/0
{ "file_path": "langchain/libs/langchain/langchain/prompts/few_shot.py", "repo_id": "langchain", "token_count": 99 }
536
use candle::{Device, Result, Tensor}; pub fn linspace(start: f64, stop: f64, steps: usize) -> Result<Tensor> { if steps == 0 { Tensor::from_vec(Vec::<f64>::new(), steps, &Device::Cpu) } else if steps == 1 { Tensor::from_vec(vec![start], steps, &Device::Cpu) } else { let delta = (sto...
candle/candle-transformers/src/models/stable_diffusion/utils.rs/0
{ "file_path": "candle/candle-transformers/src/models/stable_diffusion/utils.rs", "repo_id": "candle", "token_count": 979 }
76
<!--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/de/add_new_pipeline.md/0
{ "file_path": "transformers/docs/source/de/add_new_pipeline.md", "repo_id": "transformers", "token_count": 4595 }
430
<!--- 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 a...
transformers/examples/README.md/0
{ "file_path": "transformers/examples/README.md", "repo_id": "transformers", "token_count": 3292 }
540
from langchain_community.chat_loaders.utils import ( map_ai_messages, map_ai_messages_in_session, merge_chat_runs, merge_chat_runs_in_session, ) __all__ = [ "merge_chat_runs_in_session", "merge_chat_runs", "map_ai_messages_in_session", "map_ai_messages", ]
langchain/libs/langchain/langchain/chat_loaders/utils.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_loaders/utils.py", "repo_id": "langchain", "token_count": 132 }
502
from typing import Any, Dict, List, Optional from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import BaseModel, root_validator from langchain_core.utils import get_from_dict_or_env class AlephAlphaAsymmetricSemanticEmbedding(BaseModel, Embeddings): """Aleph Alpha's asymmetric sema...
langchain/libs/community/langchain_community/embeddings/aleph_alpha.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/aleph_alpha.py", "repo_id": "langchain", "token_count": 3984 }
267
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/ko/using-diffusers/unconditional_image_generation.md/0
{ "file_path": "diffusers/docs/source/ko/using-diffusers/unconditional_image_generation.md", "repo_id": "diffusers", "token_count": 1741 }
193
// 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/sessionutil/session_util.go/0
{ "file_path": "milvus/internal/util/sessionutil/session_util.go", "repo_id": "milvus", "token_count": 14051 }
1,886
# coding=utf-8 # Copyright 2021 The Fairseq Authors and The Google Flax Team Authors 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 # # ...
transformers/src/transformers/models/bart/modeling_flax_bart.py/0
{ "file_path": "transformers/src/transformers/models/bart/modeling_flax_bart.py", "repo_id": "transformers", "token_count": 36357 }
645
# coding=utf-8 # Copyright 2018 Google T5 Authors and HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
transformers/tests/models/t5/test_modeling_tf_t5.py/0
{ "file_path": "transformers/tests/models/t5/test_modeling_tf_t5.py", "repo_id": "transformers", "token_count": 21525 }
817
from langchain_exa import ExaFindSimilarResults def test_similarity_tool() -> None: tool = ExaFindSimilarResults() res = tool.invoke( { "url": "https://boutiquejapan.com/when-is-the-best-time-of-year-to-visit-japan/", "num_results": 5, } ) print(res) # noqa: T2...
langchain/libs/partners/exa/tests/integration_tests/test_find_similar_tool.py/0
{ "file_path": "langchain/libs/partners/exa/tests/integration_tests/test_find_similar_tool.py", "repo_id": "langchain", "token_count": 175 }
620
from langchain_community.document_loaders.whatsapp_chat import ( WhatsAppChatLoader, concatenate_rows, ) __all__ = ["concatenate_rows", "WhatsAppChatLoader"]
langchain/libs/langchain/langchain/document_loaders/whatsapp_chat.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/whatsapp_chat.py", "repo_id": "langchain", "token_count": 60 }
496
<!--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/distilled_sd.md/0
{ "file_path": "diffusers/docs/source/en/using-diffusers/distilled_sd.md", "repo_id": "diffusers", "token_count": 1680 }
190
# 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/examples/community/pipeline_animatediff_img2video.py/0
{ "file_path": "diffusers/examples/community/pipeline_animatediff_img2video.py", "repo_id": "diffusers", "token_count": 20518 }
205
//! Group Normalization. //! //! This layer applies Group Normalization over a mini-batch of inputs. use candle::{DType, Result, Tensor}; // This group norm version handles both weight and bias so removes the mean. #[derive(Clone, Debug)] pub struct GroupNorm { weight: Tensor, bias: Tensor, eps: f64, n...
candle/candle-nn/src/group_norm.rs/0
{ "file_path": "candle/candle-nn/src/group_norm.rs", "repo_id": "candle", "token_count": 1372 }
60
import pytest from llama_index.core import ( Document, ServiceContext, TreeIndex, ) from llama_index.core.indices.tree.select_leaf_retriever import ( TreeSelectLeafRetriever, ) from llama_index.core.query_engine.retriever_query_engine import ( RetrieverQueryEngine, ) try: from llama_index.llms....
llama_index/llama-index-core/tests/query_engine/test_retriever_query_engine.py/0
{ "file_path": "llama_index/llama-index-core/tests/query_engine/test_retriever_query_engine.py", "repo_id": "llama_index", "token_count": 622 }
1,166
"""Google Trends API Toolkit.""" from langchain_community.tools.google_trends.tool import GoogleTrendsQueryRun __all__ = ["GoogleTrendsQueryRun"]
langchain/libs/community/langchain_community/tools/google_trends/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/google_trends/__init__.py", "repo_id": "langchain", "token_count": 45 }
311
[tool.poetry] name = "sql-llama2" version = "0.1.0" description = "QA with a SQL database using natural language and LLaMA2-13b" authors = [ "Lance Martin <lance@langchain.dev>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" replicate = ">=0.15.4" [tool.poetry.group....
langchain/templates/sql-llama2/pyproject.toml/0
{ "file_path": "langchain/templates/sql-llama2/pyproject.toml", "repo_id": "langchain", "token_count": 272 }
707
import { RunnableConfig } from "../runnables/config.js"; import { BaseTracer, Run } from "./base.js"; export class RootListenersTracer extends BaseTracer { name = "RootListenersTracer"; /** The Run's ID. Type UUID */ rootId?: string; config: RunnableConfig; argOnStart?: { (run: Run): void | Promise<vo...
langchainjs/langchain-core/src/tracers/root_listener.ts/0
{ "file_path": "langchainjs/langchain-core/src/tracers/root_listener.ts", "repo_id": "langchainjs", "token_count": 931 }
905
"""Download pypi package.""" import importlib import subprocess import sys from typing import Any def pip_install(package: str): subprocess.check_call([sys.executable, "-m", "pip", "install", package]) def download_integration(module_str: str, module_import_str: str, cls_name: str) -> Any: """Returns an in...
llama_index/llama-index-core/llama_index/core/download/integration.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/download/integration.py", "repo_id": "llama_index", "token_count": 359 }
1,206
import os # import socket from typing import Any, List, Optional import openai import pytest from llama_index.core.base.llms.types import LLMMetadata from llama_index.core.llms.mock import MockLLM from llama_index.core.node_parser.text import SentenceSplitter, TokenTextSplitter from llama_index.core.service_context i...
llama_index/llama-index-core/tests/conftest.py/0
{ "file_path": "llama_index/llama-index-core/tests/conftest.py", "repo_id": "llama_index", "token_count": 2298 }
1,258
# Metric Card for SQuAD v2 ## Metric description This metric wraps the official scoring script for version 2 of the [Stanford Question Answering Dataset (SQuAD)](https://huggingface.co/datasets/squad_v2). SQuAD is a reading comprehension dataset, consisting of questions posed by crowdworkers on a set of Wikipedia art...
datasets/metrics/squad_v2/README.md/0
{ "file_path": "datasets/metrics/squad_v2/README.md", "repo_id": "datasets", "token_count": 2372 }
125
from langchain_community.vectorstores.databricks_vector_search import ( DatabricksVectorSearch, ) __all__ = ["DatabricksVectorSearch"]
langchain/libs/langchain/langchain/vectorstores/databricks_vector_search.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/databricks_vector_search.py", "repo_id": "langchain", "token_count": 44 }
626
<jupyter_start><jupyter_text>Text Embeddings Inference>[Hugging Face Text Embeddings Inference (TEI)](https://huggingface.co/docs/text-generation-inference/index) is a toolkit for deploying and serving open-source> text embeddings and sequence classification models. `TEI` enables high-performance extraction for the mos...
langchain/docs/docs/integrations/text_embedding/text_embeddings_inference.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/text_embeddings_inference.ipynb", "repo_id": "langchain", "token_count": 441 }
179
<jupyter_start><jupyter_text>SageMakerLet's load the `SageMaker Endpoints Embeddings` class. The class can be used if you host, e.g. your own Hugging Face model on SageMaker.For instructions on how to do this, please see [here](https://www.philschmid.de/custom-inference-huggingface-sagemaker). **Note**: In order to han...
langchain/docs/docs/integrations/text_embedding/sagemaker-endpoint.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/sagemaker-endpoint.ipynb", "repo_id": "langchain", "token_count": 1062 }
172
from transformers import CLIPImageProcessor class CustomImageProcessor(CLIPImageProcessor): pass
transformers/utils/test_module/custom_image_processing.py/0
{ "file_path": "transformers/utils/test_module/custom_image_processing.py", "repo_id": "transformers", "token_count": 29 }
858
# coding=utf-8 # Copyright 2023 HuggingFace Inc. team and MosaicML NLP team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
transformers/src/transformers/models/mpt/configuration_mpt.py/0
{ "file_path": "transformers/src/transformers/models/mpt/configuration_mpt.py", "repo_id": "transformers", "token_count": 4467 }
703
# flake8: noqa from langchain_core.prompts import PromptTemplate DEFAULT_REFINE_PROMPT_TMPL = ( "The original question is as follows: {question}\n" "We have provided an existing answer, including sources: {existing_answer}\n" "We have the opportunity to refine the existing answer" "(only if needed) wit...
langchain/libs/langchain/langchain/chains/qa_with_sources/refine_prompts.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/qa_with_sources/refine_prompts.py", "repo_id": "langchain", "token_count": 455 }
487
# coding=utf-8 # Copyright 2024 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...
diffusers/src/diffusers/models/modeling_pytorch_flax_utils.py/0
{ "file_path": "diffusers/src/diffusers/models/modeling_pytorch_flax_utils.py", "repo_id": "diffusers", "token_count": 3050 }
225
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-elasticsearch/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-elasticsearch/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,396
from langchain_community.tools.bearly.tool import ( BearlyInterpreterTool, BearlyInterpreterToolArguments, FileInfo, ) __all__ = [ "BearlyInterpreterToolArguments", "FileInfo", "BearlyInterpreterTool", ]
langchain/libs/langchain/langchain/tools/bearly/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/bearly/tool.py", "repo_id": "langchain", "token_count": 91 }
547
{ "details": { "best_of_sequences": null, "finish_reason": "stop_sequence", "generated_tokens": 5, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 4321, "logprob": -8.6875, "text": "Test" }, { "id":...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama_all_params.json", "repo_id": "text-generation-inference", "token_count": 669 }
374
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-jaguar/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-jaguar/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,392
import { SitemapLoader } from "langchain/document_loaders/web/sitemap"; const loader = new SitemapLoader("https://www.langchain.com/"); const sitemap = await loader.parseSitemap(); console.log(sitemap); /** [ { loc: 'https://www.langchain.com/blog-detail/starting-a-career-in-design', changefreq: '', las...
langchainjs/examples/src/document_loaders/parse_sitemap.ts/0
{ "file_path": "langchainjs/examples/src/document_loaders/parse_sitemap.ts", "repo_id": "langchainjs", "token_count": 329 }
767
import { ChatWindow } from "@/components/ChatWindow"; export default function AgentsPage() { const InfoCard = ( <div className="p-4 md:p-8 rounded bg-[#25252d] w-full max-h-[85%] overflow-hidden"> <h1 className="text-3xl md:text-4xl mb-4"> ▲ Next.js + LangChain.js Structured Output 🦜🔗 </h1>...
langchain-nextjs-template/app/structured_output/page.tsx/0
{ "file_path": "langchain-nextjs-template/app/structured_output/page.tsx", "repo_id": "langchain-nextjs-template", "token_count": 1770 }
66
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/core/embeddings/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/core/embeddings/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,552
export { type OptionalImportMap, type SecretMap } from "./import_type.js"; export * as importMap from "./import_map.js"; export { optionalImportEntrypoints } from "./import_constants.js";
langchainjs/libs/langchain-community/src/load/index.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/load/index.ts", "repo_id": "langchainjs", "token_count": 54 }
1,005
// 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/importutilv2/json/reader.go/0
{ "file_path": "milvus/internal/util/importutilv2/json/reader.go", "repo_id": "milvus", "token_count": 1721 }
1,882
# solo-performance-prompting-agent This template creates an agent that transforms a single LLM into a cognitive synergist by engaging in multi-turn self-collaboration with multiple personas. A cognitive synergist refers to an intelligent agent that collaborates with multiple minds, combining their individual strength...
langchain/templates/solo-performance-prompting-agent/README.md/0
{ "file_path": "langchain/templates/solo-performance-prompting-agent/README.md", "repo_id": "langchain", "token_count": 742 }
734
from __future__ import annotations from abc import ABC, abstractmethod from typing import Any, Optional, Sequence from langchain_core.outputs import Generation from langchain_core.runnables import run_in_executor RETURN_VAL_TYPE = Sequence[Generation] class BaseCache(ABC): """Base interface for cache.""" ...
langchain/libs/core/langchain_core/caches.py/0
{ "file_path": "langchain/libs/core/langchain_core/caches.py", "repo_id": "langchain", "token_count": 509 }
413
#!/usr/bin/env python # coding=utf-8 # Copyright 2021 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/examples/tensorflow/token-classification/run_ner.py/0
{ "file_path": "transformers/examples/tensorflow/token-classification/run_ner.py", "repo_id": "transformers", "token_count": 11688 }
611
from langchain_community.chat_models.azure_openai import AzureChatOpenAI __all__ = ["AzureChatOpenAI"]
langchain/libs/langchain/langchain/chat_models/azure_openai.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_models/azure_openai.py", "repo_id": "langchain", "token_count": 34 }
469
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-trello/llama_index/readers/trello/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-trello/llama_index/readers/trello/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,388
"""Integration test for PubMed API Wrapper.""" from typing import Any, List import pytest from langchain_core.documents import Document from langchain_core.tools import BaseTool from langchain_community.tools import PubmedQueryRun from langchain_community.utilities import PubMedAPIWrapper xmltodict = pytest.importor...
langchain/libs/community/tests/integration_tests/utilities/test_pubmed.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/utilities/test_pubmed.py", "repo_id": "langchain", "token_count": 2030 }
352
// 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/mq/mqimpl/rocksmq/client/consumer_impl.go/0
{ "file_path": "milvus/internal/mq/mqimpl/rocksmq/client/consumer_impl.go", "repo_id": "milvus", "token_count": 1370 }
1,948
<jupyter_start><jupyter_text>OpenLLMThere are two ways to interface with LLMs from [OpenLLM](https://github.com/bentoml/OpenLLM).- Through [`openllm`](https://github.com/bentoml/OpenLLM) package if you want to run locally: use `llama_index.llms.OpenLLM`- If there is a running OpenLLM Server, then it will wraps [openll...
llama_index/docs/examples/llm/openllm.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/openllm.ipynb", "repo_id": "llama_index", "token_count": 1365 }
1,115
<script lang="ts"> import { onMount } from "svelte"; import { base } from "$app/paths"; import { clickOutside } from "$lib/actions/clickOutside"; import { afterNavigate, goto } from "$app/navigation"; import { page } from "$app/stores"; import { useSettingsStore } from "$lib/stores/settings"; import CarbonClose ...
chat-ui/src/routes/settings/+layout.svelte/0
{ "file_path": "chat-ui/src/routes/settings/+layout.svelte", "repo_id": "chat-ui", "token_count": 2425 }
112
<jupyter_start><jupyter_text>Run TemplateIn `server.py`, set -```add_routes(app, chain_rag_conv, path="/rag_conversation")```<jupyter_code>from langserve.client import RemoteRunnable rag_app = RemoteRunnable("http://0.0.0.0:8001/rag_conversation") question = "How does agent memory work?" answer = rag_app.invoke( {...
langchain/templates/rag-conversation/rag_conversation.ipynb/0
{ "file_path": "langchain/templates/rag-conversation/rag_conversation.ipynb", "repo_id": "langchain", "token_count": 241 }
687
# BoardDocs Loader This loader retrieves an agenda and associated material from a BoardDocs site. This loader is not endorsed by, developed by, supported by, or in any way formally affiliated with Diligent Corporation. ## Usage To use this loader, you'll need to specify which BoardDocs site you want to load, as wel...
llama_index/llama-index-integrations/readers/llama-index-readers-boarddocs/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-boarddocs/README.md", "repo_id": "llama_index", "token_count": 418 }
1,473
<!--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/custom_pipeline_examples.md/0
{ "file_path": "diffusers/docs/source/en/using-diffusers/custom_pipeline_examples.md", "repo_id": "diffusers", "token_count": 1896 }
182
//go:build linux // +build linux package indexcgowrapper // TODO: add a benchmark to check if any leakage in cgo.
milvus/internal/util/indexcgowrapper/index_bench.go/0
{ "file_path": "milvus/internal/util/indexcgowrapper/index_bench.go", "repo_id": "milvus", "token_count": 37 }
2,078
import { loadEvaluator } from "langchain/evaluation"; import { initializeAgentExecutorWithOptions } from "langchain/agents"; import { ChatOpenAI } from "@langchain/openai"; import { ChainValues } from "@langchain/core/utils/types"; import { SerpAPI } from "@langchain/community/tools/serpapi"; // Step 1. Create the Ev...
langchainjs/examples/src/guides/evaluation/examples/comparisons.ts/0
{ "file_path": "langchainjs/examples/src/guides/evaluation/examples/comparisons.ts", "repo_id": "langchainjs", "token_count": 2377 }
793
"""Integration test for Wikipedia Retriever.""" from typing import List import pytest from langchain_core.documents import Document from langchain_community.retrievers import WikipediaRetriever @pytest.fixture def retriever() -> WikipediaRetriever: return WikipediaRetriever() def assert_docs(docs: List[Docume...
langchain/libs/community/tests/integration_tests/retrievers/test_wikipedia.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/retrievers/test_wikipedia.py", "repo_id": "langchain", "token_count": 767 }
345
# WhatsApp >[WhatsApp](https://www.whatsapp.com/) (also called `WhatsApp Messenger`) is a freeware, cross-platform, centralized instant messaging (IM) and voice-over-IP (VoIP) service. It allows users to send text and voice messages, make voice and video calls, and share images, documents, user locations, and other co...
langchain/docs/docs/integrations/providers/whatsapp.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/whatsapp.mdx", "repo_id": "langchain", "token_count": 158 }
161
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "vectorstores/xata", }); export * from "@langchain/community/vectorstores/xata";
langchainjs/langchain/src/vectorstores/xata.ts/0
{ "file_path": "langchainjs/langchain/src/vectorstores/xata.ts", "repo_id": "langchainjs", "token_count": 72 }
1,035
# coding=utf-8 # Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) 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...
transformers/src/transformers/models/deprecated/mmbt/modeling_mmbt.py/0
{ "file_path": "transformers/src/transformers/models/deprecated/mmbt/modeling_mmbt.py", "repo_id": "transformers", "token_count": 7654 }
601
from typing import Any, Dict, List, Optional, TypedDict, Union from langchain_community.utilities.sql_database import SQLDatabase from langchain_core.language_models import BaseLanguageModel from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import BasePromptTemplate from langchain_c...
langchain/libs/langchain/langchain/chains/sql_database/query.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/sql_database/query.py", "repo_id": "langchain", "token_count": 2089 }
500
<jupyter_start><jupyter_text>Benchmarking OpenAI Retrieval API (through Assistant Agent)This guide benchmarks the Retrieval Tool from the [OpenAI Assistant API](https://platform.openai.com/docs/assistants/overview), by using our `OpenAIAssistantAgent`. We run over the Llama 2 paper, and compare generation quality again...
llama_index/docs/examples/agent/openai_retrieval_benchmark.ipynb/0
{ "file_path": "llama_index/docs/examples/agent/openai_retrieval_benchmark.ipynb", "repo_id": "llama_index", "token_count": 3685 }
1,048
## Cogniswitch LlamaPack **Use CogniSwitch to build production ready applications that can consume, organize and retrieve knowledge flawlessly. Using the framework of your choice, in this case LlamaIndex, CogniSwitch helps alleviate the stress of decision making when it comes to, choosing the right storage and retriev...
llama_index/llama-index-packs/llama-index-packs-cogniswitch-agent/README.md/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-cogniswitch-agent/README.md", "repo_id": "llama_index", "token_count": 899 }
1,645
from langchain.callbacks.base import __all__ EXPECTED_ALL = [ "RetrieverManagerMixin", "LLMManagerMixin", "ChainManagerMixin", "ToolManagerMixin", "CallbackManagerMixin", "RunManagerMixin", "BaseCallbackHandler", "AsyncCallbackHandler", "BaseCallbackManager", "Callbacks", ] de...
langchain/libs/langchain/tests/unit_tests/callbacks/test_base.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/callbacks/test_base.py", "repo_id": "langchain", "token_count": 155 }
602
from langchain_community.llms.yandex import YandexGPT __all__ = ["YandexGPT"]
langchain/libs/langchain/langchain/llms/yandex.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/yandex.py", "repo_id": "langchain", "token_count": 32 }
545
# coding=utf-8 # 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 requir...
transformers/tests/models/jukebox/test_tokenization_jukebox.py/0
{ "file_path": "transformers/tests/models/jukebox/test_tokenization_jukebox.py", "repo_id": "transformers", "token_count": 6342 }
789
from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING, Any, Iterator, List, Optional, Sequence, Tuple, Union from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader if TYPE_CHECKING: from bs4 import NavigableString ...
langchain/libs/community/langchain_community/document_loaders/readthedocs.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/readthedocs.py", "repo_id": "langchain", "token_count": 3143 }
258
<jupyter_start><jupyter_text>---sidebar_position: 1title: "RunnablePassthrough: Passing data through"keywords: [RunnablePassthrough, RunnableParallel, LCEL]--- Passing data throughRunnablePassthrough allows to pass inputs unchanged or with the addition of extra keys. This typically is used in conjuction with RunnableP...
langchain/docs/docs/expression_language/how_to/passthrough.ipynb/0
{ "file_path": "langchain/docs/docs/expression_language/how_to/passthrough.ipynb", "repo_id": "langchain", "token_count": 781 }
91
# Object detection Object detection models identify something in an image, and object detection datasets are used for applications such as autonomous driving and detecting natural hazards like wildfire. This guide will show you how to apply transformations to an object detection dataset following the [tutorial](https:...
datasets/docs/source/object_detection.mdx/0
{ "file_path": "datasets/docs/source/object_detection.mdx", "repo_id": "datasets", "token_count": 2299 }
113
[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 = ["MondayReader"] contains_example = false import_path = "llama_index.readers.mondaydotcom" ...
llama_index/llama-index-integrations/readers/llama-index-readers-mondaydotcom/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mondaydotcom/pyproject.toml", "repo_id": "llama_index", "token_count": 674 }
1,413
from langchain_community.embeddings.openai import ( OpenAIEmbeddings, ) __all__ = [ "OpenAIEmbeddings", ]
langchain/libs/langchain/langchain/embeddings/openai.py/0
{ "file_path": "langchain/libs/langchain/langchain/embeddings/openai.py", "repo_id": "langchain", "token_count": 49 }
500
<jupyter_start><jupyter_text>Connect to templateIn `server.py`, set -```add_routes(app, chain_ext, path="/rag_pinecone_multi_query")```<jupyter_code>from langserve.client import RemoteRunnable rag_app_pinecone = RemoteRunnable("http://0.0.0.0:8001/rag_pinecone_multi_query") rag_app_pinecone.invoke("What are the differ...
langchain/templates/rag-pinecone-multi-query/rag_pinecone_multi_query.ipynb/0
{ "file_path": "langchain/templates/rag-pinecone-multi-query/rag_pinecone_multi_query.ipynb", "repo_id": "langchain", "token_count": 139 }
667
import time import torch.nn as nn import math import json import os import torch import transformers from texttable import Texttable from transformers import AutoModelForCausalLM, AutoConfig, AutoTokenizer from huggingface_hub import HfApi from accelerate import init_empty_weights from text_generation_server.utils imp...
text-generation-inference/server/text_generation_server/utils/gptq/quantize.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/gptq/quantize.py", "repo_id": "text-generation-inference", "token_count": 15970 }
389
<jupyter_start><jupyter_text>LLMCompilerThis notebook shows how to implement [LLMCompiler, by Kim, et. al](https://arxiv.org/abs/2312.04511) in LangGraph.LLMCompiler is an agent architecture designed to **speed up** the execution of agentic tasks by eagerly-executed tasks within a DAG. It also saves costs on redundant ...
langgraph/examples/llm-compiler/LLMCompiler.ipynb/0
{ "file_path": "langgraph/examples/llm-compiler/LLMCompiler.ipynb", "repo_id": "langgraph", "token_count": 6684 }
1,001
import os import time from typing import Optional from langchain_community.chat_message_histories.cassandra import ( CassandraChatMessageHistory, ) from langchain_core.messages import AIMessage, HumanMessage from langchain.memory import ConversationBufferMemory def _chat_message_history( session_id: str = "...
langchain/libs/langchain/tests/integration_tests/memory/test_cassandra.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/memory/test_cassandra.py", "repo_id": "langchain", "token_count": 1314 }
594
{ "extends": "next/core-web-vitals" }
langchainjs/docs/api_refs/.eslintrc.json/0
{ "file_path": "langchainjs/docs/api_refs/.eslintrc.json", "repo_id": "langchainjs", "token_count": 20 }
720
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/tools/llama-index-tools-azure-speech/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-azure-speech/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,432
"""Requests Tool.""" from typing import Optional from urllib.parse import urlparse from llama_index.core.tools.tool_spec.base import BaseToolSpec import requests INVALID_URL_PROMPT = ( "This url did not include a hostname or scheme. Please determine the complete URL" " and try again." ) class RequestsTool...
llama_index/llama-index-integrations/tools/llama-index-tools-requests/llama_index/tools/requests/base.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-requests/llama_index/tools/requests/base.py", "repo_id": "llama_index", "token_count": 941 }
1,526
// 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/mock/grpc_datanode_client.go/0
{ "file_path": "milvus/internal/util/mock/grpc_datanode_client.go", "repo_id": "milvus", "token_count": 1768 }
1,874
from langchain_core.utils.html import ( PREFIXES_TO_IGNORE, SUFFIXES_TO_IGNORE, extract_sub_links, find_all_links, ) def test_find_all_links_none() -> None: html = "<span>Hello world</span>" actual = find_all_links(html) assert actual == [] def test_find_all_links_single() -> None: h...
langchain/libs/core/tests/unit_tests/utils/test_html.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/utils/test_html.py", "repo_id": "langchain", "token_count": 2578 }
413
// 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/pkg/util/metricsinfo/metrics_info.go/0
{ "file_path": "milvus/pkg/util/metricsinfo/metrics_info.go", "repo_id": "milvus", "token_count": 1965 }
2,116
import argparse import logging import time from tqdm import tqdm logging.getLogger("transformers").disabled = True logging.getLogger("transformers.tokenization_utils").disabled = True from tokenizers import Tokenizer, decoders, pre_tokenizers from tokenizers.models import BPE, WordPiece from tokenizers.normalizers ...
tokenizers/bindings/python/examples/example.py/0
{ "file_path": "tokenizers/bindings/python/examples/example.py", "repo_id": "tokenizers", "token_count": 1783 }
456
<jupyter_start><jupyter_text>Pinecone Reader<jupyter_code>%pip install llama-index-readers-pinecone import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout)) api_key = "<api_key>"<jupyter_output><empty_output><jupyter_t...
llama_index/docs/examples/data_connectors/PineconeDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/data_connectors/PineconeDemo.ipynb", "repo_id": "llama_index", "token_count": 629 }
1,111
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/lokr/layer.py/0
{ "file_path": "peft/src/peft/tuners/lokr/layer.py", "repo_id": "peft", "token_count": 7536 }
305
package typeutil type OrderedMap[K comparable, V any] struct { keys []K values map[K]V } func NewOrderedMap[K comparable, V any]() *OrderedMap[K, V] { o := OrderedMap[K, V]{} o.keys = []K{} o.values = map[K]V{} return &o } func (o *OrderedMap[K, V]) Get(key K) (V, bool) { val, exists := o.values[key] retur...
milvus/pkg/util/typeutil/ordered_map.go/0
{ "file_path": "milvus/pkg/util/typeutil/ordered_map.go", "repo_id": "milvus", "token_count": 435 }
2,124
import { OpenAI, ChatOpenAI } from "@langchain/openai"; import process from "process"; import { HumanMessage } from "@langchain/core/messages"; process.env.LANGCHAIN_TRACING_V2 = "true"; const model = new OpenAI({}); const prompts = [ "Say hello to Bob.", "Say hello to Alice.", "Say hello to John.", "Say hel...
langchainjs/examples/src/models/llm/openai-batch.ts/0
{ "file_path": "langchainjs/examples/src/models/llm/openai-batch.ts", "repo_id": "langchainjs", "token_count": 207 }
844
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querynodev2/segments/segment_interface.go/0
{ "file_path": "milvus/internal/querynodev2/segments/segment_interface.go", "repo_id": "milvus", "token_count": 742 }
1,913
package optimizers import ( "context" "fmt" "github.com/golang/protobuf/proto" "go.uber.org/zap" "github.com/milvus-io/milvus/internal/proto/planpb" "github.com/milvus-io/milvus/internal/proto/querypb" "github.com/milvus-io/milvus/pkg/common" "github.com/milvus-io/milvus/pkg/log" "github.com/milvus-io/milvu...
milvus/internal/querynodev2/optimizers/query_hook.go/0
{ "file_path": "milvus/internal/querynodev2/optimizers/query_hook.go", "repo_id": "milvus", "token_count": 1117 }
1,871
from llama_index.readers.remote_depth.base import RemoteDepthReader __all__ = ["RemoteDepthReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-remote-depth/llama_index/readers/remote_depth/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-remote-depth/llama_index/readers/remote_depth/__init__.py", "repo_id": "llama_index", "token_count": 30 }
1,373
<!--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_gpu_one.md/0
{ "file_path": "transformers/docs/source/ja/perf_train_gpu_one.md", "repo_id": "transformers", "token_count": 17118 }
546
<!--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...
accelerate/docs/source/usage_guides/deepspeed.md/0
{ "file_path": "accelerate/docs/source/usage_guides/deepspeed.md", "repo_id": "accelerate", "token_count": 9824 }
3