Source code for langchain_experimental.rl_chain.base
from __future__ import annotations
import logging
import os
from abc import ABC, abstractmethod
from typing import (
    TYPE_CHECKING,
    Any,
    Dict,
    Generic,
    List,
    Optional,
    Tuple,
    Type,
    TypeVar,
    Union,
)
from langchain.callbacks.manager import CallbackManagerForChainRun
from langchain.chains.base import Chain
from langchain.chains.llm import LLMChain
from langchain.prompts import (
    BasePromptTemplate,
    ChatPromptTemplate,
    HumanMessagePromptTemplate,
    SystemMessagePromptTemplate,
)
from langchain_experimental.pydantic_v1 import BaseModel, Extra, root_validator
from langchain_experimental.rl_chain.metrics import (
    MetricsTrackerAverage,
    MetricsTrackerRollingWindow,
)
from langchain_experimental.rl_chain.model_repository import ModelRepository
from langchain_experimental.rl_chain.vw_logger import VwLogger
if TYPE_CHECKING:
    import vowpal_wabbit_next as vw
logger = logging.getLogger(__name__)
class _BasedOn:
    def __init__(self, value: Any):
        self.value = value
    def __str__(self) -> str:
        return str(self.value)
    __repr__ = __str__
[docs]def BasedOn(anything: Any) -> _BasedOn:
    return _BasedOn(anything)
class _ToSelectFrom:
    def __init__(self, value: Any):
        self.value = value
    def __str__(self) -> str:
        return str(self.value)
    __repr__ = __str__
[docs]def ToSelectFrom(anything: Any) -> _ToSelectFrom: