Spaces:
Runtime error
Runtime error
File size: 1,996 Bytes
63deadc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
from typing import TYPE_CHECKING, Any
from langchain._api import create_importer
if TYPE_CHECKING:
from langchain_community.adapters.openai import (
Chat,
ChatCompletion,
ChatCompletionChunk,
ChatCompletions,
Choice,
ChoiceChunk,
Completions,
IndexableBaseModel,
chat,
convert_dict_to_message,
convert_message_to_dict,
convert_messages_for_finetuning,
convert_openai_messages,
)
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
MODULE_LOOKUP = {
"IndexableBaseModel": "langchain_community.adapters.openai",
"Choice": "langchain_community.adapters.openai",
"ChatCompletions": "langchain_community.adapters.openai",
"ChoiceChunk": "langchain_community.adapters.openai",
"ChatCompletionChunk": "langchain_community.adapters.openai",
"convert_dict_to_message": "langchain_community.adapters.openai",
"convert_message_to_dict": "langchain_community.adapters.openai",
"convert_openai_messages": "langchain_community.adapters.openai",
"ChatCompletion": "langchain_community.adapters.openai",
"convert_messages_for_finetuning": "langchain_community.adapters.openai",
"Completions": "langchain_community.adapters.openai",
"Chat": "langchain_community.adapters.openai",
"chat": "langchain_community.adapters.openai",
}
_import_attribute = create_importer(__file__, deprecated_lookups=MODULE_LOOKUP)
def __getattr__(name: str) -> Any:
"""Look up attributes dynamically."""
return _import_attribute(name)
__all__ = [
"IndexableBaseModel",
"Choice",
"ChatCompletions",
"ChoiceChunk",
"ChatCompletionChunk",
"convert_dict_to_message",
"convert_message_to_dict",
"convert_openai_messages",
"ChatCompletion",
"convert_messages_for_finetuning",
"Completions",
"Chat",
"chat",
]
|