kiln_ai.adapters
Adapters
Adapters are used to connect Kiln to external systems, or to add new functionality to Kiln.
Model adapters are used to call AI models, like Ollama, OpenAI, etc.
The ml_model_list submodule contains a list of models that can be used for machine learning tasks. More can easily be added, but we keep a list here of models that are known to work well with Kiln's structured data and tool calling systems.
The prompt_builders submodule contains classes that build prompts for use with the AI agents.
The repair submodule contains an adapter for the repair task.
The parser submodule contains parsers for the output of the AI models.
The eval submodule contains the code for evaluating the performance of a model.
Submodules are loaded lazily via PEP 562 __getattr__ to avoid pulling in heavy transitive dependencies (litellm, llama_index, numpy, etc.) when only a lightweight submodule is needed -- e.g. in multiprocessing.spawn child processes that only need eval_helpers.
1""" 2# Adapters 3 4Adapters are used to connect Kiln to external systems, or to add new functionality to Kiln. 5 6Model adapters are used to call AI models, like Ollama, OpenAI, etc. 7 8The ml_model_list submodule contains a list of models that can be used for machine learning tasks. More can easily be added, but we keep a list here of models that are known to work well with Kiln's structured data and tool calling systems. 9 10The prompt_builders submodule contains classes that build prompts for use with the AI agents. 11 12The repair submodule contains an adapter for the repair task. 13 14The parser submodule contains parsers for the output of the AI models. 15 16The eval submodule contains the code for evaluating the performance of a model. 17 18Submodules are loaded lazily via PEP 562 __getattr__ to avoid pulling in heavy 19transitive dependencies (litellm, llama_index, numpy, etc.) when only a 20lightweight submodule is needed -- e.g. in multiprocessing.spawn child processes 21that only need eval_helpers. 22""" 23 24from __future__ import annotations 25 26import importlib 27from typing import TYPE_CHECKING 28 29if TYPE_CHECKING: 30 from . import ( 31 chat, 32 chunkers, 33 data_gen, 34 eval, 35 extractors, 36 fine_tune, 37 ml_embedding_model_list, 38 ml_model_list, 39 model_adapters, 40 prompt_builders, 41 remote_config, 42 repair, 43 ) 44 45__all__ = [ 46 "chat", 47 "chunkers", 48 "data_gen", 49 "eval", 50 "extractors", 51 "fine_tune", 52 "ml_embedding_model_list", 53 "ml_model_list", 54 "model_adapters", 55 "prompt_builders", 56 "remote_config", 57 "repair", 58] 59 60 61def __getattr__(name: str) -> object: 62 if name in __all__: 63 return importlib.import_module(f".{name}", __name__) 64 raise AttributeError(f"module {__name__!r} has no attribute {name!r}") 65 66 67def __dir__() -> list[str]: 68 return __all__