text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
import { Memory, Message, NotFoundError, ZepClient } from "@getzep/zep-js"; import { InputValues, OutputValues, MemoryVariables, getInputValue, getOutputValue, } from "@langchain/core/memory"; import { getBufferString, AIMessage, BaseMessage, ChatMessage, HumanMessage, SystemMessage, } from "@lang...
langchainjs/libs/langchain-community/src/memory/zep.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/memory/zep.ts", "repo_id": "langchainjs", "token_count": 2448 }
1,006
# Metric Card for COMET ## Metric description Crosslingual Optimized Metric for Evaluation of Translation (COMET) is an open-source framework used to train Machine Translation metrics that achieve high levels of correlation with different types of human judgments. ## How to use COMET takes 3 lists of strings as inp...
datasets/metrics/comet/README.md/0
{ "file_path": "datasets/metrics/comet/README.md", "repo_id": "datasets", "token_count": 2148 }
118
# order by contributions reviewers: - fishpenguin - xige-16 - scsven - yhmo - czs007 approvers: - maintainers
milvus/pkg/mq/msgstream/OWNERS/0
{ "file_path": "milvus/pkg/mq/msgstream/OWNERS", "repo_id": "milvus", "token_count": 52 }
1,896
<jupyter_start><jupyter_text>DeepLake Reader If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-readers-deeplake !pip install llama-index import getpass import os import random import textwrap from llama_index.core import VectorStoreIndex fr...
llama_index/docs/examples/data_connectors/DeepLakeReader.ipynb/0
{ "file_path": "llama_index/docs/examples/data_connectors/DeepLakeReader.ipynb", "repo_id": "llama_index", "token_count": 424 }
1,093
// Code generated by mockery v2.32.4. DO NOT EDIT. package mocks import ( context "context" commonpb "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" clientv3 "go.etcd.io/etcd/client/v3" datapb "github.com/milvus-io/milvus/internal/proto/datapb" internalpb "github.com/milvus-io/milvus/internal/proto/int...
milvus/internal/mocks/mock_datanode.go/0
{ "file_path": "milvus/internal/mocks/mock_datanode.go", "repo_id": "milvus", "token_count": 20797 }
2,000
// 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/distributed/datanode/client/client.go/0
{ "file_path": "milvus/internal/distributed/datanode/client/client.go", "repo_id": "milvus", "token_count": 4016 }
1,713
#!/usr/bin/env python # coding=utf-8 # Copyright 2022 University of Cambridge, Tencent AI Lab, DeepMind and The University of Hong Kong Authors and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with th...
transformers/examples/pytorch/text-generation/run_generation_contrastive_search.py/0
{ "file_path": "transformers/examples/pytorch/text-generation/run_generation_contrastive_search.py", "repo_id": "transformers", "token_count": 1865 }
553
// 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/InvertedIndexTantivy.cpp/0
{ "file_path": "milvus/internal/core/src/index/InvertedIndexTantivy.cpp", "repo_id": "milvus", "token_count": 7248 }
1,738
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/llms/llama-index-llms-anthropic/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-anthropic/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,247
"""Simple Reader for Memos.""" from typing import Dict, List from urllib.parse import urljoin from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class MemosReader(BaseReader): """Memos reader. Reads content from an Memos. """ def __init__(self, host:...
llama_index/llama-index-integrations/readers/llama-index-readers-memos/llama_index/readers/memos/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-memos/llama_index/readers/memos/base.py", "repo_id": "llama_index", "token_count": 660 }
1,335
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/vilt/test_modeling_vilt.py/0
{ "file_path": "transformers/tests/models/vilt/test_modeling_vilt.py", "repo_id": "transformers", "token_count": 11966 }
819
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/querynodev2/pipeline/manager.go/0
{ "file_path": "milvus/internal/querynodev2/pipeline/manager.go", "repo_id": "milvus", "token_count": 1810 }
1,840
use async_trait::async_trait; use uuid::Uuid; use crate::chroma_proto; use crate::config::{Configurable, WorkerConfig}; use crate::types::{CollectionConversionError, SegmentConversionError}; use crate::{ chroma_proto::sys_db_client, errors::{ChromaError, ErrorCodes}, types::{Collection, Segment, SegmentSco...
chroma/rust/worker/src/sysdb/sysdb.rs/0
{ "file_path": "chroma/rust/worker/src/sysdb/sysdb.rs", "repo_id": "chroma", "token_count": 4139 }
58
package kafka import ( "sync" "time" "github.com/cockroachdb/errors" "github.com/confluentinc/confluent-kafka-go/kafka" "go.uber.org/zap" "github.com/milvus-io/milvus/pkg/log" "github.com/milvus-io/milvus/pkg/mq/msgstream/mqwrapper" "github.com/milvus-io/milvus/pkg/util/merr" "github.com/milvus-io/milvus/pk...
milvus/pkg/mq/msgstream/mqwrapper/kafka/kafka_consumer.go/0
{ "file_path": "milvus/pkg/mq/msgstream/mqwrapper/kafka/kafka_consumer.go", "repo_id": "milvus", "token_count": 3153 }
1,889
"""Faithfulness evaluation.""" from __future__ import annotations from typing import Any, List, Optional, Sequence, Union from llama_index.core.evaluation.base import BaseEvaluator, EvaluationResult from llama_index.core.multi_modal_llms.base import MultiModalLLM from llama_index.core.prompts import BasePromptTempla...
llama_index/llama-index-core/llama_index/core/evaluation/multi_modal/faithfulness.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/evaluation/multi_modal/faithfulness.py", "repo_id": "llama_index", "token_count": 3596 }
1,171
"""Test PandasDataframeParser""" import pandas as pd from langchain.output_parsers.pandas_dataframe import PandasDataFrameOutputParser from langchain.schema import OutputParserException df = pd.DataFrame( {"chicken": [1, 2, 3, 4], "veggies": [5, 4, 3, 2], "steak": [9, 8, 7, 6]} ) parser = PandasDataFrameOutputPa...
langchain/libs/langchain/tests/unit_tests/output_parsers/test_pandas_dataframe_parser.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/output_parsers/test_pandas_dataframe_parser.py", "repo_id": "langchain", "token_count": 1320 }
627
"""Init params."""
llama_index/llama-index-core/tests/indices/struct_store/__init__.py/0
{ "file_path": "llama_index/llama-index-core/tests/indices/struct_store/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,189
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "load/serializable", newEntrypointName: "load/serializable", newPackageName: "@langchain/core", }); export * from "@langchain/core/load/serializable";
langchainjs/langchain/src/load/serializable.ts/0
{ "file_path": "langchainjs/langchain/src/load/serializable.ts", "repo_id": "langchainjs", "token_count": 96 }
891
import { test } from "@jest/globals"; import { OpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { MemoryVectorStore } from "../../../vectorstores/memory.js"; import { TimeWeightedVectorStoreRetriever } from "../../../retrievers/time_weighted.js"; import { GenerativeAgentMemory, GenerativeAgent } from "../in...
langchainjs/langchain/src/experimental/generative_agents/tests/generative_agent.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/generative_agents/tests/generative_agent.int.test.ts", "repo_id": "langchainjs", "token_count": 7673 }
937
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/mgp_str/tokenization_mgp_str.py/0
{ "file_path": "transformers/src/transformers/models/mgp_str/tokenization_mgp_str.py", "repo_id": "transformers", "token_count": 1683 }
632
from typing import Any, Dict, Optional, Sequence, Type, cast from llama_index.legacy.bridge.pydantic import BaseModel from llama_index.legacy.multi_modal_llms import MultiModalLLM, OpenAIMultiModal from llama_index.legacy.output_parsers.pydantic import PydanticOutputParser from llama_index.legacy.prompts.base import B...
llama_index/llama-index-legacy/llama_index/legacy/program/multi_modal_llm_program.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/program/multi_modal_llm_program.py", "repo_id": "llama_index", "token_count": 1726 }
1,750
"""Test Titan Takeoff wrapper.""" import responses from langchain_community.llms.titan_takeoff import TitanTakeoff @responses.activate def test_titan_takeoff_call() -> None: """Test valid call to Titan Takeoff.""" url = "http://localhost:8000/generate" responses.add(responses.POST, url, json={"message"...
langchain/libs/community/tests/integration_tests/llms/test_titan_takeoff.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_titan_takeoff.py", "repo_id": "langchain", "token_count": 168 }
362
# coding=utf-8 # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
transformers/tests/models/mpt/test_modeling_mpt.py/0
{ "file_path": "transformers/tests/models/mpt/test_modeling_mpt.py", "repo_id": "transformers", "token_count": 9258 }
739
import json from io import BytesIO from typing import Any, Generator import pytest from botocore.response import StreamingBody from botocore.stub import Stubber from llama_index.core.base.llms.types import ChatMessage from llama_index.llms.bedrock import Bedrock from pytest import MonkeyPatch class MockEventStream: ...
llama_index/llama-index-integrations/llms/llama-index-llms-bedrock/tests/test_bedrock.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-bedrock/tests/test_bedrock.py", "repo_id": "llama_index", "token_count": 3427 }
1,391
from unittest.mock import MagicMock, patch import pytest from langchain_community.document_loaders import ArcGISLoader @pytest.fixture def arcgis_mocks(mock_feature_layer, mock_gis): # type: ignore sys_modules = { "arcgis": MagicMock(), "arcgis.features.FeatureLayer": mock_feature_layer, ...
langchain/libs/community/tests/unit_tests/document_loaders/test_arcgis_loader.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/test_arcgis_loader.py", "repo_id": "langchain", "token_count": 1530 }
368
"""A tracer that collects all nested runs in a list.""" from typing import Any, List, Optional, Union from uuid import UUID from langchain_core.tracers.base import BaseTracer from langchain_core.tracers.schemas import Run class RunCollectorCallbackHandler(BaseTracer): """ Tracer that collects all nested run...
langchain/libs/core/langchain_core/tracers/run_collector.py/0
{ "file_path": "langchain/libs/core/langchain_core/tracers/run_collector.py", "repo_id": "langchain", "token_count": 613 }
400
import { test, expect } from "@jest/globals"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { ClientSecretCredential, TokenCredential } from "@azure/identity"; import { AzureOpenAIEmbeddings } from "../embeddings.js"; test("Test OpenAIEmbeddings.embedQuery", async () => { const embedding...
langchainjs/libs/langchain-azure-openai/src/tests/embeddings.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-azure-openai/src/tests/embeddings.int.test.ts", "repo_id": "langchainjs", "token_count": 762 }
974
# Metric Card for MAUVE ## Metric description MAUVE is a library built on PyTorch and HuggingFace Transformers to measure the gap between neural text and human text with the eponymous MAUVE measure. It summarizes both Type I and Type II errors measured softly using [Kullback–Leibler (KL) divergences](https://en.wikip...
datasets/metrics/mauve/README.md/0
{ "file_path": "datasets/metrics/mauve/README.md", "repo_id": "datasets", "token_count": 1650 }
141
package utils import ( "fmt" "math" "testing" ) func mockHasher(member string, key string) uint64 { members := []string{"a", "b", "c"} for i, m := range members { if m == member { return uint64(i) } } return 0 } func TestRendezvousHash(t *testing.T) { members := []string{"a", "b", "c"} key := "key" ...
chroma/go/coordinator/internal/utils/rendezvous_hash_test.go/0
{ "file_path": "chroma/go/coordinator/internal/utils/rendezvous_hash_test.go", "repo_id": "chroma", "token_count": 519 }
54
<jupyter_start><jupyter_text>Segment Anything Model: automatic mask generation using `transformers` 🤗 libraryThis notebook demonstrates how to use the Segment Anything Model (SAM) to automatically generate segementation masks on any image. The model was released by Meta AI in the paper [Segment Anything Model](https:/...
notebooks/examples/automatic_mask_generation.ipynb/0
{ "file_path": "notebooks/examples/automatic_mask_generation.ipynb", "repo_id": "notebooks", "token_count": 1453 }
279
# Bedrock JCVD 🕺🥋 ## Overview LangChain template that uses [Anthropic's Claude on Amazon Bedrock](https://aws.amazon.com/bedrock/claude/) to behave like JCVD. > I am the Fred Astaire of Chatbots! 🕺 '![Animated GIF of Jean-Claude Van Damme dancing.](https://media.tenor.com/CVp9l7g3axwAAAAj/jean-claude-van-damme-j...
langchain/templates/bedrock-jcvd/README.md/0
{ "file_path": "langchain/templates/bedrock-jcvd/README.md", "repo_id": "langchain", "token_count": 1135 }
683
"""Tool for the Wolfram Alpha API.""" from typing import Optional from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.tools import BaseTool from langchain_community.utilities.wolfram_alpha import WolframAlphaAPIWrapper class WolframAlphaQueryRun(BaseTool): """Tool that queries us...
langchain/libs/community/langchain_community/tools/wolfram_alpha/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/wolfram_alpha/tool.py", "repo_id": "langchain", "token_count": 310 }
315
python_sources()
llama_index/llama-index-core/llama_index/core/indices/vector_store/retrievers/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/vector_store/retrievers/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,133
<jupyter_start><jupyter_text>Gradient Base Model If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-embeddings-langchain %pip install llama-index-llms-gradient !pip install llama-index %pip install llama-index --quiet %pip install gradientai ...
llama_index/docs/examples/llm/gradient_base_model.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/gradient_base_model.ipynb", "repo_id": "llama_index", "token_count": 761 }
1,061
<jupyter_start><jupyter_text>Cohere Rerank If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-postprocessor-cohere-rerank !pip install llama-index from llama_index.core import ( VectorStoreIndex, SimpleDirectoryReader, pprint_resp...
llama_index/docs/examples/node_postprocessor/CohereRerank.ipynb/0
{ "file_path": "llama_index/docs/examples/node_postprocessor/CohereRerank.ipynb", "repo_id": "llama_index", "token_count": 1212 }
1,117
import importlib from typing import Type, TypeVar, cast C = TypeVar("C") def get_class(fqn: str, type: Type[C]) -> Type[C]: """Given a fully qualifed class name, import the module and return the class""" module_name, class_name = fqn.rsplit(".", 1) module = importlib.import_module(module_name) cls = ...
chroma/chromadb/utils/__init__.py/0
{ "file_path": "chroma/chromadb/utils/__init__.py", "repo_id": "chroma", "token_count": 139 }
26
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.notion import NotionToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in NotionToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-notion/tests/test_tools_notion.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-notion/tests/test_tools_notion.py", "repo_id": "llama_index", "token_count": 94 }
1,492
from llama_index.vector_stores.bagel.base import BagelVectorStore __all__ = ["BagelVectorStore"]
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-bagel/llama_index/vector_stores/bagel/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-bagel/llama_index/vector_stores/bagel/__init__.py", "repo_id": "llama_index", "token_count": 33 }
1,594
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/src/transformers/models/swin2sr/image_processing_swin2sr.py/0
{ "file_path": "transformers/src/transformers/models/swin2sr/image_processing_swin2sr.py", "repo_id": "transformers", "token_count": 3791 }
683
<jupyter_start><jupyter_text>Recency FilteringShowcase capabilities of recency-weighted node postprocessor<jupyter_code>import os os.environ["OPENAI_API_KEY"] = "sk-..." from llama_index.core import VectorStoreIndex, SimpleDirectoryReader from llama_index.core.postprocessor import ( FixedRecencyPostprocessor, ...
llama_index/docs/examples/node_postprocessor/RecencyPostprocessorDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/node_postprocessor/RecencyPostprocessorDemo.ipynb", "repo_id": "llama_index", "token_count": 1644 }
1,203
# coding=utf-8 # Copyright 2021 The I-BERT Authors (Sehoon Kim, Amir Gholami, Zhewei Yao, # Michael Mahoney, Kurt Keutzer - UC Berkeley) and The HuggingFace Inc. team. # Copyright (c) 20121, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use t...
transformers/src/transformers/models/ibert/modeling_ibert.py/0
{ "file_path": "transformers/src/transformers/models/ibert/modeling_ibert.py", "repo_id": "transformers", "token_count": 24475 }
651
python_sources()
llama_index/llama-index-core/llama_index/core/tools/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/tools/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,143
from langchain_community.document_loaders.stripe import StripeLoader __all__ = ["StripeLoader"]
langchain/libs/langchain/langchain/document_loaders/stripe.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/stripe.py", "repo_id": "langchain", "token_count": 30 }
516
from __future__ import annotations from typing import TYPE_CHECKING, List, Optional, Union from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader from langchain_community.document_loaders.s3_file import S3FileLoader if TYPE_CHECKING: import botocore clas...
langchain/libs/community/langchain_community/document_loaders/s3_directory.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/s3_directory.py", "repo_id": "langchain", "token_count": 2438 }
249
# RAG Fusion Pipeline Llama Pack This LlamaPack creates the RAG Fusion Query Pipeline, which runs multiple retrievers in parallel (with varying chunk sizes), and aggregates the results in the end with reciprocal rank fusion. You can run it out of the box, but we also encourage you to inspect the code to take a look a...
llama_index/llama-index-packs/llama-index-packs-rag-fusion-query-pipeline/README.md/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-rag-fusion-query-pipeline/README.md", "repo_id": "llama_index", "token_count": 632 }
1,584
import logging import uuid from typing import ( TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Optional, Tuple, Union, ) from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.vectorstores import VectorStore if TYPE_C...
langchain/libs/community/langchain_community/vectorstores/baiducloud_vector_search.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/baiducloud_vector_search.py", "repo_id": "langchain", "token_count": 7950 }
323
package syncmgr import ( "context" "fmt" "strconv" "github.com/cockroachdb/errors" "go.uber.org/zap" "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/internal/allocator" "github.com/milvus-io/milvus/internal/datanode/meta...
milvus/internal/datanode/syncmgr/sync_manager.go/0
{ "file_path": "milvus/internal/datanode/syncmgr/sync_manager.go", "repo_id": "milvus", "token_count": 2043 }
1,792
<!--- 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 ...
transformers/docs/source/ja/troubleshooting.md/0
{ "file_path": "transformers/docs/source/ja/troubleshooting.md", "repo_id": "transformers", "token_count": 4420 }
550
<jupyter_start><jupyter_text>Refine with Structured Answer FilteringWhen using our Refine response synthesizer for response synthesis, it's crucial to filter out non-answers. An issue often encountered is the propagation of a single unhelpful response like "I don't have the answer", which can persist throughout the syn...
llama_index/docs/examples/response_synthesizers/structured_refine.ipynb/0
{ "file_path": "llama_index/docs/examples/response_synthesizers/structured_refine.ipynb", "repo_id": "llama_index", "token_count": 1370 }
1,210
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-astra-db/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-astra-db/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,293
<script lang="ts"> import { applyAction, enhance } from "$app/forms"; import { invalidateAll } from "$app/navigation"; import Modal from "$lib/components/Modal.svelte"; import { createEventDispatcher } from "svelte"; const dispatch = createEventDispatcher<{ close: void }>(); let reason = ""; </script> <Modal o...
chat-ui/src/routes/settings/assistants/[assistantId]/ReportModal.svelte/0
{ "file_path": "chat-ui/src/routes/settings/assistants/[assistantId]/ReportModal.svelte", "repo_id": "chat-ui", "token_count": 593 }
113
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "vectorstores/base", newEntrypointName: "vectorstores", newPackageName: "@langchain/core", }); export * from "@langchain/core/vectorstores";
langchainjs/langchain/src/vectorstores/base.ts/0
{ "file_path": "langchainjs/langchain/src/vectorstores/base.ts", "repo_id": "langchainjs", "token_count": 91 }
980
<jupyter_start><jupyter_text>Run TemplateIn `server.py`, set -```add_routes(app, chain_private, path="/rag_chroma_private")```<jupyter_code>from langserve.client import RemoteRunnable rag_app = RemoteRunnable("http://0.0.0.0:8001/rag_chroma_private/") rag_app.invoke("How does agent memory work?")<jupyter_output>Based ...
langchain/templates/rag-chroma-private/rag_chroma_private.ipynb/0
{ "file_path": "langchain/templates/rag-chroma-private/rag_chroma_private.ipynb", "repo_id": "langchain", "token_count": 302 }
683
<!--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/cpm.md/0
{ "file_path": "transformers/docs/source/en/model_doc/cpm.md", "repo_id": "transformers", "token_count": 735 }
472
# LlamaIndex Readers Integration: Myscale
llama_index/llama-index-integrations/readers/llama-index-readers-myscale/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-myscale/README.md", "repo_id": "llama_index", "token_count": 11 }
1,433
"""Test functionality of Python REPL.""" import sys import pytest from langchain_experimental.tools.python.tool import PythonAstREPLTool, PythonREPLTool from langchain_experimental.utilities.python import PythonREPL _SAMPLE_CODE = """ ``` def multiply(): print(5*6) # noqa: T201 multiply() ``` """ _AST_SAMPLE_...
langchain/libs/experimental/tests/unit_tests/python/test_python_1.py/0
{ "file_path": "langchain/libs/experimental/tests/unit_tests/python/test_python_1.py", "repo_id": "langchain", "token_count": 1057 }
473
import uuid from typing import Any, Callable, Optional, cast from langchain.callbacks.manager import CallbackManagerForChainRun from langchain.schema import AIMessage, HumanMessage from langchain_core.prompt_values import ChatPromptValue, StringPromptValue from langchain_experimental.comprehend_moderation.pii import ...
langchain/libs/experimental/langchain_experimental/comprehend_moderation/base_moderation.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/comprehend_moderation/base_moderation.py", "repo_id": "langchain", "token_count": 3495 }
439
python_sources() python_tests( name="tests", )
llama_index/llama-index-core/tests/embeddings/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/embeddings/BUILD", "repo_id": "llama_index", "token_count": 22 }
1,216
"""Gradient Finetuning.""" import json from typing import Any, Optional, overload from llama_index.finetuning.types import BaseLLMFinetuneEngine from llama_index.llms.gradient import GradientModelAdapterLLM class GradientFinetuneEngine(BaseLLMFinetuneEngine): @overload def __init__( self, *,...
llama_index/llama-index-finetuning/llama_index/finetuning/gradient/base.py/0
{ "file_path": "llama_index/llama-index-finetuning/llama_index/finetuning/gradient/base.py", "repo_id": "llama_index", "token_count": 2493 }
1,283
import init, { Model } from "./build/m.js"; async function fetchArrayBuffer(url) { const cacheName = "llama2c-candle-cache"; const cache = await caches.open(cacheName); const cachedResponse = await cache.match(url); if (cachedResponse) { const data = await cachedResponse.arrayBuffer(); return new Uint8...
candle/candle-wasm-examples/llama2-c/llama2cWorker.js/0
{ "file_path": "candle/candle-wasm-examples/llama2-c/llama2cWorker.js", "repo_id": "candle", "token_count": 1223 }
82
<jupyter_start><jupyter_text>SQL (SQLAlchemy)>[Structured Query Language (SQL)](https://en.wikipedia.org/wiki/SQL) is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management sys...
langchain/docs/docs/integrations/memory/sql_chat_message_history.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/memory/sql_chat_message_history.ipynb", "repo_id": "langchain", "token_count": 931 }
137
# sql-research-assistant This package does research over a SQL database ## Usage This package relies on multiple models, which have the following dependencies: - OpenAI: set the `OPENAI_API_KEY` environment variables - Ollama: [install and run Ollama](https://python.langchain.com/docs/integrations/chat/ollama) - ll...
langchain/templates/sql-research-assistant/README.md/0
{ "file_path": "langchain/templates/sql-research-assistant/README.md", "repo_id": "langchain", "token_count": 656 }
693
import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; const text = `\\begin{document} \\title{🦜️🔗 LangChain} ⚡ Building applications with LLMs through composability ⚡ \\section{Quick Install} \\begin{verbatim} Hopefully this code block isn't split yarn add langchain \\end{verbatim} As an open ...
langchainjs/examples/src/indexes/latex_text_splitter.ts/0
{ "file_path": "langchainjs/examples/src/indexes/latex_text_splitter.ts", "repo_id": "langchainjs", "token_count": 531 }
809
import pytest from llama_index.legacy.llm_predictor.vellum.utils import convert_to_kebab_case @pytest.mark.parametrize( ("input_string", "expected"), [ ("HelloWorld", "helloworld"), ( "LlamaIndex Demo: query_keyword_extract", "llamaindex-demo-query-keyword-extract", ...
llama_index/llama-index-legacy/tests/llm_predictor/vellum/test_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/llm_predictor/vellum/test_utils.py", "repo_id": "llama_index", "token_count": 213 }
1,744
from rag_pinecone_rerank.chain import chain __all__ = ["chain"]
langchain/templates/rag-pinecone-rerank/rag_pinecone_rerank/__init__.py/0
{ "file_path": "langchain/templates/rag-pinecone-rerank/rag_pinecone_rerank/__init__.py", "repo_id": "langchain", "token_count": 22 }
742
python_sources()
llama_index/llama-index-core/llama_index/core/indices/multi_modal/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/multi_modal/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,179
--- title: Developer Guide --- import Contributing from "../../../CONTRIBUTING.md"; <Contributing />
langchainjs/docs/core_docs/docs/contributing.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/contributing.mdx", "repo_id": "langchainjs", "token_count": 33 }
766
[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 = ["SageMakerLLM"] contains_example = false import_path = "llama_index.llms.sagemaker_endpoin...
llama_index/llama-index-integrations/llms/llama-index-llms-sagemaker-endpoint/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-sagemaker-endpoint/pyproject.toml", "repo_id": "llama_index", "token_count": 666 }
1,333
# Multi-Document AutoRetrieval (with Weaviate) Pack This LlamaPack implements structured hierarchical retrieval over multiple documents, using multiple @weaviate_io collections. ## CLI Usage You can download llamapacks directly using `llamaindex-cli`, which comes installed with the `llama-index` python package: ```...
llama_index/llama-index-packs/llama-index-packs-multidoc-autoretrieval/README.md/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-multidoc-autoretrieval/README.md", "repo_id": "llama_index", "token_count": 851 }
1,576
from langchain.prompts import PromptTemplate template = """You are a teacher grading a quiz. You are given a question, the student's answer, and the true answer, and are asked to score the student answer as either Correct or Incorrect. Example Format: QUESTION: question here STUDENT ANSWER: student's answer here TRU...
auto-evaluator/streamlit/prompts.py/0
{ "file_path": "auto-evaluator/streamlit/prompts.py", "repo_id": "auto-evaluator", "token_count": 1762 }
4
from typing import Any, Iterator, List, Mapping, Optional import requests from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models.llms import LLM from langchain_core.outputs import GenerationChunk from requests.exceptions import ConnectionError from langchain_community.llms.u...
langchain/libs/community/langchain_community/llms/titan_takeoff.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/titan_takeoff.py", "repo_id": "langchain", "token_count": 2266 }
274
"""Google GenerativeAI Attributed Question and Answering (AQA) service. The GenAI Semantic AQA API is a managed end to end service that allows developers to create responses grounded on specified passages based on a user query. For more information visit: https://developers.generativeai.google/guide """ import loggin...
llama_index/llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/llama_index/response_synthesizers/google/base.py/0
{ "file_path": "llama_index/llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/llama_index/response_synthesizers/google/base.py", "repo_id": "llama_index", "token_count": 3668 }
1,548
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "vectorstores/redis", newEntrypointName: "", newPackageName: "@langchain/redis", }); export * from "@langchain/community/vectorstores/redis";
langchainjs/langchain/src/vectorstores/redis.ts/0
{ "file_path": "langchainjs/langchain/src/vectorstores/redis.ts", "repo_id": "langchainjs", "token_count": 94 }
967
// 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/distributed/indexnode/client/client_test.go/0
{ "file_path": "milvus/internal/distributed/indexnode/client/client_test.go", "repo_id": "milvus", "token_count": 1814 }
1,814
// Auto-generated by `scripts/create-entrypoints.js`. Do not edit manually. export * as agents from "../agents/index.js"; export * as agents__toolkits from "../agents/toolkits/index.js"; export * as agents__format_scratchpad from "../agents/format_scratchpad/openai_functions.js"; export * as agents__format_scratchpad_...
langchainjs/langchain/src/load/import_map.ts/0
{ "file_path": "langchainjs/langchain/src/load/import_map.ts", "repo_id": "langchainjs", "token_count": 2736 }
932
from langchain_community.utilities.google_scholar import GoogleScholarAPIWrapper __all__ = ["GoogleScholarAPIWrapper"]
langchain/libs/langchain/langchain/utilities/google_scholar.py/0
{ "file_path": "langchain/libs/langchain/langchain/utilities/google_scholar.py", "repo_id": "langchain", "token_count": 35 }
604
import { test } from "@jest/globals"; import { PromptTemplate } from "@langchain/core/prompts"; import { OpenAI } from "@langchain/openai"; import { ConstitutionalChain } from "../constitutional_ai/constitutional_chain.js"; import { ConstitutionalPrinciple } from "../constitutional_ai/constitutional_principle.js"; impo...
langchainjs/langchain/src/chains/tests/constitutional_chain.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/chains/tests/constitutional_chain.int.test.ts", "repo_id": "langchainjs", "token_count": 337 }
961
import warnings from typing import Any, Callable, Dict, Optional, Sequence, Tuple from llama_index.core.base.llms.types import ( ChatMessage, ChatResponse, ChatResponseGen, CompletionResponse, CompletionResponseGen, LLMMetadata, MessageRole, ) from llama_index.core.bridge.pydantic import Fi...
llama_index/llama-index-integrations/llms/llama-index-llms-xinference/llama_index/llms/xinference/base.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-xinference/llama_index/llms/xinference/base.py", "repo_id": "llama_index", "token_count": 4209 }
1,425
use candle_metal_kernels::{call_unary_contiguous, call_unary_strided, unary, Kernels}; use half::{bf16, f16}; use metal::objc::rc::autoreleasepool; use metal::{Device, MTLResourceOptions}; use rand; use std::any::type_name; use std::time::Instant; fn main() { let device = Device::system_default().unwrap(); let...
candle/candle-metal-kernels/tmp/unary.rs/0
{ "file_path": "candle/candle-metal-kernels/tmp/unary.rs", "repo_id": "candle", "token_count": 3489 }
61
use crate::tokenizer::pattern::Pattern; use crate::{Offsets, Result}; use onig::Regex; use std::error::Error; #[derive(Debug)] pub struct SysRegex { regex: Regex, } impl SysRegex { pub fn find_iter<'r, 't>(&'r self, inside: &'t str) -> onig::FindMatches<'r, 't> { self.regex.find_iter(inside) } ...
tokenizers/tokenizers/src/utils/onig.rs/0
{ "file_path": "tokenizers/tokenizers/src/utils/onig.rs", "repo_id": "tokenizers", "token_count": 571 }
471
from rag_timescale_hybrid_search_time import chain __all__ = ["chain"]
langchain/templates/rag-timescale-hybrid-search-time/rag_timescale_hybrid_search_time/__init__.py/0
{ "file_path": "langchain/templates/rag-timescale-hybrid-search-time/rag_timescale_hybrid_search_time/__init__.py", "repo_id": "langchain", "token_count": 24 }
670
from langchain_community.tools.amadeus.base import AmadeusBaseTool __all__ = ["AmadeusBaseTool"]
langchain/libs/langchain/langchain/tools/amadeus/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/amadeus/base.py", "repo_id": "langchain", "token_count": 33 }
572
"""Configuration for run evaluators.""" from typing import Any, Dict, List, Optional, Union from langchain_core.embeddings import Embeddings from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import BasePromptTemplate from langchain_core.pydantic_v1 import BaseModel, Field from l...
langchain/libs/langchain/langchain/smith/evaluation/config.py/0
{ "file_path": "langchain/libs/langchain/langchain/smith/evaluation/config.py", "repo_id": "langchain", "token_count": 4776 }
569
import pytest from text_generation import __version__ from huggingface_hub.utils import build_hf_headers @pytest.fixture def flan_t5_xxl(): return "google/flan-t5-xxl" @pytest.fixture def fake_model(): return "fake/model" @pytest.fixture def unsupported_model(): return "gpt2" @pytest.fixture def ba...
text-generation-inference/clients/python/tests/conftest.py/0
{ "file_path": "text-generation-inference/clients/python/tests/conftest.py", "repo_id": "text-generation-inference", "token_count": 390 }
399
# Supervised Fine-tuning Trainer Supervised fine-tuning (or SFT for short) is a crucial step in RLHF. In TRL we provide an easy-to-use API to create your SFT models and train them with few lines of code on your dataset. Check out a complete flexible example at [`examples/scripts/sft.py`](https://github.com/huggingfac...
trl/docs/source/sft_trainer.mdx/0
{ "file_path": "trl/docs/source/sft_trainer.mdx", "repo_id": "trl", "token_count": 8670 }
808
/* * 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...
milvus/internal/proxy/trace_log_interceptor.go/0
{ "file_path": "milvus/internal/proxy/trace_log_interceptor.go", "repo_id": "milvus", "token_count": 1393 }
1,753
# coding=utf-8 # Copyright 2022, UCLA NLP, The Facebook AI Research Team Authors and 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/l...
transformers/src/transformers/models/plbart/tokenization_plbart.py/0
{ "file_path": "transformers/src/transformers/models/plbart/tokenization_plbart.py", "repo_id": "transformers", "token_count": 9661 }
728
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/tests/test_stablediffusion.py/0
{ "file_path": "peft/tests/test_stablediffusion.py", "repo_id": "peft", "token_count": 4243 }
341
<jupyter_start><jupyter_text>Semi-structured RAGMany documents contain a mixture of content types, including text and tables. Semi-structured data can be challenging for conventional RAG for at least two reasons: * Text splitting may break up tables, corrupting the data in retrieval* Embedding tables may pose challenge...
langchain/cookbook/Semi_Structured_RAG.ipynb/0
{ "file_path": "langchain/cookbook/Semi_Structured_RAG.ipynb", "repo_id": "langchain", "token_count": 2478 }
74
import shutil from typing import Optional, Type from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.pydantic_v1 import BaseModel, Field from langchain_core.tools import BaseTool from langchain_community.tools.file_management.utils import ( INVALID_PATH_TEMPLATE, BaseFileToolMixi...
langchain/libs/community/langchain_community/tools/file_management/move.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/file_management/move.py", "repo_id": "langchain", "token_count": 768 }
286
## For JS backend: # LANGCHAIN_TRACING_V2=true # LANGCHAIN_ENDPOINT="https://api.smith.langchain.com" # LANGCHAIN_API_KEY="YOUR_LANGSMITH_KEY" # LANGCHAIN_PROJECT="YOUR_PROJECT_NAME" # NEXT_PUBLIC_API_BASE_URL="http://localhost:3000/api" # OPENAI_API_KEY="YOUR_OPENAI_API_KEY" # TAVILY_API_KEY="YOUR_TAVILY_KEY"
weblangchain/nextjs/.env.example/0
{ "file_path": "weblangchain/nextjs/.env.example", "repo_id": "weblangchain", "token_count": 145 }
1,995
from llama_index.legacy.node_parser.text.semantic_splitter import ( SemanticSplitterNodeParser, ) from llama_index.legacy.schema import Document from tests.playground.test_base import MockEmbedding def test_grouped_semantically() -> None: document = Document( text="They're taking the Hobbits to Isenga...
llama_index/llama-index-legacy/tests/node_parser/test_semantic_splitter.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/node_parser/test_semantic_splitter.py", "repo_id": "llama_index", "token_count": 669 }
1,750
<jupyter_start><jupyter_text>**How to benchmark models with Transformers**With ever-larger language models, it is no longer enough to just compare models on their performance on a specific task. One should always be aware of the computational cost that is attached to a specific model. For a given computation environmen...
notebooks/examples/benchmark.ipynb/0
{ "file_path": "notebooks/examples/benchmark.ipynb", "repo_id": "notebooks", "token_count": 12105 }
291
import os import sys import time import openai from openai import OpenAI from validate_json import validate_json client = OpenAI(api_key=os.getenv("OPENAI_API_KEY")) def launch_training(data_path: str) -> None: validate_json(data_path) # TODO: figure out how to specify file name in the new API # file_n...
llama_index/experimental/openai_fine_tuning/launch_training.py/0
{ "file_path": "llama_index/experimental/openai_fine_tuning/launch_training.py", "repo_id": "llama_index", "token_count": 456 }
1,191
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-perplexity/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-perplexity/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,299
import { AdminClient } from "../src/AdminClient"; const PORT = process.env.PORT || "8000"; const URL = "http://localhost:" + PORT; const adminClient = new AdminClient({ path: URL }); export default adminClient;
chroma/clients/js/test/initAdminClient.ts/0
{ "file_path": "chroma/clients/js/test/initAdminClient.ts", "repo_id": "chroma", "token_count": 62 }
35
import { OpenAI } from "@langchain/openai"; import { UpstashRedisCache } from "@langchain/community/caches/upstash_redis"; // See https://docs.upstash.com/redis/howto/connectwithupstashredis#quick-start for connection options const cache = new UpstashRedisCache({ config: { url: "UPSTASH_REDIS_REST_URL", toke...
langchainjs/examples/src/cache/upstash_redis.ts/0
{ "file_path": "langchainjs/examples/src/cache/upstash_redis.ts", "repo_id": "langchainjs", "token_count": 147 }
815
""" AutoAugment, RandAugment, AugMix, and 3-Augment for PyTorch This code implements the searched ImageNet policies with various tweaks and improvements and does not include any of the search code. AA and RA Implementation adapted from: https://github.com/tensorflow/tpu/blob/master/models/official/efficientnet/au...
pytorch-image-models/timm/data/auto_augment.py/0
{ "file_path": "pytorch-image-models/timm/data/auto_augment.py", "repo_id": "pytorch-image-models", "token_count": 15929 }
347
from sql_pgvector.chain import chain __all__ = ["chain"]
langchain/templates/sql-pgvector/sql_pgvector/__init__.py/0
{ "file_path": "langchain/templates/sql-pgvector/sql_pgvector/__init__.py", "repo_id": "langchain", "token_count": 19 }
682
"""Init file."""
llama_index/llama-index-legacy/llama_index/legacy/token_counter/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/token_counter/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,647