text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
from typing import Any, Dict, List, Type, Union from langchain_community.graphs import NetworkxEntityGraph from langchain_community.graphs.networkx_graph import ( KnowledgeTriple, get_entities, parse_triples, ) from langchain_core.language_models import BaseLanguageModel from langchain_core.messages import...
langchain/libs/langchain/langchain/memory/kg.py/0
{ "file_path": "langchain/libs/langchain/langchain/memory/kg.py", "repo_id": "langchain", "token_count": 2080 }
549
# coding=utf-8 # Copyright 2022 Facebook AI Research (FAIR) 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/l...
transformers/src/transformers/models/deit/modeling_tf_deit.py/0
{ "file_path": "transformers/src/transformers/models/deit/modeling_tf_deit.py", "repo_id": "transformers", "token_count": 21239 }
644
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-playgrounds/llama_index/tools/playgrounds/subgraph_inspector/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-playgrounds/llama_index/tools/playgrounds/subgraph_inspector/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,451
# Glossary This is a community-created glossary. Contributions are welcome! - **Deep Q-Learning:** A value-based deep reinforcement learning algorithm that uses a deep neural network to approximate Q-values for actions in a given state. The goal of Deep Q-learning is to find the optimal policy that maximizes the exp...
deep-rl-class/units/en/unit4/glossary.mdx/0
{ "file_path": "deep-rl-class/units/en/unit4/glossary.mdx", "repo_id": "deep-rl-class", "token_count": 421 }
162
ann_accuracy: collections: - server: cache_config.cpu_cache_capacity: 16GB engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: true gpu_resource_config.cache_capacity: 4GB gpu_resource_config.search_resource...
milvus/tests/benchmark/milvus_benchmark/suites/gpu_accuracy_ann.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/gpu_accuracy_ann.yaml", "repo_id": "milvus", "token_count": 2785 }
2,008
[tool.poetry] name = "text-generation-server" version = "1.4.0" description = "Text Generation Inference Python gRPC Server" authors = ["Olivier Dehaene <olivier@huggingface.co>"] [tool.poetry.scripts] text-generation-server = 'text_generation_server.cli:app' [tool.poetry.dependencies] python = ">=3.9,<3.13" protobuf...
text-generation-inference/server/pyproject.toml/0
{ "file_path": "text-generation-inference/server/pyproject.toml", "repo_id": "text-generation-inference", "token_count": 761 }
380
import * as url from "node:url"; import * as path from "node:path"; import { test, expect } from "@jest/globals"; import { Document } from "@langchain/core/documents"; import { CSVLoader } from "../fs/csv.js"; test("Test CSV loader from file with column arg", async () => { const filePath = path.resolve( path.dir...
langchainjs/langchain/src/document_loaders/tests/csv.test.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/csv.test.ts", "repo_id": "langchainjs", "token_count": 751 }
919
"""AINetwork Blockchain tool utils.""" from __future__ import annotations import os from typing import TYPE_CHECKING, Literal, Optional if TYPE_CHECKING: from ain.ain import Ain def authenticate(network: Optional[Literal["mainnet", "testnet"]] = "testnet") -> Ain: """Authenticate using the AIN Blockchain"""...
langchain/libs/community/langchain_community/tools/ainetwork/utils.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/ainetwork/utils.py", "repo_id": "langchain", "token_count": 1083 }
281
import * as fs from "fs"; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { OpenAIEmbeddings } from "@langchain/openai"; import { ContextualCompressionRetriever } from "langchain/retrievers/contextual_compression"; im...
langchainjs/examples/src/retrievers/embeddings_filter.ts/0
{ "file_path": "langchainjs/examples/src/retrievers/embeddings_filter.ts", "repo_id": "langchainjs", "token_count": 1146 }
847
import os from typing import List, Tuple from google.cloud import dlp_v2 from langchain_community.chat_models import ChatVertexAI from langchain_core.messages import AIMessage, HumanMessage from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate, MessagesPlacehol...
langchain/templates/rag-google-cloud-sensitive-data-protection/rag_google_cloud_sensitive_data_protection/chain.py/0
{ "file_path": "langchain/templates/rag-google-cloud-sensitive-data-protection/rag_google_cloud_sensitive_data_protection/chain.py", "repo_id": "langchain", "token_count": 1430 }
691
--- sidebar_position: 2 title: Retrieval augmented generation (RAG) hide_table_of_contents: true --- # RAG Let's now look at adding in a retrieval step to a prompt and an LLM, which adds up to a "retrieval-augmented generation" chain: <details> <summary>Interactive tutorial</summary> The screencast below interac...
langchainjs/docs/core_docs/docs/expression_language/cookbook/retrieval.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/expression_language/cookbook/retrieval.mdx", "repo_id": "langchainjs", "token_count": 603 }
694
from openai_functions_agent.agent import agent_executor __all__ = ["agent_executor"]
langchain/templates/openai-functions-agent-gmail/openai_functions_agent/__init__.py/0
{ "file_path": "langchain/templates/openai-functions-agent-gmail/openai_functions_agent/__init__.py", "repo_id": "langchain", "token_count": 28 }
703
from typing import Any, Dict, Optional import httpx from openai import AsyncAzureOpenAI, AzureOpenAI from llama_index.legacy.bridge.pydantic import Field, PrivateAttr, root_validator from llama_index.legacy.callbacks.base import CallbackManager from llama_index.legacy.constants import DEFAULT_EMBED_BATCH_SIZE from ll...
llama_index/llama-index-legacy/llama_index/legacy/embeddings/azure_openai.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/embeddings/azure_openai.py", "repo_id": "llama_index", "token_count": 1903 }
1,557
# (Optional) What is Curiosity in Deep Reinforcement Learning? This is an (optional) introduction to Curiosity. If you want to learn more, you can read two additional articles where we dive into the mathematical details: - [Curiosity-Driven Learning through Next State Prediction](https://medium.com/data-from-the-tren...
deep-rl-class/units/en/unit5/curiosity.mdx/0
{ "file_path": "deep-rl-class/units/en/unit5/curiosity.mdx", "repo_id": "deep-rl-class", "token_count": 1153 }
168
<jupyter_start><jupyter_text>Running IF with 🧨 diffusers on a Free Tier Google Colab_**TL;DR**: We show how to run one of the most powerful open-source text to image models **IF** on a free-tier Google Colab with 🧨 diffusers._*by DeepFloyd &* 🤗 *HuggingFace* *Image taken from official IF GitHub repo [here](https://...
notebooks/diffusers/deepfloyd_if_free_tier_google_colab.ipynb/0
{ "file_path": "notebooks/diffusers/deepfloyd_if_free_tier_google_colab.ipynb", "repo_id": "notebooks", "token_count": 9958 }
305
<jupyter_start><jupyter_text>Elasticsearch>[Elasticsearch](http://www.github.com/elastic/elasticsearch) is a search database, that supports full text and vector searches. Basic ExampleIn this basic example, we take the a Paul Graham essay, split it into chunks, embed it using an open-source embedding model, load it ...
llama_index/docs/examples/vector_stores/Elasticsearch_demo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/Elasticsearch_demo.ipynb", "repo_id": "llama_index", "token_count": 682 }
1,082
// A dependency graph that contains any wasm must all be imported // asynchronously. This `bootstrap.js` file does the single async import, so // that no one else needs to worry about it again. import("./index.js") .catch(e => console.error("Error importing `index.js`:", e));
tokenizers/tokenizers/examples/unstable_wasm/www/bootstrap.js/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/bootstrap.js", "repo_id": "tokenizers", "token_count": 79 }
462
python_sources()
llama_index/llama-index-legacy/tests/langchain_helpers/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/langchain_helpers/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,534
# Launching LangServe from a Package You can also launch LangServe directly from a package, without having to pull it into a project. This can be useful when you are developing a package and want to test it quickly. The downside of this is that it gives you a little less control over how the LangServe APIs are configu...
langchain/templates/docs/LAUNCHING_PACKAGE.md/0
{ "file_path": "langchain/templates/docs/LAUNCHING_PACKAGE.md", "repo_id": "langchain", "token_count": 403 }
633
compute_environment: LOCAL_MACHINE debug: false deepspeed_config: deepspeed_multinode_launcher: standard gradient_accumulation_steps: 1 zero3_init_flag: false zero_stage: 1 distributed_type: DEEPSPEED downcast_bf16: 'no' machine_rank: 0 main_training_function: main mixed_precision: 'bf16' num_machines: 1 num_pr...
trl/examples/accelerate_configs/deepspeed_zero1.yaml/0
{ "file_path": "trl/examples/accelerate_configs/deepspeed_zero1.yaml", "repo_id": "trl", "token_count": 171 }
856
<jupyter_start><jupyter_text>Jaguar Vector Database1. It is a distributed vector database2. The “ZeroMove” feature of JaguarDB enables instant horizontal scalability3. Multimodal: embeddings, text, images, videos, PDFs, audio, time series, and geospatial4. All-masters: allows both parallel reads and writes5. Anomaly de...
langchain/docs/docs/integrations/vectorstores/jaguar.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/jaguar.ipynb", "repo_id": "langchain", "token_count": 1945 }
182
from typing import Any, Callable, Dict, Optional, Sequence # from mistralai.models.chat_completion import ChatMessage from llama_index.core.base.llms.types import ( ChatMessage, ChatResponse, ChatResponseAsyncGen, ChatResponseGen, CompletionResponse, CompletionResponseAsyncGen, CompletionRe...
llama_index/llama-index-integrations/llms/llama-index-llms-mistralai/llama_index/llms/mistralai/base.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-mistralai/llama_index/llms/mistralai/base.py", "repo_id": "llama_index", "token_count": 4658 }
1,314
# LlamaIndex Vector_Stores Integration: Supabase
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-supabase/README.md/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-supabase/README.md", "repo_id": "llama_index", "token_count": 13 }
1,476
repos: - repo: https://github.com/dnephin/pre-commit-golang rev: v0.5.0 hooks: - id: golangci-lint args: [--config=.golangci.yml, --timeout=3m] - repo: https://github.com/crate-ci/typos rev: v1.16.10 hooks: - id: typos - repo: https://github.com/trufflesecurity/trufflehog r...
milvus/.pre-commit-config.yaml/0
{ "file_path": "milvus/.pre-commit-config.yaml", "repo_id": "milvus", "token_count": 281 }
1,698
#!/usr/bin/env python3 import argparse import json import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.models import create_model from transformers import ( BeitImageProcessor, Data2VecVisionConfig, Data2VecVisionForImageClassification, Data2VecVisionModel, ) def...
transformers/src/transformers/models/data2vec/convert_data2vec_vision_original_pytorch_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/data2vec/convert_data2vec_vision_original_pytorch_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 7103 }
653
# coding=utf-8 # Copyright 2020 Huggingface # # 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/examples/legacy/seq2seq/old_test_fsmt_bleu_score.py/0
{ "file_path": "transformers/examples/legacy/seq2seq/old_test_fsmt_bleu_score.py", "repo_id": "transformers", "token_count": 997 }
518
from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.embeddings.anyscale import AnyscaleEmbedding def test_anyscale_class(): emb = AnyscaleEmbedding() assert isinstance(emb, BaseEmbedding)
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-anyscale/tests/test_anyscale_embedding.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-anyscale/tests/test_anyscale_embedding.py", "repo_id": "llama_index", "token_count": 81 }
1,190
locust_insert_performance: collections: - milvus: db_config.primary_path: /test/milvus/db_data_011/insert_sift_1m_128_l2_2 collection_name: local_1m_128_l2 ni_per: 50000 build_index: false index_type: ivf_sq8 index_param: nlist: 1024 task: load_s...
milvus/tests/benchmark/milvus_benchmark/suites/2_locust_insert_flush.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/2_locust_insert_flush.yaml", "repo_id": "milvus", "token_count": 338 }
1,940
# coding=utf-8 # Copyright 2023 IBM and 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 # # Unle...
transformers/tests/models/patchtsmixer/test_modeling_patchtsmixer.py/0
{ "file_path": "transformers/tests/models/patchtsmixer/test_modeling_patchtsmixer.py", "repo_id": "transformers", "token_count": 20454 }
761
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="none"> <path fill="#2063EC" d="M4 15.55C4 9.72 8.72 5 14.55 5h4.11a9.34 9.34 0 1 1 0 18.68H7.58l-2.89 2.8a.41.41 0 0 1-.69-.3V15.55Z" /> </svg>
chat-ui/static/chatui/logo.svg/0
{ "file_path": "chat-ui/static/chatui/logo.svg", "repo_id": "chat-ui", "token_count": 125 }
122
from llama_index.callbacks.uptrain.base import UpTrainCallbackHandler from llama_index.core.callbacks.base_handler import BaseCallbackHandler def test_handler_callable(): names_of_base_classes = [b.__name__ for b in UpTrainCallbackHandler.__mro__] assert BaseCallbackHandler.__name__ in names_of_base_classes
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-uptrain/tests/test_uptrain_callback.py/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-uptrain/tests/test_uptrain_callback.py", "repo_id": "llama_index", "token_count": 99 }
1,297
package streamrpc import ( "context" "io" "sync" "google.golang.org/grpc" "github.com/milvus-io/milvus/internal/proto/internalpb" ) type QueryStreamServer interface { Send(*internalpb.RetrieveResults) error Context() context.Context } type QueryStreamClient interface { Recv() (*internalpb.RetrieveResults, e...
milvus/internal/util/streamrpc/streamer.go/0
{ "file_path": "milvus/internal/util/streamrpc/streamer.go", "repo_id": "milvus", "token_count": 1010 }
1,945
package typeutil import ( "fmt" "math" "path" "github.com/apache/arrow/go/v12/arrow/array" "github.com/golang/protobuf/proto" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/internal/storage" "github.com/milvus-io/milvus/pkg/common" "github.com/milvus-io/milvus/pkg/log" ...
milvus/internal/util/typeutil/storage.go/0
{ "file_path": "milvus/internal/util/typeutil/storage.go", "repo_id": "milvus", "token_count": 1942 }
1,946
""" These functions match what the spec of hnswlib is. """ import numpy as np from numpy.typing import ArrayLike def l2(x: ArrayLike, y: ArrayLike) -> float: return np.linalg.norm(x - y) ** 2 def cosine(x: ArrayLike, y: ArrayLike) -> float: # This epsilon is used to prevent division by zero, and the value i...
chroma/chromadb/utils/distance_functions.py/0
{ "file_path": "chroma/chromadb/utils/distance_functions.py", "repo_id": "chroma", "token_count": 284 }
29
# 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...
transformers/tests/pipelines/test_pipelines_image_feature_extraction.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_image_feature_extraction.py", "repo_id": "transformers", "token_count": 2574 }
760
"""All integration tests for chains."""
langchain/libs/langchain/tests/integration_tests/chains/__init__.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/chains/__init__.py", "repo_id": "langchain", "token_count": 9 }
636
import json import os import pickle import subprocess from functools import partial from pathlib import Path from tempfile import gettempdir from textwrap import dedent from types import FunctionType from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from multiprocess import...
datasets/tests/test_fingerprint.py/0
{ "file_path": "datasets/tests/test_fingerprint.py", "repo_id": "datasets", "token_count": 6783 }
154
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-google/llama_index/readers/google/keep/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-google/llama_index/readers/google/keep/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,371
from abc import abstractmethod from typing import List, Sequence, Optional, Tuple from uuid import UUID from chromadb.api.types import ( Embeddings, Documents, IDs, Metadatas, Metadata, Where, WhereDocument, ) from chromadb.config import Component class DB(Component): @abstractmethod ...
chroma/chromadb/db/__init__.py/0
{ "file_path": "chroma/chromadb/db/__init__.py", "repo_id": "chroma", "token_count": 1349 }
14
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
transformers/tests/test_image_processing_utils.py/0
{ "file_path": "transformers/tests/test_image_processing_utils.py", "repo_id": "transformers", "token_count": 2518 }
766
# coding=utf-8 # Copyright 2018 HuggingFace Inc.. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
transformers/examples/pytorch/test_accelerate_examples.py/0
{ "file_path": "transformers/examples/pytorch/test_accelerate_examples.py", "repo_id": "transformers", "token_count": 6360 }
590
import os import time import uuid from typing import List import numpy as np import pinecone # type: ignore import pytest from langchain_core.documents import Document from langchain_openai import OpenAIEmbeddings from pinecone import PodSpec from langchain_pinecone import Pinecone INDEX_NAME = "langchain-test-inde...
langchain/libs/partners/pinecone/tests/integration_tests/test_vectorstores.py/0
{ "file_path": "langchain/libs/partners/pinecone/tests/integration_tests/test_vectorstores.py", "repo_id": "langchain", "token_count": 5062 }
623
# Summary [[summary]] That was a lot of information! Let's summarize: - Reinforcement Learning is a computational approach of learning from actions. We build an agent that learns from the environment **by interacting with it through trial and error** and receiving rewards (negative or positive) as feedback. - The go...
deep-rl-class/units/en/unit1/summary.mdx/0
{ "file_path": "deep-rl-class/units/en/unit1/summary.mdx", "repo_id": "deep-rl-class", "token_count": 382 }
163
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-clickhouse/llama_index/vector_stores/clickhouse/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-clickhouse/llama_index/vector_stores/clickhouse/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,514
from typing import List from langchain_core.documents import Document from langchain_community.retrievers.breebs import BreebsRetriever class TestBreebsRetriever: def test_breeb_query(self) -> None: breeb_key = "Parivoyage" query = "What are the best churches to visit in Paris?" breeb_re...
langchain/libs/community/tests/integration_tests/retrievers/test_breebs.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/retrievers/test_breebs.py", "repo_id": "langchain", "token_count": 289 }
344
# Generated content DO NOT EDIT from .. import models Model = models.Model BPE = models.BPE Unigram = models.Unigram WordLevel = models.WordLevel WordPiece = models.WordPiece
tokenizers/bindings/python/py_src/tokenizers/models/__init__.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/models/__init__.py", "repo_id": "tokenizers", "token_count": 56 }
458
"""Power BI agent.""" from __future__ import annotations from typing import TYPE_CHECKING, Any, Dict, List, Optional from langchain_core.callbacks import BaseCallbackManager from langchain_core.language_models import BaseLanguageModel from langchain_community.agent_toolkits.powerbi.prompt import ( POWERBI_PREFIX...
langchain/libs/community/langchain_community/agent_toolkits/powerbi/base.py/0
{ "file_path": "langchain/libs/community/langchain_community/agent_toolkits/powerbi/base.py", "repo_id": "langchain", "token_count": 1019 }
214
# 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/models/t5/__init__.py/0
{ "file_path": "transformers/src/transformers/models/t5/__init__.py", "repo_id": "transformers", "token_count": 1938 }
664
# ResNeXt A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transformations) $C$,...
pytorch-image-models/docs/models/resnext.md/0
{ "file_path": "pytorch-image-models/docs/models/resnext.md", "repo_id": "pytorch-image-models", "token_count": 3053 }
356
#!/usr/bin/env python3 # coding=utf-8 # 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 #...
peft/tests/test_lora_megatron.py/0
{ "file_path": "peft/tests/test_lora_megatron.py", "repo_id": "peft", "token_count": 2964 }
330
from llama_index.legacy.core.base_query_engine import BaseQueryEngine # SQL from llama_index.legacy.indices.struct_store.sql_query import ( NLSQLTableQueryEngine, PGVectorSQLQueryEngine, SQLTableRetrieverQueryEngine, ) from llama_index.legacy.query_engine.citation_query_engine import CitationQueryEngine fr...
llama_index/llama-index-legacy/llama_index/legacy/query_engine/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/query_engine/__init__.py", "repo_id": "llama_index", "token_count": 962 }
1,588
# Modify this Procfile to fit your needs web: uvicorn main:app --host 0.0.0.0 --port 8080
weblangchain/Procfile/0
{ "file_path": "weblangchain/Procfile", "repo_id": "weblangchain", "token_count": 32 }
2,148
# Generated content DO NOT EDIT from .. import processors PostProcessor = processors.PostProcessor BertProcessing = processors.BertProcessing ByteLevel = processors.ByteLevel RobertaProcessing = processors.RobertaProcessing Sequence = processors.Sequence TemplateProcessing = processors.TemplateProcessing
tokenizers/bindings/python/py_src/tokenizers/processors/__init__.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/processors/__init__.py", "repo_id": "tokenizers", "token_count": 74 }
415
import { BaseTransformOutputParser } from "./transform.js"; /** * OutputParser that parses LLMResult into the top likely string and * encodes it into bytes. */ export class BytesOutputParser extends BaseTransformOutputParser<Uint8Array> { static lc_name() { return "BytesOutputParser"; } lc_namespace = ["...
langchainjs/langchain-core/src/output_parsers/bytes.ts/0
{ "file_path": "langchainjs/langchain-core/src/output_parsers/bytes.ts", "repo_id": "langchainjs", "token_count": 193 }
834
from typing import List from langchain import hub from langchain.agents import AgentExecutor from langchain.agents.format_scratchpad import format_log_to_str from langchain.agents.output_parsers import ReActJsonSingleInputOutputParser from langchain.callbacks.manager import CallbackManagerForRetrieverRun from langchai...
langchain/templates/retrieval-agent-fireworks/retrieval_agent_fireworks/chain.py/0
{ "file_path": "langchain/templates/retrieval-agent-fireworks/retrieval_agent_fireworks/chain.py", "repo_id": "langchain", "token_count": 1401 }
710
"""Test the airbyte document loader. Light test to ensure that the airbyte document loader can be imported. """ def test_airbyte_import() -> None: """Test that the airbyte document loader can be imported.""" from langchain_community.document_loaders import airbyte # noqa
langchain/libs/community/tests/unit_tests/document_loaders/test_airbyte.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_airbyte.py", "repo_id": "langchain", "token_count": 78 }
375
# Streaming ## What is Streaming? Token streaming is the mode in which the server returns the tokens one by one as the model generates them. This enables showing progressive generations to the user rather than waiting for the whole generation. Streaming is an essential aspect of the end-user experience as it reduces ...
text-generation-inference/docs/source/conceptual/streaming.md/0
{ "file_path": "text-generation-inference/docs/source/conceptual/streaming.md", "repo_id": "text-generation-inference", "token_count": 1981 }
417
// 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/querycoordv2/checkers/channel_checker_test.go/0
{ "file_path": "milvus/internal/querycoordv2/checkers/channel_checker_test.go", "repo_id": "milvus", "token_count": 3104 }
1,751
import { LanceDB } from "@langchain/community/vectorstores/lancedb"; import { OpenAIEmbeddings } from "@langchain/openai"; import { connect } from "vectordb"; import * as fs from "node:fs/promises"; import * as path from "node:path"; import os from "node:os"; export const run = async () => { const dir = await fs.mkd...
langchainjs/examples/src/indexes/vector_stores/lancedb/fromTexts.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/lancedb/fromTexts.ts", "repo_id": "langchainjs", "token_count": 300 }
817
# 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/LICENSE-2.0 # # Unless required by appl...
accelerate/examples/cv_example.py/0
{ "file_path": "accelerate/examples/cv_example.py", "repo_id": "accelerate", "token_count": 3205 }
9
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, get_...
datasets/tests/test_file_utils.py/0
{ "file_path": "datasets/tests/test_file_utils.py", "repo_id": "datasets", "token_count": 2016 }
160
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.requests import RequestsToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in RequestsToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-requests/tests/test_tools_requests.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-requests/tests/test_tools_requests.py", "repo_id": "llama_index", "token_count": 94 }
1,435
package datacoord import ( "testing" "github.com/samber/lo" "github.com/stretchr/testify/suite" "go.uber.org/zap" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" "github.com/milvus-io/milvus/internal/proto/datapb" "github.com/milvus-io/milvus/pkg/log...
milvus/internal/datacoord/compaction_l0_view_test.go/0
{ "file_path": "milvus/internal/datacoord/compaction_l0_view_test.go", "repo_id": "milvus", "token_count": 1677 }
1,772
#ifndef _qdq_8_cuh #define _qdq_8_cuh #include "qdq_util.cuh" #include "../../config.h" #if QMODE_8BIT == 1 // Not implemented #else __forceinline__ __device__ void shuffle_8bit_4 ( uint32_t* q, int stride ) { } __forceinline__ __device__ void dequant_8bit_8 ( const uint32_t q_0, const uint32_t ...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_8.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_8.cuh", "repo_id": "text-generation-inference", "token_count": 336 }
440
import inspect def is_caller_internal(depth: int = 2) -> bool: """Return whether the caller at `depth` of this function is internal.""" try: frame = inspect.currentframe() except AttributeError: return False if frame is None: return False try: for _ in range(depth):...
langchain/libs/core/langchain_core/_api/internal.py/0
{ "file_path": "langchain/libs/core/langchain_core/_api/internal.py", "repo_id": "langchain", "token_count": 283 }
386
import json import urllib.request from typing import Any, List from langchain_core.documents import Document from langchain_core.utils import stringify_dict from langchain_community.document_loaders.base import BaseLoader class FigmaFileLoader(BaseLoader): """Load `Figma` file.""" def __init__(self, access...
langchain/libs/community/langchain_community/document_loaders/figma.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/figma.py", "repo_id": "langchain", "token_count": 668 }
247
<!--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...
accelerate/docs/source/usage_guides/quantization.md/0
{ "file_path": "accelerate/docs/source/usage_guides/quantization.md", "repo_id": "accelerate", "token_count": 1962 }
4
# Tavily Search API [Tavily's Search API](https://tavily.com) is a search engine built specifically for AI agents (LLMs), delivering real-time, accurate, and factual results at speed. ## Usage import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <IntegrationInstallTooltip></Integ...
langchainjs/docs/core_docs/docs/integrations/retrievers/tavily.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/retrievers/tavily.mdx", "repo_id": "langchainjs", "token_count": 248 }
710
from llama_index.readers.airbyte_shopify.base import AirbyteShopifyReader __all__ = ["AirbyteShopifyReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-shopify/llama_index/readers/airbyte_shopify/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-shopify/llama_index/readers/airbyte_shopify/__init__.py", "repo_id": "llama_index", "token_count": 36 }
1,260
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/retrievers/llama-index-retrievers-you/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/retrievers/llama-index-retrievers-you/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,586
<jupyter_start><jupyter_text>Timescale Vector (Postgres) self-querying [Timescale Vector](https://www.timescale.com/ai) is PostgreSQL++ for AI applications. It enables you to efficiently store and query billions of vector embeddings in `PostgreSQL`.This notebook shows how to use the Postgres vector database (`Timescale...
langchain/docs/docs/integrations/retrievers/self_query/timescalevector_self_query.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/self_query/timescalevector_self_query.ipynb", "repo_id": "langchain", "token_count": 2909 }
157
<jupyter_start><jupyter_text>ClickUp>[ClickUp](https://clickup.com/) is an all-in-one productivity platform that provides small and large teams across industries with flexible and customizable work management solutions, tools, and functions. >It is a cloud-based project management solution for businesses of all sizes f...
langchain/docs/docs/integrations/toolkits/clickup.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/toolkits/clickup.ipynb", "repo_id": "langchain", "token_count": 3668 }
177
from typing import Any, List, Optional from langchain_core.callbacks.manager import CallbackManagerForLLMRun from langchain_core.language_models.chat_models import BaseChatModel from langchain_core.messages import AIMessage, BaseMessage from langchain_core.outputs import ChatGeneration, ChatResult class FakeChatLLMT...
langchain/libs/partners/robocorp/tests/unit_tests/_fixtures.py/0
{ "file_path": "langchain/libs/partners/robocorp/tests/unit_tests/_fixtures.py", "repo_id": "langchain", "token_count": 1251 }
639
<jupyter_start><jupyter_text>Lantern Vector StoreIn this notebook we are going to show how to use [Postgresql](https://www.postgresql.org) and [Lantern](https://github.com/lanterndata/lantern) to perform vector searches in LlamaIndex If you're opening this Notebook on colab, you will probably need to install LlamaInde...
llama_index/docs/examples/vector_stores/LanternIndexDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/LanternIndexDemo.ipynb", "repo_id": "llama_index", "token_count": 1843 }
1,132
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/src/index/SkipIndex.h/0
{ "file_path": "milvus/internal/core/src/index/SkipIndex.h", "repo_id": "milvus", "token_count": 4255 }
1,739
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/readers/schema/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/schema/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,596
import os import tempfile from pathlib import Path from unittest import TestCase import pyarrow as pa import pytest from datasets.arrow_dataset import Dataset from datasets.arrow_reader import ArrowReader, BaseReader, FileInstructions, ReadInstruction, make_file_instructions from datasets.info import DatasetInfo from...
datasets/tests/test_arrow_reader.py/0
{ "file_path": "datasets/tests/test_arrow_reader.py", "repo_id": "datasets", "token_count": 5688 }
142
python_tests( name="tests", )
llama_index/llama-index-core/tests/query_pipeline/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/query_pipeline/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,156
from langchain_community.utils.math import ( Matrix, cosine_similarity, cosine_similarity_top_k, ) __all__ = ["Matrix", "cosine_similarity", "cosine_similarity_top_k"]
langchain/libs/langchain/langchain/utils/math.py/0
{ "file_path": "langchain/libs/langchain/langchain/utils/math.py", "repo_id": "langchain", "token_count": 71 }
610
<jupyter_start><jupyter_text>Tracking token usageThis notebook goes over how to track your token usage for specific calls. It is currently only implemented for the OpenAI API.Let's first look at an extremely simple example of tracking token usage for a single LLM call.<jupyter_code>from langchain.callbacks import get_o...
langchain/docs/docs/modules/model_io/llms/token_usage_tracking.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/llms/token_usage_tracking.ipynb", "repo_id": "langchain", "token_count": 860 }
197
<!--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/bart.md/0
{ "file_path": "transformers/docs/source/en/model_doc/bart.md", "repo_id": "transformers", "token_count": 3297 }
497
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-vllm/llama_index/llms/vllm/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-vllm/llama_index/llms/vllm/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,283
from llama_index.readers.pandas_ai.base import PandasAIReader __all__ = ["PandasAIReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-pandas-ai/llama_index/readers/pandas_ai/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-pandas-ai/llama_index/readers/pandas_ai/__init__.py", "repo_id": "llama_index", "token_count": 36 }
1,361
# MEP(Milvus Enhancement Proposals) Templates Current state: [One of "Under Discussion", "Accepted", "Rejected"] ISSUE: link to the GitHub issue Keywords: list keywords about this MEP Released: <Milvus Release Version> ## Summary(required) What are we going to do? ## Motivation(required) Why are we doing this? ...
milvus/docs/design_docs/00000000-MEP-Template.md/0
{ "file_path": "milvus/docs/design_docs/00000000-MEP-Template.md", "repo_id": "milvus", "token_count": 382 }
1,641
from langchain_core.documents import Document __all__ = ["Document"]
langchain/libs/langchain/langchain/docstore/document.py/0
{ "file_path": "langchain/libs/langchain/langchain/docstore/document.py", "repo_id": "langchain", "token_count": 20 }
507
"""Test Azue CosmosDB MongoDB vCore Vector Search functionality.""" from __future__ import annotations import os from time import sleep from typing import List import pytest try: from pymongo import MongoClient INDEX_NAME = "llamaindex-test-index" NAMESPACE = "llamaindex_test_db.llamaindex_test_collect...
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azurecosmosmongo/tests/test_azurecosmosmongo.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azurecosmosmongo/tests/test_azurecosmosmongo.py", "repo_id": "llama_index", "token_count": 2094 }
1,547
package datanode import ( "sync" "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus/pkg/util/conc" "github.com/milvus-io/milvus/pkg/util/paramtable" ) func Test_getOrCreateIOPool(t *testing.T) { ioConcurrency := Params.DataNodeCfg.IOConcurrency.GetValue() paramtable.Get().Save(Params...
milvus/internal/datanode/io_pool_test.go/0
{ "file_path": "milvus/internal/datanode/io_pool_test.go", "repo_id": "milvus", "token_count": 407 }
1,697
import { authCondition } from "$lib/server/auth"; import { collections } from "$lib/server/database"; import type { SharedConversation } from "$lib/types/SharedConversation"; import { getShareUrl } from "$lib/utils/getShareUrl"; import { hashConv } from "$lib/utils/hashConv"; import { error } from "@sveltejs/kit"; impo...
chat-ui/src/routes/conversation/[id]/share/+server.ts/0
{ "file_path": "chat-ui/src/routes/conversation/[id]/share/+server.ts", "repo_id": "chat-ui", "token_count": 761 }
101
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/api/internal_classes_overview.md/0
{ "file_path": "diffusers/docs/source/en/api/internal_classes_overview.md", "repo_id": "diffusers", "token_count": 211 }
190
import { test } from "@jest/globals"; import { OpenAI } from "@langchain/openai"; import { PromptTemplate } from "@langchain/core/prompts"; import { QAEvalChain } from "../eval_chain.js"; test("Test QAEvalChain", async () => { const model = new OpenAI({ modelName: "gpt-3.5-turbo-instruct" }); const prompt = new Pr...
langchainjs/langchain/src/evaluation/qa/tests/eval_chain.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/evaluation/qa/tests/eval_chain.int.test.ts", "repo_id": "langchainjs", "token_count": 418 }
906
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-google/llama_index/tools/google/search/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-google/llama_index/tools/google/search/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,484
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ko/tasks/visual_question_answering.md/0
{ "file_path": "transformers/docs/source/ko/tasks/visual_question_answering.md", "repo_id": "transformers", "token_count": 11287 }
500
{ "name": "test-exports-bun", "version": "0.0.0", "private": true, "description": "Tests for the things exported by the langchain package", "main": "./index.mjs", "type": "module", "scripts": { "build": "tsc", "test": "bun run test:esm && bun run test:cjs && bun run test:cjs:import && bun run test...
langchainjs/environment_tests/test-exports-bun/package.json/0
{ "file_path": "langchainjs/environment_tests/test-exports-bun/package.json", "repo_id": "langchainjs", "token_count": 443 }
747
<jupyter_start><jupyter_text>Twitter>[Twitter](https://twitter.com/) is an online social media and social networking service.This loader fetches the text from the Tweets of a list of `Twitter` users, using the `tweepy` Python package.You must initialize the loader with your `Twitter API` token, and you need to pass in ...
langchain/docs/docs/integrations/document_loaders/twitter.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/twitter.ipynb", "repo_id": "langchain", "token_count": 354 }
116
[tool.poetry] name = "rag-chroma" version = "0.1.0" description = "RAG using Chroma" authors = [ "Erick Friis <erick@langchain.dev>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" openai = "<2" tiktoken = ">=0.5.1" chromadb = ">=0.4.14" [tool.poetry.group.dev.depende...
langchain/templates/rag-chroma/pyproject.toml/0
{ "file_path": "langchain/templates/rag-chroma/pyproject.toml", "repo_id": "langchain", "token_count": 287 }
692
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-chroma/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-chroma/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,475
<jupyter_start><jupyter_text>Token Counting HandlerThis notebook walks through how to use the TokenCountingHandler and how it can be used to track your prompt, completion, and embedding token usage over time. If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip in...
llama_index/docs/examples/callbacks/TokenCountingHandler.ipynb/0
{ "file_path": "llama_index/docs/examples/callbacks/TokenCountingHandler.ipynb", "repo_id": "llama_index", "token_count": 1895 }
1,044
// This example illustrates how to implement custom operations. These operations can provide their // own forward pass (CPU and GPU versions) as well as their backward pass. // // In this example we add the RMS normalization operation and implement it for f32. #[cfg(feature = "mkl")] extern crate intel_mkl_src; #[rus...
candle/candle-examples/examples/custom-ops/main.rs/0
{ "file_path": "candle/candle-examples/examples/custom-ops/main.rs", "repo_id": "candle", "token_count": 1475 }
40
"""Test Fireworks AI API Wrapper.""" from typing import Generator import pytest from langchain_core.outputs import LLMResult from langchain_community.llms.fireworks import Fireworks @pytest.fixture def llm() -> Fireworks: return Fireworks(model_kwargs={"temperature": 0, "max_tokens": 512}) @pytest.mark.schedu...
langchain/libs/community/tests/integration_tests/llms/test_fireworks.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_fireworks.py", "repo_id": "langchain", "token_count": 1500 }
337
<jupyter_start><jupyter_text>Example selectorsIf you have a large number of examples, you may need to select which ones to include in the prompt. The Example Selector is the class responsible for doing so.The base interface is defined as below:```pythonclass BaseExampleSelector(ABC): """Interface for selecting examp...
langchain/docs/docs/modules/model_io/prompts/example_selectors.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/prompts/example_selectors.ipynb", "repo_id": "langchain", "token_count": 1174 }
200