text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datacoord/segment_info.go/0
{ "file_path": "milvus/internal/datacoord/segment_info.go", "repo_id": "milvus", "token_count": 4206 }
1,778
use pyo3::exceptions::PyValueError; use pyo3::prelude::*; pub fn wrap_err(err: ::candle::Error) -> PyErr { PyErr::new::<PyValueError, _>(format!("{err:?}")) }
candle/candle-pyo3/src/utils.rs/0
{ "file_path": "candle/candle-pyo3/src/utils.rs", "repo_id": "candle", "token_count": 74 }
64
"""Wrapper for the Reddit API""" from typing import Any, Dict, List, Optional from langchain_core.pydantic_v1 import BaseModel, root_validator from langchain_core.utils import get_from_dict_or_env class RedditSearchAPIWrapper(BaseModel): """Wrapper for Reddit API To use, set the environment variables ``RED...
langchain/libs/community/langchain_community/utilities/reddit_search.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/reddit_search.py", "repo_id": "langchain", "token_count": 2042 }
308
// 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/query/visitors/ExecPlanNodeVisitor.cpp/0
{ "file_path": "milvus/internal/core/src/query/visitors/ExecPlanNodeVisitor.cpp", "repo_id": "milvus", "token_count": 4876 }
1,654
python_sources() python_tests( name="tests0", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-astra/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-astra/tests/BUILD", "repo_id": "llama_index", "token_count": 23 }
1,543
import { Index } from "@upstash/vector"; import { OpenAIEmbeddings } from "@langchain/openai"; import { UpstashVectorStore } from "@langchain/community/vectorstores/upstash"; const embeddings = new OpenAIEmbeddings({}); // Creating the index with the provided credentials. const indexWithCredentials = new Index({ ur...
langchainjs/examples/src/indexes/vector_stores/upstash/create_client.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/upstash/create_client.ts", "repo_id": "langchainjs", "token_count": 227 }
882
# 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/pix2struct/configuration_pix2struct.py/0
{ "file_path": "transformers/src/transformers/models/pix2struct/configuration_pix2struct.py", "repo_id": "transformers", "token_count": 6638 }
645
from llama_index.core.program.llm_prompt_program import BaseLLMFunctionProgram from llama_index.program.openai import OpenAIPydanticProgram def test_class(): names_of_base_classes = [b.__name__ for b in OpenAIPydanticProgram.__mro__] assert BaseLLMFunctionProgram.__name__ in names_of_base_classes
llama_index/llama-index-integrations/program/llama-index-program-openai/tests/test_program_openai.py/0
{ "file_path": "llama_index/llama-index-integrations/program/llama-index-program-openai/tests/test_program_openai.py", "repo_id": "llama_index", "token_count": 104 }
1,444
# Render.com Deployment This is an example deployment to Render.com using [terraform](https://www.terraform.io/) ## Requirements - [Terraform CLI v1.3.4+](https://developer.hashicorp.com/terraform/tutorials/gcp-get-started/install-cli) - [Terraform Render provider](https://registry.terraform.io/providers/jackall3n/r...
chroma/examples/deployments/render-terraform/README.md/0
{ "file_path": "chroma/examples/deployments/render-terraform/README.md", "repo_id": "chroma", "token_count": 936 }
38
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-microsoft-outlook/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-microsoft-outlook/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,483
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-openapi/llama_index/tools/openapi/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-openapi/llama_index/tools/openapi/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,494
package planparserv2 import "github.com/milvus-io/milvus/internal/proto/planpb" type LogicalExprVisitor interface { VisitExpr(expr *planpb.Expr) interface{} VisitTermExpr(expr *planpb.TermExpr) interface{} VisitUnaryExpr(expr *planpb.UnaryExpr) interface{} VisitBinaryExpr(expr *planpb.BinaryExpr) interface{} Vis...
milvus/internal/parser/planparserv2/logical_expr_visitor.go/0
{ "file_path": "milvus/internal/parser/planparserv2/logical_expr_visitor.go", "repo_id": "milvus", "token_count": 285 }
1,818
# MobileNet v2 **MobileNetV2** is a convolutional neural network architecture that seeks to perform well on mobile devices. It is based on an [inverted residual structure](https://paperswithcode.com/method/inverted-residual-block) where the residual connections are between the bottleneck layers. The intermediate expa...
pytorch-image-models/hfdocs/source/models/mobilenet-v2.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/mobilenet-v2.mdx", "repo_id": "pytorch-image-models", "token_count": 3401 }
374
from llama_index.readers.agent_search.base import AgentSearchReader __all__ = ["AgentSearchReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-agent-search/llama_index/readers/agent_search/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-agent-search/llama_index/readers/agent_search/__init__.py", "repo_id": "llama_index", "token_count": 30 }
1,447
import CodeBlock from "@theme/CodeBlock"; # Agent with Zapier NLA Integration Full docs here: https://nla.zapier.com/start/ **Zapier Natural Language Actions** gives you access to the 5k+ apps and 20k+ actions on Zapier's platform through a natural language API interface. NLA supports apps like Gmail, Salesforce, T...
langchainjs/docs/core_docs/docs/integrations/tools/zapier_agent.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/tools/zapier_agent.mdx", "repo_id": "langchainjs", "token_count": 503 }
793
# coding=utf-8 # Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, 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.or...
transformers/src/transformers/models/deprecated/retribert/configuration_retribert.py/0
{ "file_path": "transformers/src/transformers/models/deprecated/retribert/configuration_retribert.py", "repo_id": "transformers", "token_count": 2013 }
646
from __future__ import annotations import os import pickle import uuid from configparser import ConfigParser from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple import numpy as np from langchain_core.documents import Document from langchain_core.embeddings import Embedding...
langchain/libs/community/langchain_community/vectorstores/annoy.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/annoy.py", "repo_id": "langchain", "token_count": 7377 }
325
# Integrations LlamaIndex has a number of community integrations, from vector stores, to prompt trackers, tracers, and more! ## LlamaPacks -- Code Templates LlamaHub hosts a full suite of LlamaPacks -- templates for features that you can download, edit, and try out! This offers a quick way to learn about new feature...
llama_index/docs/community/integrations.md/0
{ "file_path": "llama_index/docs/community/integrations.md", "repo_id": "llama_index", "token_count": 830 }
1,119
python_tests()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-gradient/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-gradient/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,183
import argparse import tempfile import torch from accelerate import load_checkpoint_and_dispatch from diffusers.models.transformers.prior_transformer import PriorTransformer from diffusers.pipelines.shap_e import ShapERenderer """ Example - From the diffusers root directory: Download weights: ```sh $ wget "https:...
diffusers/scripts/convert_shap_e_to_diffusers.py/0
{ "file_path": "diffusers/scripts/convert_shap_e_to_diffusers.py", "repo_id": "diffusers", "token_count": 22932 }
206
import random from time import sleep import pytest import copy from base.client_base import TestcaseBase from base.index_wrapper import ApiIndexWrapper from utils.util_log import test_log as log from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel, CheckTas...
milvus/tests/python_client/testcases/test_index.py/0
{ "file_path": "milvus/tests/python_client/testcases/test_index.py", "repo_id": "milvus", "token_count": 40478 }
1,982
"""Simple reader that reads OSMmap data from overpass API.""" import random import string import warnings from typing import List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document warnings.filterwarnings("ignore") class OpenMap(BaseReader): """OpenMap R...
llama_index/llama-index-integrations/readers/llama-index-readers-maps/llama_index/readers/maps/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-maps/llama_index/readers/maps/base.py", "repo_id": "llama_index", "token_count": 1853 }
1,380
# Similarity Score Threshold A problem some people may face is that when doing a similarity search, you have to supply a `k` value. This value is responsible for bringing N similar results back to you. But what if you don't know the `k` value? What if you want the system to return all the possible results? In a real-...
langchainjs/docs/core_docs/docs/modules/data_connection/retrievers/similarity-score-threshold-retriever.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/retrievers/similarity-score-threshold-retriever.mdx", "repo_id": "langchainjs", "token_count": 350 }
759
{ "details": { "best_of_sequences": null, "finish_reason": "eos_token", "generated_tokens": 9, "prefill": [ { "id": 0, "logprob": null, "text": "<pad>" } ], "seed": 0, "tokens": [ { "id": 16017, "logprob": -0.30908203, "spec...
text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base_all_params.json", "repo_id": "text-generation-inference", "token_count": 831 }
367
"""Prompt Mixin.""" from abc import ABC, abstractmethod from collections import defaultdict from copy import deepcopy from typing import Dict, Union from llama_index.core.prompts.base import BasePromptTemplate HasPromptType = Union["PromptMixin", BasePromptTemplate] PromptDictType = Dict[str, BasePromptTemplate] Pro...
llama_index/llama-index-core/llama_index/core/prompts/mixin.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/prompts/mixin.py", "repo_id": "llama_index", "token_count": 1331 }
1,195
import asyncio import logging from typing import Dict, Iterable, List, Optional from langchain_core.embeddings import Embeddings from langchain_core.pydantic_v1 import ( BaseModel, Extra, Field, SecretStr, root_validator, ) from langchain_core.utils import convert_to_secret_str, get_from_dict_or_en...
langchain/libs/partners/mistralai/langchain_mistralai/embeddings.py/0
{ "file_path": "langchain/libs/partners/mistralai/langchain_mistralai/embeddings.py", "repo_id": "langchain", "token_count": 2722 }
690
#!/usr/bin/env python # # Licensed to the Apache Software Foundation (ASF) 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 # "...
milvus/build/docker/pulsar/apply-config-from-env.py/0
{ "file_path": "milvus/build/docker/pulsar/apply-config-from-env.py", "repo_id": "milvus", "token_count": 1348 }
1,696
import re from pathlib import Path from typing import Iterator, List from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader class AcreomLoader(BaseLoader): """Load `acreom` vault from a directory.""" FRONT_MATTER_REGEX = re.compile(r"^---\n(.*?)\n---\...
langchain/libs/community/langchain_community/document_loaders/acreom.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/acreom.py", "repo_id": "langchain", "token_count": 1246 }
242
<jupyter_start><jupyter_text>Alibaba Cloud PAI EAS>[Machine Learning Platform for AI of Alibaba Cloud](https://www.alibabacloud.com/help/en/pai) is a machine learning or deep learning engineering platform intended for enterprises and developers. It provides easy-to-use, cost-effective, high-performance, and easy-to-sca...
langchain/docs/docs/integrations/llms/alibabacloud_pai_eas_endpoint.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/alibabacloud_pai_eas_endpoint.ipynb", "repo_id": "langchain", "token_count": 612 }
123
package testutils import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/testutil" "github.com/stretchr/testify/suite" ) // PromMetricsSuite is a util suite wrapper providing prometheus metrics assertion functions. type PromMetricsSuite struct { suite.Suite } fu...
milvus/pkg/util/testutils/prometheus_metric.go/0
{ "file_path": "milvus/pkg/util/testutils/prometheus_metric.go", "repo_id": "milvus", "token_count": 178 }
2,121
import unittest from unittest.mock import MagicMock, Mock, patch from langchain_community.document_loaders import CubeSemanticLoader MODULE_PATH = "langchain_community.document_loaders.cube_semantic.CubeSemanticLoader" class TestCubeSemanticLoader(unittest.TestCase): def setUp(self) -> None: self.loader...
langchain/libs/community/tests/unit_tests/document_loaders/test_cube_semantic.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_cube_semantic.py", "repo_id": "langchain", "token_count": 1052 }
369
// 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/rootcoord/describe_collection_task.go/0
{ "file_path": "milvus/internal/rootcoord/describe_collection_task.go", "repo_id": "milvus", "token_count": 549 }
1,881
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-s3/llama_index/readers/s3/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-s3/llama_index/readers/s3/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,547
import os import shutil from pathlib import Path from llama_index.cli.new_package.templates import ( pyproject_str, readme_str, init_str, init_with_prefix_str, ) from typing import Optional def _create_init_file(dir: str): # create __init__.py Path(dir + "/__init__.py").touch() def _create_t...
llama_index/llama-index-cli/llama_index/cli/new_package/base.py/0
{ "file_path": "llama_index/llama-index-cli/llama_index/cli/new_package/base.py", "repo_id": "llama_index", "token_count": 1701 }
1,193
import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL.Image import torch import torch.utils.checkpoint from ...models import UNet2DModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscret...
diffusers/src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion_superresolution.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion_superresolution.py", "repo_id": "diffusers", "token_count": 3451 }
246
# sql-llama2 This template enables a user to interact with a SQL database using natural language. It uses LLamA2-13b hosted by [Replicate](https://python.langchain.com/docs/integrations/llms/replicate), but can be adapted to any API that supports LLaMA2 including [Fireworks](https://python.langchain.com/docs/integr...
langchain/templates/sql-llama2/README.md/0
{ "file_path": "langchain/templates/sql-llama2/README.md", "repo_id": "langchain", "token_count": 724 }
735
from langchain_community.utilities.arxiv import ArxivAPIWrapper __all__ = ["ArxivAPIWrapper"]
langchain/libs/langchain/langchain/utilities/arxiv.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/arxiv.py", "repo_id": "langchain", "token_count": 34 }
615
import { test } from "@jest/globals"; import { FakeChatModel } from "../../utils/testing/index.js"; test("Test ChatModel uses callbacks", async () => { const model = new FakeChatModel({}); let acc = ""; const response = await model.invoke("Hello there!", { callbacks: [ { handleLLMNewToken: (tok...
langchainjs/langchain-core/src/language_models/tests/chat_models.test.ts/0
{ "file_path": "langchainjs/langchain-core/src/language_models/tests/chat_models.test.ts", "repo_id": "langchainjs", "token_count": 385 }
896
<jupyter_start><jupyter_text>Supabase (Postgres) >[Supabase](https://supabase.com/docs) is an open-source Firebase alternative. `Supabase` is built on top of `PostgreSQL`, which offers strong SQL querying capabilities and enables a simple interface with already-existing tools and frameworks.>[PostgreSQL](https://en.wik...
langchain/docs/docs/integrations/vectorstores/supabase.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/supabase.ipynb", "repo_id": "langchain", "token_count": 1990 }
194
import { DirectoryLoader, UnknownHandling } from "./directory.js"; import { TextLoader } from "./text.js"; /** * A class that extends the DirectoryLoader class. It represents a * document loader that loads documents from a directory in the Notion * format. It uses the TextLoader for loading '.md' files and ignores ...
langchainjs/langchain/src/document_loaders/fs/notion.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/fs/notion.ts", "repo_id": "langchainjs", "token_count": 188 }
917
[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 = ["GradientEmbedding"] contains_example = false import_path = "llama_index.embeddings.gradie...
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-gradient/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-gradient/pyproject.toml", "repo_id": "llama_index", "token_count": 647 }
1,195
"""Wrapper around Google's PaLM Chat API.""" from __future__ import annotations import logging from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, cast from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_models.chat_...
langchain/libs/community/langchain_community/chat_models/google_palm.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/google_palm.py", "repo_id": "langchain", "token_count": 5119 }
244
use serde::Deserialize; #[derive(Deserialize)] /// The configuration for the chosen storage. /// # Options /// - S3: The configuration for the s3 storage. /// # Notes /// See config.rs in the root of the worker crate for an example of how to use /// config files to configure the worker. pub(crate) enum StorageConfig {...
chroma/rust/worker/src/storage/config.rs/0
{ "file_path": "chroma/rust/worker/src/storage/config.rs", "repo_id": "chroma", "token_count": 169 }
63
import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; import { OpenAIEmbeddings } from "@langchain/openai"; import { ContextualCompressionRetriever } from "langchain/retrievers/contextual_compression"; import { EmbeddingsFilter } from "langchain/retrievers/document_compressors/embeddings_filter"; im...
langchainjs/examples/src/retrievers/document_compressor_pipeline.ts/0
{ "file_path": "langchainjs/examples/src/retrievers/document_compressor_pipeline.ts", "repo_id": "langchainjs", "token_count": 723 }
850
package tasks // TODO: rename this file into search_task.go import ( "bytes" "context" "fmt" "strconv" "github.com/golang/protobuf/proto" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/trace" "go.uber.org/zap" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus/intern...
milvus/internal/querynodev2/tasks/task.go/0
{ "file_path": "milvus/internal/querynodev2/tasks/task.go", "repo_id": "milvus", "token_count": 4118 }
2,052
# coding=utf-8 # Copyright 2018 DPR Authors, The Hugging Face 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 a...
transformers/src/transformers/models/dpr/modeling_tf_dpr.py/0
{ "file_path": "transformers/src/transformers/models/dpr/modeling_tf_dpr.py", "repo_id": "transformers", "token_count": 13909 }
595
# coding=utf-8 # 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 requir...
transformers/tests/models/gpt2/test_modeling_gpt2.py/0
{ "file_path": "transformers/tests/models/gpt2/test_modeling_gpt2.py", "repo_id": "transformers", "token_count": 16910 }
801
# Copyright 2024 ParaDiGMS 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/licenses/LICENSE-2.0 # # Unless...
diffusers/tests/schedulers/test_scheduler_ddpm_parallel.py/0
{ "file_path": "diffusers/tests/schedulers/test_scheduler_ddpm_parallel.py", "repo_id": "diffusers", "token_count": 4271 }
280
python_sources()
llama_index/llama-index-core/llama_index/core/storage/kvstore/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/storage/kvstore/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,142
<jupyter_start><jupyter_text>Geopandas[Geopandas](https://geopandas.org/en/stable/index.html) is an open-source project to make working with geospatial data in python easier. GeoPandas extends the datatypes used by pandas to allow spatial operations on geometric types. Geometric operations are performed by shapely. Geo...
langchain/docs/docs/integrations/document_loaders/geopandas.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/geopandas.ipynb", "repo_id": "langchain", "token_count": 911 }
114
# Vector Stores Vector stores contain embedding vectors of ingested document chunks (and sometimes the document chunks as well). ## Simple Vector Store By default, LlamaIndex uses a simple in-memory vector store that's great for quick experimentation. They can be persisted to (and loaded from) disk by calling `vecto...
llama_index/docs/module_guides/storing/vector_stores.md/0
{ "file_path": "llama_index/docs/module_guides/storing/vector_stores.md", "repo_id": "llama_index", "token_count": 4437 }
1,127
poetry_requirements( name="poetry", module_mapping={"google-generativeai": ["google"]} ) python_sources( interpreter_constraints=["==3.9.*", "==3.10.*"], )
llama_index/llama-index-integrations/llms/llama-index-llms-gemini/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-gemini/BUILD", "repo_id": "llama_index", "token_count": 75 }
1,295
import { Serializable } from "@langchain/core/load/serializable"; // Arbitrary value, used for generating namespaced UUIDs. export const UUIDV5_NAMESPACE = "10f90ea3-90a4-4962-bf75-83a0f3c1c62a"; export type UpdateOptions = { groupIds?: (string | null)[]; timeAtLeast?: number; }; export type ListKeyOptions = { ...
langchainjs/libs/langchain-community/src/indexes/base.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/indexes/base.ts", "repo_id": "langchainjs", "token_count": 725 }
1,058
<jupyter_start><jupyter_text>**Fine-tuning for Image Classification with 🤗 Transformers**This notebook shows how to fine-tune any pretrained Vision model for Image Classification on a custom dataset. The idea is to add a randomly initialized classification head on top of a pre-trained encoder, and fine-tune the model ...
notebooks/examples/image_classification.ipynb/0
{ "file_path": "notebooks/examples/image_classification.ipynb", "repo_id": "notebooks", "token_count": 7435 }
307
# 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/commands/user.py/0
{ "file_path": "transformers/src/transformers/commands/user.py", "repo_id": "transformers", "token_count": 3107 }
550
from enum import Enum from pydantic import BaseModel, validator from typing import Optional, List, Union from text_generation.errors import ValidationError # enum for grammar type class GrammarType(str, Enum): Json = "json" Regex = "regex" # Grammar type and value class Grammar(BaseModel): # Grammar ty...
text-generation-inference/clients/python/text_generation/types.py/0
{ "file_path": "text-generation-inference/clients/python/text_generation/types.py", "repo_id": "text-generation-inference", "token_count": 3289 }
388
from pathlib import Path from typing import Any import pytest from langchain_community.document_loaders import SitemapLoader from langchain_community.document_loaders.sitemap import _extract_scheme_and_domain def test_sitemap() -> None: """Test sitemap loader.""" loader = SitemapLoader("https://api.python.l...
langchain/libs/community/tests/integration_tests/document_loaders/test_sitemap.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_sitemap.py", "repo_id": "langchain", "token_count": 1972 }
326
"""Clear Weaviate index.""" import logging import os import weaviate from langchain.embeddings import OpenAIEmbeddings from langchain.indexes import SQLRecordManager, index from langchain.vectorstores import Weaviate logger = logging.getLogger(__name__) WEAVIATE_URL = os.environ["WEAVIATE_URL"] WEAVIATE_API_KEY = os...
chat-langchain/_scripts/clear_index.py/0
{ "file_path": "chat-langchain/_scripts/clear_index.py", "repo_id": "chat-langchain", "token_count": 629 }
7
from langchain.prompts.base import __all__ EXPECTED_ALL = [ "BasePromptTemplate", "StringPromptTemplate", "StringPromptValue", "_get_jinja2_variables_from_template", "check_valid_template", "get_template_variables", "jinja2_formatter", "validate_jinja2", ] def test_all_imports() -> No...
langchain/libs/langchain/tests/unit_tests/prompts/test_base.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/prompts/test_base.py", "repo_id": "langchain", "token_count": 153 }
645
use tokenizers as tk; use pyo3::exceptions; use pyo3::prelude::*; use pyo3::types::*; use super::{ DestroyPtr, PyNormalizedString, PyNormalizedStringRefMut, RefMutContainer, RefMutGuard, }; use crate::encoding::PyEncoding; use crate::error::ToPyResult; use crate::token::PyToken; use tk::{OffsetReferential, Offset...
tokenizers/bindings/python/src/utils/pretokenization.rs/0
{ "file_path": "tokenizers/bindings/python/src/utils/pretokenization.rs", "repo_id": "tokenizers", "token_count": 4885 }
451
from typing import Optional from llama_index.core.storage.index_store.keyval_index_store import KVIndexStore from llama_index.storage.kvstore.mongodb import MongoDBKVStore class MongoIndexStore(KVIndexStore): """Mongo Index store. Args: mongo_kvstore (MongoDBKVStore): MongoDB key-value store ...
llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-mongodb/llama_index/storage/index_store/mongodb/base.py/0
{ "file_path": "llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-mongodb/llama_index/storage/index_store/mongodb/base.py", "repo_id": "llama_index", "token_count": 585 }
1,553
from langchain_community.vectorstores.mongodb_atlas import ( MongoDBAtlasVectorSearch, MongoDBDocumentType, ) __all__ = [ "MongoDBDocumentType", "MongoDBAtlasVectorSearch", ]
langchain/libs/langchain/langchain/vectorstores/mongodb_atlas.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/mongodb_atlas.py", "repo_id": "langchain", "token_count": 73 }
583
# Steamlit Chatbot Pack Build a chatbot powered by LlamaIndex that augments an LLM with the contents of Snowflake's Wikipedia page (or your own data). - Takes user queries via Streamlit's `st.chat_input` and displays both user queries and model responses with `st.chat_message` - Uses LlamaIndex to load and index data...
llama_index/llama-index-packs/llama-index-packs-streamlit-chatbot/README.md/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-streamlit-chatbot/README.md", "repo_id": "llama_index", "token_count": 284 }
1,820
<jupyter_start><jupyter_text>Query Rewriting Retriever PackThis LlamaPack provides an example of our query-rewriting retriever pack.<jupyter_code>!pip install llama-index llama-hub import nest_asyncio nest_asyncio.apply()<jupyter_output><empty_output><jupyter_text>Setup Data<jupyter_code>!wget "https://www.dropbox.com...
llama_index/llama-index-packs/llama-index-packs-fusion-retriever/examples/query_rewrite/query_rewrite.ipynb/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-fusion-retriever/examples/query_rewrite/query_rewrite.ipynb", "repo_id": "llama_index", "token_count": 624 }
1,653
from typing import Any, Dict, List from langchain_core.memory import BaseMemory class SimpleMemory(BaseMemory): """Simple memory for storing context or other information that shouldn't ever change between prompts. """ memories: Dict[str, Any] = dict() @property def memory_variables(self) ->...
langchain/libs/langchain/langchain/memory/simple.py/0
{ "file_path": "langchain/libs/langchain/langchain/memory/simple.py", "repo_id": "langchain", "token_count": 269 }
522
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-salesforce/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-salesforce/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,311
#!/usr/bin/env python3 import argparse import fnmatch from safetensors.torch import load_file from diffusers import Kandinsky3UNet MAPPING = { "to_time_embed.1": "time_embedding.linear_1", "to_time_embed.3": "time_embedding.linear_2", "in_layer": "conv_in", "out_layer.0": "conv_norm_out", "out_l...
diffusers/src/diffusers/pipelines/kandinsky3/convert_kandinsky3_unet.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/kandinsky3/convert_kandinsky3_unet.py", "repo_id": "diffusers", "token_count": 1403 }
245
# coding=utf-8 # Copyright 2022 HuggingFace Inc. team and BigScience workshop. # # 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 re...
transformers/src/transformers/models/bloom/modeling_bloom.py/0
{ "file_path": "transformers/src/transformers/models/bloom/modeling_bloom.py", "repo_id": "transformers", "token_count": 23801 }
643
import json import logging import re from typing import Any, Dict, Iterator, List, Mapping, Optional, Type import requests from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models.chat_models import ( BaseChatModel, generate_from_stream, ) from langchain_core.messages i...
langchain/libs/community/langchain_community/chat_models/llama_edge.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/llama_edge.py", "repo_id": "langchain", "token_count": 3890 }
240
"""Test dataset generation.""" from llama_index.legacy.evaluation.dataset_generation import DatasetGenerator from llama_index.legacy.prompts.base import PromptTemplate from llama_index.legacy.prompts.prompt_type import PromptType from llama_index.legacy.schema import TextNode from llama_index.legacy.service_context im...
llama_index/llama-index-legacy/tests/evaluation/test_dataset_generation.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/evaluation/test_dataset_generation.py", "repo_id": "llama_index", "token_count": 575 }
1,618
"""Default prompt for ReAct agent.""" # ReAct chat prompt # TODO: have formatting instructions be a part of react output parser REACT_CHAT_SYSTEM_HEADER = """\ You are designed to help with a variety of tasks, from answering questions \ to providing summaries to other types of analyses. ## Tools You have acces...
llama_index/llama-index-core/llama_index/core/agent/react/prompts.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/agent/react/prompts.py", "repo_id": "llama_index", "token_count": 890 }
1,175
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import Pipeline, build_pipeline_init_args if is_tf_available(): import tensorflow as tf from ..models.auto.modeling_tf_auto import T...
transformers/src/transformers/pipelines/text2text_generation.py/0
{ "file_path": "transformers/src/transformers/pipelines/text2text_generation.py", "repo_id": "transformers", "token_count": 6917 }
749
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/retrievers/llama-index-retrievers-bm25/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/retrievers/llama-index-retrievers-bm25/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,583
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datanode/importv2/executor.go/0
{ "file_path": "milvus/internal/datanode/importv2/executor.go", "repo_id": "milvus", "token_count": 3652 }
1,838
from typing import Callable, Dict, Optional, Sequence import numpy as np from langchain_community.document_transformers.embeddings_redundant_filter import ( _get_embeddings_from_stateful_docs, get_stateful_documents, ) from langchain_core.documents import Document from langchain_core.embeddings import Embeddin...
langchain/libs/langchain/langchain/retrievers/document_compressors/embeddings_filter.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/document_compressors/embeddings_filter.py", "repo_id": "langchain", "token_count": 1077 }
556
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
transformers/src/transformers/models/llama/configuration_llama.py/0
{ "file_path": "transformers/src/transformers/models/llama/configuration_llama.py", "repo_id": "transformers", "token_count": 3612 }
622
// 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/unittest/test_bitmap.cpp/0
{ "file_path": "milvus/internal/core/unittest/test_bitmap.cpp", "repo_id": "milvus", "token_count": 655 }
1,754
# coding=utf-8 # Copyright 2020 The Hugging Face 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...
transformers/tests/utils/test_model_output.py/0
{ "file_path": "transformers/tests/utils/test_model_output.py", "repo_id": "transformers", "token_count": 3168 }
770
import os import sys sys.path.insert(1, os.path.dirname(os.path.realpath(__file__)))
transformers/examples/research_projects/rag/__init__.py/0
{ "file_path": "transformers/examples/research_projects/rag/__init__.py", "repo_id": "transformers", "token_count": 34 }
571
accuracy: collections: - server: db_config.primary_path: /test/milvus/db_data_011/sift_1b_128_l2_sq8 cache_config.cpu_cache_capacity: 32GB engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: true gpu_resourc...
milvus/tests/benchmark/milvus_benchmark/suites/011_gpu_accuracy_debug.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/011_gpu_accuracy_debug.yaml", "repo_id": "milvus", "token_count": 360 }
2,087
"""**Utilities** are the integrations with third-part systems and packages. Other LangChain classes use **Utilities** to interact with third-part systems and packages. """ import warnings from typing import Any from langchain_community.utilities.requests import ( Requests, RequestsWrapper, TextRequestsWra...
langchain/libs/langchain/langchain/utilities/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/__init__.py", "repo_id": "langchain", "token_count": 916 }
590
import { LLMOptions } from "portkey-ai"; import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager"; import { AIMessage, AIMessageChunk, BaseMessage, ChatMessage, ChatMessageChunk, FunctionMessageChunk, HumanMessage, HumanMessageChunk, SystemMessage, SystemMessageChunk, } from "@la...
langchainjs/libs/langchain-community/src/chat_models/portkey.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/chat_models/portkey.ts", "repo_id": "langchainjs", "token_count": 1854 }
993
# 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/pipelines/stable_diffusion_k_diffusion/pipeline_stable_diffusion_xl_k_diffusion.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion_k_diffusion/pipeline_stable_diffusion_xl_k_diffusion.py", "repo_id": "diffusers", "token_count": 22375 }
256
from .selection_menu import BulletMenu
accelerate/src/accelerate/commands/menu/__init__.py/0
{ "file_path": "accelerate/src/accelerate/commands/menu/__init__.py", "repo_id": "accelerate", "token_count": 9 }
11
import logging from typing import Any, Dict, List, Mapping, Optional, cast from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_models.chat_models import BaseChatModel from langchain_core.messages import ( AIMessage, BaseMessage,...
langchain/libs/community/langchain_community/chat_models/javelin_ai_gateway.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/javelin_ai_gateway.py", "repo_id": "langchain", "token_count": 3368 }
227
from __future__ import annotations import logging from typing import Optional from langchain_core.callbacks import CallbackManagerForToolRun from langchain_community.tools.edenai.edenai_base_tool import EdenaiTool logger = logging.getLogger(__name__) class EdenAiTextModerationTool(EdenaiTool): """Tool that qu...
langchain/libs/community/langchain_community/tools/edenai/text_moderation.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/edenai/text_moderation.py", "repo_id": "langchain", "token_count": 916 }
296
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-opensearch/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-opensearch/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,421
import json from langchain.tools import BaseTool from langchain.tools.render import format_tool_to_openai_tool from langchain_core.language_models.base import LanguageModelLike from langchain_core.messages import SystemMessage, ToolMessage from langgraph.checkpoint import BaseCheckpointSaver from langgraph.graph impor...
opengpts/backend/app/agent_types/openai_agent.py/0
{ "file_path": "opengpts/backend/app/agent_types/openai_agent.py", "repo_id": "opengpts", "token_count": 1877 }
2,053
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class AsymmetricAutoencoderKL(metaclass=DummyObject): _backends = ["torch"] def __init__(self, *args, **kwargs): requires_backends(self, ["torch"]) @classmethod def ...
diffusers/src/diffusers/utils/dummy_pt_objects.py/0
{ "file_path": "diffusers/src/diffusers/utils/dummy_pt_objects.py", "repo_id": "diffusers", "token_count": 12125 }
275
from llama_index.readers.psychic.base import PsychicReader __all__ = ["PsychicReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-psychic/llama_index/readers/psychic/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-psychic/llama_index/readers/psychic/__init__.py", "repo_id": "llama_index", "token_count": 28 }
1,541
from typing import Any, Dict, List, Optional from langchain_core.messages import BaseMessage, get_buffer_string from langchain_core.pydantic_v1 import root_validator from langchain.memory.chat_memory import BaseChatMemory, BaseMemory from langchain.memory.utils import get_prompt_input_key class ConversationBufferMe...
langchain/libs/langchain/langchain/memory/buffer.py/0
{ "file_path": "langchain/libs/langchain/langchain/memory/buffer.py", "repo_id": "langchain", "token_count": 1948 }
568
python_tests( name="tests", ) python_sources()
llama_index/llama-index-core/tests/token_predictor/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/token_predictor/BUILD", "repo_id": "llama_index", "token_count": 22 }
1,233
# coding=utf-8 # Copyright 2019 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_modeling_tf_common.py/0
{ "file_path": "transformers/tests/test_modeling_tf_common.py", "repo_id": "transformers", "token_count": 43519 }
837
__all__ = [ "DownloadConfig", "DownloadManager", "DownloadMode", "StreamingDownloadManager", ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_manager import StreamingDownloadManager
datasets/src/datasets/download/__init__.py/0
{ "file_path": "datasets/src/datasets/download/__init__.py", "repo_id": "datasets", "token_count": 77 }
138
// Code generated by mockery v2.32.4. DO NOT EDIT. package datacoord import ( context "context" datapb "github.com/milvus-io/milvus/internal/proto/datapb" mock "github.com/stretchr/testify/mock" ) // MockCluster is an autogenerated mock type for the Cluster type type MockCluster struct { mock.Mock } type MockC...
milvus/internal/datacoord/mock_cluster.go/0
{ "file_path": "milvus/internal/datacoord/mock_cluster.go", "repo_id": "milvus", "token_count": 5476 }
1,687
import pytest from langchain.chains.qa_with_sources.base import QAWithSourcesChain from tests.unit_tests.llms.fake_llm import FakeLLM @pytest.mark.parametrize( "text,answer,sources", [ ( "This Agreement is governed by English law.\nSOURCES: 28-pl", "This Agreement is governed ...
langchain/libs/langchain/tests/unit_tests/chains/test_qa_with_sources.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/chains/test_qa_with_sources.py", "repo_id": "langchain", "token_count": 1855 }
636
"""Google Mail reader.""" import base64 import email from typing import Any, List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document from pydantic import BaseModel SCOPES = ["https://www.googleapis.com/auth/gmail.readonly"] class GmailReader(BaseReader, BaseM...
llama_index/llama-index-integrations/readers/llama-index-readers-google/llama_index/readers/google/gmail/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-google/llama_index/readers/google/gmail/base.py", "repo_id": "llama_index", "token_count": 3050 }
1,407
# coding=utf-8 # Copyright 2020, The T5 Authors and 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 ...
transformers/src/transformers/models/t5/configuration_t5.py/0
{ "file_path": "transformers/src/transformers/models/t5/configuration_t5.py", "repo_id": "transformers", "token_count": 3199 }
751
# 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/autoencoder_kl.py/0
{ "file_path": "diffusers/src/diffusers/models/autoencoders/autoencoder_kl.py", "repo_id": "diffusers", "token_count": 9067 }
242
// Code generated by mockery v2.32.4. DO NOT EDIT. package msgstream import ( context "context" mock "github.com/stretchr/testify/mock" ) // MockFactory is an autogenerated mock type for the Factory type type MockFactory struct { mock.Mock } type MockFactory_Expecter struct { mock *mock.Mock } func (_m *MockF...
milvus/pkg/mq/msgstream/mock_msgstream_factory.go/0
{ "file_path": "milvus/pkg/mq/msgstream/mock_msgstream_factory.go", "repo_id": "milvus", "token_count": 2090 }
1,955