text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
#!/usr/bin/env python """Example of a chat server with persistence handled on the backend. For simplicity, we're using file storage here -- to avoid the need to set up a database. This is obviously not a good idea for a production environment, but will help us to demonstrate the RunnableWithMessageHistory interface. ...
langserve/examples/chat_with_persistence/server.py/0
{ "file_path": "langserve/examples/chat_with_persistence/server.py", "repo_id": "langserve", "token_count": 1252 }
1,009
piVersion: v1 kind: Pod metadata: name: milvus-test-pod namespace: qa spec: containers: - name: milvus-test image: harbor.milvus.io/qa/fouram:1.1 # image: dockerhub-mirror-sh.zilliz.cc/milvusdb/pytest:20211209-cef343f command: - cat tty: true env: - name: IN_CLUSTER value: T...
milvus/build/ci/jenkins/pod/scale-test.yaml/0
{ "file_path": "milvus/build/ci/jenkins/pod/scale-test.yaml", "repo_id": "milvus", "token_count": 246 }
1,621
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University 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 Lice...
transformers/src/transformers/models/deprecated/transfo_xl/modeling_tf_transfo_xl_utilities.py/0
{ "file_path": "transformers/src/transformers/models/deprecated/transfo_xl/modeling_tf_transfo_xl_utilities.py", "repo_id": "transformers", "token_count": 4106 }
673
import os from pathlib import Path from langchain_community.document_loaders import UnstructuredExcelLoader EXAMPLE_DIRECTORY = file_path = Path(__file__).parent.parent / "examples" def test_unstructured_excel_loader() -> None: """Test unstructured loader.""" file_path = os.path.join(EXAMPLE_DIRECTORY, "sta...
langchain/libs/community/tests/integration_tests/document_loaders/test_excel.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_excel.py", "repo_id": "langchain", "token_count": 158 }
323
import torch from typing import List AWQ_PACK_ORDER = [0, 2, 4, 6, 1, 3, 5, 7] REVERSE_AWQ_PACK_ORDER = [0, 4, 1, 5, 2, 6, 3, 7] def pack(imatrix: torch.Tensor, direction: str = "column"): """ Packs a 4-bit integer matrix into a packed 32-bit integer matrix. Args: imatrix (torch.Tensor): matrix ...
text-generation-inference/server/text_generation_server/utils/awq/conversion_utils.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/awq/conversion_utils.py", "repo_id": "text-generation-inference", "token_count": 1384 }
406
## Demo in browser Update your settings to add `localhost:3000` to `chroma_server_cors_allow_origins`. For example in `docker-compose.yml` ``` environment: - CHROMA_DB_IMPL=clickhouse - CLICKHOUSE_HOST=clickhouse - CLICKHOUSE_PORT=8123 - CHROMA_SERVER_CORS_ALLOW_ORIGINS=["http://localhost:300...
chroma/clients/js/examples/browser/README.md/0
{ "file_path": "chroma/clients/js/examples/browser/README.md", "repo_id": "chroma", "token_count": 154 }
27
"""Init params."""
llama_index/llama-index-legacy/tests/indices/struct_store/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/struct_store/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,738
import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( "The `inpainting.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionInpaintPipeline` instead." )
diffusers/examples/inference/inpainting.py/0
{ "file_path": "diffusers/examples/inference/inpainting.py", "repo_id": "diffusers", "token_count": 89 }
207
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/blip/image_processing_blip.py/0
{ "file_path": "transformers/src/transformers/models/blip/image_processing_blip.py", "repo_id": "transformers", "token_count": 6334 }
613
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-tencentvectordb/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-tencentvectordb/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,541
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/siglip.md/0
{ "file_path": "transformers/docs/source/en/model_doc/siglip.md", "repo_id": "transformers", "token_count": 1843 }
516
# Document Management Most LlamaIndex index structures allow for **insertion**, **deletion**, **update**, and **refresh** operations. ## Insertion You can "insert" a new Document into any index data structure, after building the index initially. This document will be broken down into nodes and ingested into the inde...
llama_index/docs/module_guides/indexing/document_management.md/0
{ "file_path": "llama_index/docs/module_guides/indexing/document_management.md", "repo_id": "llama_index", "token_count": 1510 }
1,143
import { ChatAnthropicMessages } from "@langchain/anthropic"; const model = new ChatAnthropicMessages({ temperature: 0.9, anthropicApiKey: "YOUR-API-KEY", // In Node.js defaults to process.env.ANTHROPIC_API_KEY, maxTokens: 1024, });
langchainjs/examples/src/models/chat/integration_anthropic.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/integration_anthropic.ts", "repo_id": "langchainjs", "token_count": 85 }
821
# coding=utf-8 # Copyright 2021 The Fairseq 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 # # http://www.apache.org/licenses/...
transformers/src/transformers/models/unispeech/modeling_unispeech.py/0
{ "file_path": "transformers/src/transformers/models/unispeech/modeling_unispeech.py", "repo_id": "transformers", "token_count": 30778 }
665
[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 = ["AthenaReader"] contains_example = false import_path = "llama_index.readers.athena" [tool...
llama_index/llama-index-integrations/readers/llama-index-readers-athena/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-athena/pyproject.toml", "repo_id": "llama_index", "token_count": 705 }
1,381
"""Test the File Management utils.""" import re from pathlib import Path from tempfile import TemporaryDirectory import pytest from langchain_community.tools.file_management.utils import ( FileValidationError, get_validated_relative_path, ) def test_get_validated_relative_path_errs_on_absolute() -> None: ...
langchain/libs/community/tests/unit_tests/tools/file_management/test_utils.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/tools/file_management/test_utils.py", "repo_id": "langchain", "token_count": 982 }
407
<!--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/albert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/albert.md", "repo_id": "transformers", "token_count": 3405 }
483
python_tests()
llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-sbert-rerank/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-sbert-rerank/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,390
from langchain_community.document_loaders.mastodon import ( MastodonTootsLoader, ) __all__ = ["MastodonTootsLoader"]
langchain/libs/langchain/langchain/document_loaders/mastodon.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/mastodon.py", "repo_id": "langchain", "token_count": 42 }
487
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/models/resnet/test_modeling_flax_resnet.py/0
{ "file_path": "transformers/tests/models/resnet/test_modeling_flax_resnet.py", "repo_id": "transformers", "token_count": 3543 }
747
from llama_index.core.chat_engine.condense_plus_context import ( CondensePlusContextChatEngine, ) from llama_index.core.chat_engine.condense_question import ( CondenseQuestionChatEngine, ) from llama_index.core.chat_engine.context import ContextChatEngine from llama_index.core.chat_engine.simple import SimpleCh...
llama_index/llama-index-core/llama_index/core/chat_engine/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/chat_engine/__init__.py", "repo_id": "llama_index", "token_count": 151 }
1,180
python_tests()
llama_index/llama-index-integrations/tools/llama-index-tools-neo4j/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-neo4j/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,490
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-llama-guard-moderator/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-llama-guard-moderator/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,796
python_sources()
llama_index/llama-index-core/llama_index/core/prompts/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/prompts/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,194
# SerpAPI This page covers how to use the SerpAPI search APIs within LangChain. It is broken into two parts: installation and setup, and then references to the specific SerpAPI wrapper. ## Installation and Setup - Install requirements with `pip install google-search-results` - Get a SerpAPI api key and either set it ...
langchain/docs/docs/integrations/providers/serpapi.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/serpapi.mdx", "repo_id": "langchain", "token_count": 257 }
152
# 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/megatron_lm.py/0
{ "file_path": "accelerate/src/accelerate/utils/megatron_lm.py", "repo_id": "accelerate", "token_count": 26949 }
13
from langchain.output_parsers.boolean import BooleanOutputParser def test_boolean_output_parser_parse() -> None: parser = BooleanOutputParser() # Test valid input result = parser.parse("YES") assert result is True # Test valid input result = parser.parse("NO") assert result is False ...
langchain/libs/langchain/tests/unit_tests/output_parsers/test_boolean_parser.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/output_parsers/test_boolean_parser.py", "repo_id": "langchain", "token_count": 221 }
608
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/core/src/exec/expression/Expr.cpp/0
{ "file_path": "milvus/internal/core/src/exec/expression/Expr.cpp", "repo_id": "milvus", "token_count": 4654 }
1,868
import { LanguageModelLike } from "@langchain/core/language_models/base"; import { BaseOutputParser, StringOutputParser, } from "@langchain/core/output_parsers"; import { BasePromptTemplate } from "@langchain/core/prompts"; import { RunnablePassthrough, RunnablePick, RunnableSequence, } from "@langchain/core/...
langchainjs/langchain/src/chains/combine_documents/stuff.ts/0
{ "file_path": "langchainjs/langchain/src/chains/combine_documents/stuff.ts", "repo_id": "langchainjs", "token_count": 853 }
925
from llama_index.postprocessor.sbert_rerank.base import SentenceTransformerRerank __all__ = ["SentenceTransformerRerank"]
llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-sbert-rerank/llama_index/postprocessor/sbert_rerank/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-sbert-rerank/llama_index/postprocessor/sbert_rerank/__init__.py", "repo_id": "llama_index", "token_count": 40 }
1,268
import { createClient } from "redis"; import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { RedisVectorStore } from "@langchain/redis"; import { ChatPromptTemplate } from "@langchain/core/prompts"; import { createStuffDocumentsChain } from "langchain/chains/combine_documents"; import { createRetrie...
langchainjs/examples/src/indexes/vector_stores/redis/redis_query.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/redis/redis_query.ts", "repo_id": "langchainjs", "token_count": 841 }
822
use serde::{Deserialize, Serialize}; use crate::tokenizer::{PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior}; use crate::utils::macro_rules_attribute; use unicode_categories::UnicodeCategories; fn is_punc(x: char) -> bool { char::is_ascii_punctuation(&x) || x.is_punctuation() } #[derive(Copy, Cl...
tokenizers/tokenizers/src/pre_tokenizers/punctuation.rs/0
{ "file_path": "tokenizers/tokenizers/src/pre_tokenizers/punctuation.rs", "repo_id": "tokenizers", "token_count": 1102 }
468
# 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/autoencoders/consistency_decoder_vae.py/0
{ "file_path": "diffusers/src/diffusers/models/autoencoders/consistency_decoder_vae.py", "repo_id": "diffusers", "token_count": 8128 }
235
<jupyter_start><jupyter_text>ArXivThis notebook goes over how to use the `arxiv` tool with an agent. First, you need to install the `arxiv` python package.<jupyter_code>%pip install --upgrade --quiet arxiv from langchain import hub from langchain.agents import AgentExecutor, create_react_agent, load_tools from langcha...
langchain/docs/docs/integrations/tools/arxiv.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/arxiv.ipynb", "repo_id": "langchain", "token_count": 880 }
171
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/data/datasets/squad.py/0
{ "file_path": "transformers/src/transformers/data/datasets/squad.py", "repo_id": "transformers", "token_count": 4006 }
605
<jupyter_start><jupyter_text>Log, Trace, and MonitorWhen building apps or agents using Langchain, you end up making multiple API calls to fulfill a single user request. However, these requests are not chained when you want to analyse them. With [**Portkey**](/docs/integrations/providers/portkey), all the embeddings, co...
langchain/docs/docs/integrations/providers/portkey/logging_tracing_portkey.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/providers/portkey/logging_tracing_portkey.ipynb", "repo_id": "langchain", "token_count": 1421 }
146
import random import pytest from langchain.evaluation.parsing.base import ( JsonEqualityEvaluator, JsonValidityEvaluator, ) @pytest.fixture def json_validity_evaluator() -> JsonValidityEvaluator: return JsonValidityEvaluator() def test_json_validity_evaluator_requires_input( json_validity_evaluato...
langchain/libs/langchain/tests/unit_tests/evaluation/parsing/test_base.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/evaluation/parsing/test_base.py", "repo_id": "langchain", "token_count": 2313 }
596
<jupyter_start><jupyter_text>AI21 Basic Usage Call `complete` with a prompt If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-llms-ai21 !pip install llama-index from llama_index.llms.ai21 import AI21 api_key = "Your api key" resp = AI21(a...
llama_index/docs/examples/llm/ai21.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/ai21.ipynb", "repo_id": "llama_index", "token_count": 805 }
1,086
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
accelerate/src/accelerate/accelerator.py/0
{ "file_path": "accelerate/src/accelerate/accelerator.py", "repo_id": "accelerate", "token_count": 62826 }
9
/* eslint-disable no-promise-executor-return */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { test } from "@jest/globals"; import { ChatPromptTemplate, HumanMessagePromptTemplate, PromptTemplate, SystemMessagePromptTemplate, } from "../../prompts/index.js"; import { Document } from "../../do...
langchainjs/langchain-core/src/runnables/tests/runnable_stream_log.test.ts/0
{ "file_path": "langchainjs/langchain-core/src/runnables/tests/runnable_stream_log.test.ts", "repo_id": "langchainjs", "token_count": 3770 }
840
from hybrid_search_weaviate.chain import chain __all__ = ["chain"]
langchain/templates/hybrid-search-weaviate/hybrid_search_weaviate/__init__.py/0
{ "file_path": "langchain/templates/hybrid-search-weaviate/hybrid_search_weaviate/__init__.py", "repo_id": "langchain", "token_count": 22 }
656
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/core/src/index/IndexFactory.cpp/0
{ "file_path": "milvus/internal/core/src/index/IndexFactory.cpp", "repo_id": "milvus", "token_count": 5881 }
1,926
"""ElevenLabs TTS.""" from typing import Any, Optional from llama_index.legacy.tts.base import BaseTTS class ElevenLabsTTS(BaseTTS): """ElevenLabs TTS. Args: api_key (Optional[str]): API key for ElevenLabs TTS. """ def __init__(self, api_key: Optional[str] = None) -> None: super()...
llama_index/llama-index-legacy/llama_index/legacy/tts/elevenlabs.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/tts/elevenlabs.py", "repo_id": "llama_index", "token_count": 565 }
1,781
# coding=utf-8 # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
alignment-handbook/tests/test_data.py/0
{ "file_path": "alignment-handbook/tests/test_data.py", "repo_id": "alignment-handbook", "token_count": 4201 }
25
from typing import Optional import requests DEFAULT_HUGGINGFACE_EMBEDDING_MODEL = "BAAI/bge-small-en" DEFAULT_INSTRUCT_MODEL = "hkunlp/instructor-base" # Originally pulled from: # https://github.com/langchain-ai/langchain/blob/v0.0.257/libs/langchain/langchain/embeddings/huggingface.py#L10 DEFAULT_EMBED_INSTRUCTION ...
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/llama_index/embeddings/huggingface/utils.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/llama_index/embeddings/huggingface/utils.py", "repo_id": "llama_index", "token_count": 1383 }
1,278
"""Question-answering with sources over an index.""" from typing import Any, Dict, List from langchain_core.callbacks import ( AsyncCallbackManagerForChainRun, CallbackManagerForChainRun, ) from langchain_core.documents import Document from langchain_core.pydantic_v1 import Field from langchain_core.retriever...
langchain/libs/langchain/langchain/chains/qa_with_sources/retrieval.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/qa_with_sources/retrieval.py", "repo_id": "langchain", "token_count": 990 }
466
# Intro Authors: @patrickvonplaten and @lhoestq Aimed at tackling the knowledge-intensive NLP tasks (think tasks a human wouldn't be expected to solve without access to external knowledge sources), RAG models are seq2seq models with access to a retrieval mechanism providing relevant context documents at training and ...
transformers/examples/research_projects/rag/README.md/0
{ "file_path": "transformers/examples/research_projects/rag/README.md", "repo_id": "transformers", "token_count": 3287 }
586
"""Azure OpenAI embeddings wrapper.""" from __future__ import annotations import os from typing import Callable, Dict, Optional, Union import openai from langchain_core.pydantic_v1 import Field, SecretStr, root_validator from langchain_core.utils import convert_to_secret_str, get_from_dict_or_env from langchain_open...
langchain/libs/partners/openai/langchain_openai/embeddings/azure.py/0
{ "file_path": "langchain/libs/partners/openai/langchain_openai/embeddings/azure.py", "repo_id": "langchain", "token_count": 2855 }
633
# 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/tests/test_config.py/0
{ "file_path": "peft/tests/test_config.py", "repo_id": "peft", "token_count": 4091 }
329
insert_get_performance: collections: - milvus: db_config.primary_path: /test/milvus/db_data_011/sift_1m_128_128_l2 collection_name: sift_1m_128_l2 ni_per: 50000 build_index: false index_type: ivf_sq8 index_param: nlist: 16384 ids_length_list: [1, 1...
milvus/tests/benchmark/milvus_benchmark/suites/2_insert_get.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/2_insert_get.yaml", "repo_id": "milvus", "token_count": 176 }
1,868
# coding=utf-8 # Copyright 2022 The Salesforce Team Authors 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/licens...
transformers/src/transformers/models/blip/modeling_blip.py/0
{ "file_path": "transformers/src/transformers/models/blip/modeling_blip.py", "repo_id": "transformers", "token_count": 25453 }
607
import { test, expect } from "@jest/globals"; import { VoyageEmbeddings } from "../voyage.js"; test.skip("Test VoyageEmbeddings.embedQuery", async () => { const embeddings = new VoyageEmbeddings(); const res = await embeddings.embedQuery("Hello world"); expect(typeof res[0]).toBe("number"); }); test.skip("Test...
langchainjs/libs/langchain-community/src/embeddings/tests/voyage.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/embeddings/tests/voyage.int.test.ts", "repo_id": "langchainjs", "token_count": 378 }
1,057
from langchain_community.vectorstores.utils import ( DistanceStrategy, filter_complex_metadata, maximal_marginal_relevance, ) __all__ = ["DistanceStrategy", "maximal_marginal_relevance", "filter_complex_metadata"]
langchain/libs/langchain/langchain/vectorstores/utils.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/utils.py", "repo_id": "langchain", "token_count": 75 }
619
/* eslint-disable no-process-env */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { test, jest, expect } from "@jest/globals"; import S3Client from "@aws-sdk/client-s3"; import * as fs from "node:fs"; import * as path from "node:path"; import { S3Loader } from "../web/s3.js"; import { Unstructure...
langchainjs/langchain/src/document_loaders/tests/s3.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/s3.int.test.ts", "repo_id": "langchainjs", "token_count": 751 }
923
import sys import copy import time from loguru import logger import pymilvus from pymilvus import ( FieldSchema, CollectionSchema, DataType, Collection, list_collections, ) logger.remove() logger.add(sys.stderr, format= "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | " "<level>{level: <8}</level> | " "...
milvus/tests/python_client/deploy/scripts/utils.py/0
{ "file_path": "milvus/tests/python_client/deploy/scripts/utils.py", "repo_id": "milvus", "token_count": 4878 }
1,898
# LlamaIndex Readers Integration: Slack
llama_index/llama-index-integrations/readers/llama-index-readers-slack/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-slack/README.md", "repo_id": "llama_index", "token_count": 9 }
1,417
<jupyter_start><jupyter_text>Fine Tuning GPT-3.5-TurboIn this notebook, we walk through an example of fine-tuning gpt-3.5-turbo.Specifically, we attempt to distill GPT-4's knowledge, by generating training data with GPT-4 to then fine-tune GPT-3.5.All training data is generated using two different sections of our index...
llama_index/docs/examples/finetuning/openai_fine_tuning.ipynb/0
{ "file_path": "llama_index/docs/examples/finetuning/openai_fine_tuning.ipynb", "repo_id": "llama_index", "token_count": 3529 }
1,083
# coding=utf-8 # Copyright 2020 Google AI, Google Brain, the HuggingFace Inc. team and Microsoft Corporation. # # 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/lic...
transformers/examples/research_projects/bert-loses-patience/pabee/modeling_pabee_albert.py/0
{ "file_path": "transformers/examples/research_projects/bert-loses-patience/pabee/modeling_pabee_albert.py", "repo_id": "transformers", "token_count": 6311 }
518
import os import tempfile from typing import Callable, List, Optional from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader from langchain_community.document_loaders.unstructured import UnstructuredFileLoader from langchain_community.utilities.vertexai import g...
langchain/libs/community/langchain_community/document_loaders/gcs_file.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/gcs_file.py", "repo_id": "langchain", "token_count": 1336 }
237
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/examples/research_projects/wav2vec2/test_wav2vec2_deepspeed.py/0
{ "file_path": "transformers/examples/research_projects/wav2vec2/test_wav2vec2_deepspeed.py", "repo_id": "transformers", "token_count": 2788 }
580
from typing import Any from llama_index.core.output_parsers.base import StructuredOutput from llama_index.core.output_parsers.utils import parse_json_markdown from llama_index.core.types import BaseOutputParser from llama_index.core.vector_stores.types import VectorStoreQuerySpec class VectorStoreQueryOutputParser(B...
llama_index/llama-index-core/llama_index/core/indices/vector_store/retrievers/auto_retriever/output_parser.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/vector_store/retrievers/auto_retriever/output_parser.py", "repo_id": "llama_index", "token_count": 220 }
1,185
# Salute Devices Salute Devices provides GigaChat LLM's models. For more info how to get access to GigaChat [follow here](https://developers.sber.ru/docs/ru/gigachat/api/integration). ## Installation and Setup GigaChat package can be installed via pip from PyPI: ```bash pip install gigachat ``` ## LLMs See a [us...
langchain/docs/docs/integrations/providers/salute_devices.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/salute_devices.mdx", "repo_id": "langchain", "token_count": 191 }
147
#![allow(dead_code)] use libc::{c_char, c_double, c_float, c_int, c_long, c_ulong}; mod ffi { use super::*; extern "C" { // It would be nice to be able to switch to the NEWLAPACK version of the function but this // seems to trigger some link error. Available function names can be seen here: ...
candle/candle-core/src/accelerate.rs/0
{ "file_path": "candle/candle-core/src/accelerate.rs", "repo_id": "candle", "token_count": 7639 }
31
export { SqlCreatePromptArgs, SqlToolkit, createSqlAgent } from "./sql.js"; export { SQL_PREFIX, SQL_SUFFIX } from "./prompt.js";
langchainjs/langchain/src/agents/toolkits/sql/index.ts/0
{ "file_path": "langchainjs/langchain/src/agents/toolkits/sql/index.ts", "repo_id": "langchainjs", "token_count": 50 }
845
label: 'Experimental' position: 6
langchainjs/docs/core_docs/docs/modules/data_connection/experimental/_category_.yml/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/experimental/_category_.yml", "repo_id": "langchainjs", "token_count": 10 }
755
//! Support for the GGML file format. #[cfg(feature = "metal")] use super::metal::load_quantized_metal; use super::{k_quants, GgmlDType, QStorage}; use crate::{Device, Result}; use byteorder::{LittleEndian, ReadBytesExt}; use std::collections::HashMap; // https://github.com/ggerganov/llama.cpp/blob/468ea24fb4633a0d68...
candle/candle-core/src/quantized/ggml_file.rs/0
{ "file_path": "candle/candle-core/src/quantized/ggml_file.rs", "repo_id": "candle", "token_count": 4693 }
37
<jupyter_start><jupyter_text>John Snow Labs>[John Snow Labs](https://nlp.johnsnowlabs.com/) NLP & LLM ecosystem includes software libraries for state-of-the-art AI at scale, Responsible AI, No-Code AI, and access to over 20,000 models for Healthcare, Legal, Finance, etc.>>Models are loaded with [nlp.load](https://nlp.j...
langchain/docs/docs/integrations/text_embedding/johnsnowlabs_embedding.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/johnsnowlabs_embedding.ipynb", "repo_id": "langchain", "token_count": 735 }
173
import base64 from typing import Any, Dict, Union from llama_index.core.llms import ChatMessage, MessageRole def is_gemini_model(model: str) -> bool: return model.startswith("gemini") def create_gemini_client(model: str) -> Any: from vertexai.preview.generative_models import GenerativeModel return Gen...
llama_index/llama-index-integrations/llms/llama-index-llms-vertex/llama_index/llms/vertex/gemini_utils.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-vertex/llama_index/llms/vertex/gemini_utils.py", "repo_id": "llama_index", "token_count": 825 }
1,375
import json from langchain_core.pydantic_v1 import BaseModel, Field, conint class LLMPlateResponse(BaseModel): row_start: conint(ge=0) = Field( ..., description="The starting row of the plate (0-indexed)" ) row_end: conint(ge=0) = Field( ..., description="The ending row of the plate (0-in...
langchain/templates/plate-chain/plate_chain/utils.py/0
{ "file_path": "langchain/templates/plate-chain/plate_chain/utils.py", "repo_id": "langchain", "token_count": 369 }
677
# Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
datasets/src/datasets/utils/version.py/0
{ "file_path": "datasets/src/datasets/utils/version.py", "repo_id": "datasets", "token_count": 1291 }
143
"""Summarize query.""" import logging from typing import Any, List, Optional, cast from llama_index.legacy.callbacks.base import CallbackManager from llama_index.legacy.core.base_retriever import BaseRetriever from llama_index.legacy.data_structs.data_structs import IndexGraph from llama_index.legacy.indices.tree.bas...
llama_index/llama-index-legacy/llama_index/legacy/indices/tree/all_leaf_retriever.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/tree/all_leaf_retriever.py", "repo_id": "llama_index", "token_count": 737 }
1,669
# Adapted from turboderp exllama: https://github.com/turboderp/exllamav2 import torch import torch.nn as nn from loguru import logger try: from exllamav2_kernels import make_q_matrix, gemm_half_q_half except ImportError: logger.error("exllamav2_kernels not installed.") raise # Dummy tensor to pass inste...
text-generation-inference/server/text_generation_server/utils/gptq/exllamav2.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/gptq/exllamav2.py", "repo_id": "text-generation-inference", "token_count": 3518 }
428
# How to read these docs Welcome to the LlamaIndex documentation! We've tried hard to make these docs approachable regardless of your experience level with LlamaIndex and with LLMs and generative AI in general. ## Before you start LlamaIndex is a Python library, so you should have Python [installed](https://www.pyth...
llama_index/docs/getting_started/reading.md/0
{ "file_path": "llama_index/docs/getting_started/reading.md", "repo_id": "llama_index", "token_count": 612 }
1,137
"""Base Managed Service index. An index that is built on top of a managed service. """ from abc import ABC, abstractmethod from typing import Any, Dict, List, Optional, Sequence, Type from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.callbacks.base import CallbackManager from llama...
llama_index/llama-index-core/llama_index/core/indices/managed/base.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/managed/base.py", "repo_id": "llama_index", "token_count": 1366 }
1,180
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/clvp/configuration_clvp.py/0
{ "file_path": "transformers/src/transformers/models/clvp/configuration_clvp.py", "repo_id": "transformers", "token_count": 8205 }
634
# research-assistant This template implements a version of [GPT Researcher](https://github.com/assafelovic/gpt-researcher) that you can use as a starting point for a research agent. ## Environment Setup The default template relies on ChatOpenAI and DuckDuckGo, so you will need the following environment variable: ...
langchain/templates/research-assistant/README.md/0
{ "file_path": "langchain/templates/research-assistant/README.md", "repo_id": "langchain", "token_count": 654 }
703
from llama_index.core.vector_stores.types import BasePydanticVectorStore from llama_index.vector_stores.weaviate import WeaviateVectorStore def test_class(): names_of_base_classes = [b.__name__ for b in WeaviateVectorStore.__mro__] assert BasePydanticVectorStore.__name__ in names_of_base_classes
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/tests/test_vector_stores_weaviate.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/tests/test_vector_stores_weaviate.py", "repo_id": "llama_index", "token_count": 103 }
1,632
# AssemblyAI Audio Transcript Loader The AssemblyAI Audio Transcript Loader allows to transcribe audio files with the [AssemblyAI API](https://www.assemblyai.com/) and loads the transcribed text into documents. To use it, you should have the `assemblyai` python package installed, and the environment variable `ASSEMBL...
llama_index/llama-index-integrations/readers/llama-index-readers-assemblyai/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-assemblyai/README.md", "repo_id": "llama_index", "token_count": 1022 }
1,322
# 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/...
transformers/src/transformers/models/blenderbot_small/tokenization_blenderbot_small_fast.py/0
{ "file_path": "transformers/src/transformers/models/blenderbot_small/tokenization_blenderbot_small_fast.py", "repo_id": "transformers", "token_count": 2174 }
574
#!/usr/bin/env python # coding=utf-8 # Copyright 2020 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/pytorch/text-classification/run_classification.py/0
{ "file_path": "transformers/examples/pytorch/text-classification/run_classification.py", "repo_id": "transformers", "token_count": 14066 }
554
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-openai-like/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-openai-like/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,412
from langchain_community.document_loaders.github import GitHubIssuesLoader def test_issues_load() -> None: title = " Add caching to BaseChatModel (issue #1644)" loader = GitHubIssuesLoader( repo="langchain-ai/langchain", creator="UmerHA", state="all", per_page=3, page=2...
langchain/libs/community/tests/integration_tests/document_loaders/test_github.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_github.py", "repo_id": "langchain", "token_count": 221 }
328
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/ernie/modeling_ernie.py/0
{ "file_path": "transformers/src/transformers/models/ernie/modeling_ernie.py", "repo_id": "transformers", "token_count": 35703 }
660
"""Test keyword table index.""" from typing import Any, List from unittest.mock import patch import pytest from llama_index.core.indices.keyword_table.simple_base import ( SimpleKeywordTableIndex, ) from llama_index.core.schema import Document from llama_index.core.service_context import ServiceContext from tests...
llama_index/llama-index-core/tests/indices/keyword_table/test_base.py/0
{ "file_path": "llama_index/llama-index-core/tests/indices/keyword_table/test_base.py", "repo_id": "llama_index", "token_count": 2603 }
1,261
package backend import ( "encoding/json" "github.com/golang/protobuf/proto" "github.com/milvus-io/milvus/cmd/tools/migration/console" ) type BackupHeaderVersion int32 const ( BackupHeaderVersionV1 BackupHeaderVersion = iota ) // BackupHeader stores etcd backup header information type BackupHeader struct { //...
milvus/cmd/tools/migration/backend/backup_header.go/0
{ "file_path": "milvus/cmd/tools/migration/backend/backup_header.go", "repo_id": "milvus", "token_count": 783 }
1,754
from typing import Dict, List, Optional # TODO: remove ignore once the google package is published with types import google.generativeai as genai # type: ignore[import] from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import BaseModel, Field, SecretStr, root_validator from langchain_co...
langchain/libs/partners/google-genai/langchain_google_genai/embeddings.py/0
{ "file_path": "langchain/libs/partners/google-genai/langchain_google_genai/embeddings.py", "repo_id": "langchain", "token_count": 1681 }
625
"""Util that calls clickup.""" import json import warnings from dataclasses import asdict, dataclass, fields from typing import Any, Dict, List, Mapping, Optional, Tuple, Type, Union import requests from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator from langchain_core.utils import get_from_dict_...
langchain/libs/community/langchain_community/utilities/clickup.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/clickup.py", "repo_id": "langchain", "token_count": 8697 }
304
<jupyter_start><jupyter_text>Obsidian>[Obsidian](https://obsidian.md/) is a powerful and extensible knowledge basethat works on top of your local folder of plain text files.This notebook covers how to load documents from an `Obsidian` database.Since `Obsidian` is just stored on disk as a folder of Markdown files, the l...
langchain/docs/docs/integrations/document_loaders/obsidian.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/obsidian.ipynb", "repo_id": "langchain", "token_count": 230 }
119
.. mdinclude:: ../../CHANGELOG.md
llama_index/docs/changes/changelog.rst/0
{ "file_path": "llama_index/docs/changes/changelog.rst", "repo_id": "llama_index", "token_count": 14 }
1,037
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/owlvit/configuration_owlvit.py/0
{ "file_path": "transformers/src/transformers/models/owlvit/configuration_owlvit.py", "repo_id": "transformers", "token_count": 6648 }
642
"""Google's hosted Gemini API.""" import os import typing from typing import Any, Dict, Optional, Sequence from llama_index.core.base.llms.types import ( ChatMessage, ChatResponse, ChatResponseGen, CompletionResponse, CompletionResponseGen, LLMMetadata, ) from llama_index.core.bridge.pydantic i...
llama_index/llama-index-integrations/llms/llama-index-llms-gemini/llama_index/llms/gemini/base.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-gemini/llama_index/llms/gemini/base.py", "repo_id": "llama_index", "token_count": 3018 }
1,395
""" EfficientFormer-V2 @article{ li2022rethinking, title={Rethinking Vision Transformers for MobileNet Size and Speed}, author={Li, Yanyu and Hu, Ju and Wen, Yang and Evangelidis, Georgios and Salahi, Kamyar and Wang, Yanzhi and Tulyakov, Sergey and Ren, Jian}, journal={arXiv preprint arXiv:2212.08059}...
pytorch-image-models/timm/models/efficientformer_v2.py/0
{ "file_path": "pytorch-image-models/timm/models/efficientformer_v2.py", "repo_id": "pytorch-image-models", "token_count": 12721 }
342
--- sidebar_position: 1 --- # Concepts The core element of any language model application is... the model. LangChain gives you the building blocks to interface with any language model. Everything in this section is about making it easier to work with models. This largely involves a clear interface for what a model is...
langchainjs/docs/core_docs/docs/modules/model_io/concepts.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/concepts.mdx", "repo_id": "langchainjs", "token_count": 1707 }
761
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/proxy/task_query_test.go/0
{ "file_path": "milvus/internal/proxy/task_query_test.go", "repo_id": "milvus", "token_count": 12510 }
1,888
python_sources()
llama_index/llama-index-core/llama_index/core/evaluation/benchmarks/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/evaluation/benchmarks/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,208
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-honeyhive/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-honeyhive/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,292
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-chroma/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-chroma/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,415
<!--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/depth2img.md/0
{ "file_path": "diffusers/docs/source/en/using-diffusers/depth2img.md", "repo_id": "diffusers", "token_count": 878 }
194
from __future__ import annotations from typing import List from langchain_community.agent_toolkits.base import BaseToolkit from langchain_community.tools import BaseTool from langchain_community.tools.json.tool import ( JsonGetValueTool, JsonListKeysTool, JsonSpec, ) class JsonToolkit(BaseToolkit): ...
langchain/libs/community/langchain_community/agent_toolkits/json/toolkit.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/json/toolkit.py", "repo_id": "langchain", "token_count": 225 }
229
include settings.ini include LICENSE include CONTRIBUTING.md include README.md recursive-exclude * __pycache__
trl/MANIFEST.in/0
{ "file_path": "trl/MANIFEST.in", "repo_id": "trl", "token_count": 34 }
803