Skip to content

Commit

Permalink
remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
hwchase17 committed Dec 13, 2023
1 parent 858f4cb commit 94251f3
Show file tree
Hide file tree
Showing 261 changed files with 196 additions and 1,365 deletions.
6 changes: 0 additions & 6 deletions libs/langchain/langchain/adapters/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
ChoiceChunk,
Completions,
IndexableBaseModel,
_convert_message_chunk,
_convert_message_chunk_to_delta,
_has_assistant_message,
chat,
convert_dict_to_message,
convert_message_to_dict,
Expand All @@ -26,10 +23,7 @@
"convert_dict_to_message",
"convert_message_to_dict",
"convert_openai_messages",
"_convert_message_chunk",
"_convert_message_chunk_to_delta",
"ChatCompletion",
"_has_assistant_message",
"convert_messages_for_finetuning",
"Completions",
"Chat",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from langchain_community.agent_toolkits.file_management.toolkit import (
_FILE_TOOLS,
FileManagementToolkit,
)

__all__ = ["_FILE_TOOLS", "FileManagementToolkit"]
__all__ = ["FileManagementToolkit"]
10 changes: 0 additions & 10 deletions libs/langchain/langchain/agents/agent_toolkits/openapi/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,15 @@
RequestsPatchToolWithParsing,
RequestsPostToolWithParsing,
RequestsPutToolWithParsing,
_create_api_controller_agent,
_create_api_controller_tool,
_create_api_planner_tool,
_get_default_llm_chain,
_get_default_llm_chain_factory,
create_openapi_agent,
)

__all__ = [
"MAX_RESPONSE_LENGTH",
"_get_default_llm_chain",
"_get_default_llm_chain_factory",
"RequestsGetToolWithParsing",
"RequestsPostToolWithParsing",
"RequestsPatchToolWithParsing",
"RequestsPutToolWithParsing",
"RequestsDeleteToolWithParsing",
"_create_api_planner_tool",
"_create_api_controller_agent",
"_create_api_controller_tool",
"create_openapi_agent",
]
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class OpenAIToolAgentAction(AgentActionMessageLog):


def parse_ai_message_to_openai_tool_action(
message: BaseMessage
message: BaseMessage,
) -> Union[List[AgentAction], AgentFinish]:
"""Parse an AI message potentially containing tool_calls."""
if not isinstance(message, AIMessage):
Expand Down
37 changes: 0 additions & 37 deletions libs/langchain/langchain/cache.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
from langchain_community.cache import (
ASTRA_DB_CACHE_DEFAULT_COLLECTION_NAME,
ASTRA_DB_SEMANTIC_CACHE_DEFAULT_THRESHOLD,
ASTRA_DB_SEMANTIC_CACHE_EMBEDDING_CACHE_SIZE,
CASSANDRA_CACHE_DEFAULT_TABLE_NAME,
CASSANDRA_CACHE_DEFAULT_TTL_SECONDS,
CASSANDRA_SEMANTIC_CACHE_DEFAULT_DISTANCE_METRIC,
CASSANDRA_SEMANTIC_CACHE_DEFAULT_SCORE_THRESHOLD,
CASSANDRA_SEMANTIC_CACHE_DEFAULT_TABLE_NAME,
CASSANDRA_SEMANTIC_CACHE_DEFAULT_TTL_SECONDS,
CASSANDRA_SEMANTIC_CACHE_EMBEDDING_CACHE_SIZE,
AstraDBCache,
AstraDBSemanticCache,
Base,
CassandraCache,
CassandraSemanticCache,
FullLLMCache,
Expand All @@ -25,48 +14,22 @@
SQLAlchemyMd5Cache,
SQLiteCache,
UpstashRedisCache,
_dump_generations_to_json,
_dumps_generations,
_ensure_cache_exists,
_hash,
_load_generations_from_json,
_loads_generations,
_validate_ttl,
)

__all__ = [
"_hash",
"_dump_generations_to_json",
"_load_generations_from_json",
"_dumps_generations",
"_loads_generations",
"InMemoryCache",
"Base",
"FullLLMCache",
"SQLAlchemyCache",
"SQLiteCache",
"UpstashRedisCache",
"RedisCache",
"RedisSemanticCache",
"GPTCache",
"_ensure_cache_exists",
"_validate_ttl",
"MomentoCache",
"CASSANDRA_CACHE_DEFAULT_TABLE_NAME",
"CASSANDRA_CACHE_DEFAULT_TTL_SECONDS",
"CassandraCache",
"CASSANDRA_SEMANTIC_CACHE_DEFAULT_DISTANCE_METRIC",
"CASSANDRA_SEMANTIC_CACHE_DEFAULT_SCORE_THRESHOLD",
"CASSANDRA_SEMANTIC_CACHE_DEFAULT_TABLE_NAME",
"CASSANDRA_SEMANTIC_CACHE_DEFAULT_TTL_SECONDS",
"CASSANDRA_SEMANTIC_CACHE_EMBEDDING_CACHE_SIZE",
"CassandraSemanticCache",
"FullMd5LLMCache",
"SQLAlchemyMd5Cache",
"ASTRA_DB_CACHE_DEFAULT_COLLECTION_NAME",
"AstraDBCache",
"ASTRA_DB_SEMANTIC_CACHE_DEFAULT_THRESHOLD",
"ASTRA_DB_CACHE_DEFAULT_COLLECTION_NAME",
"ASTRA_DB_SEMANTIC_CACHE_EMBEDDING_CACHE_SIZE",
"AstraDBSemanticCache",
]
12 changes: 0 additions & 12 deletions libs/langchain/langchain/callbacks/arthur_callback.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
from langchain_community.callbacks.arthur_callback import (
COMPLETION_TOKENS,
DURATION,
FINISH_REASON,
PROMPT_TOKENS,
TOKEN_USAGE,
ArthurCallbackHandler,
_lazy_load_arthur,
)

__all__ = [
"PROMPT_TOKENS",
"COMPLETION_TOKENS",
"TOKEN_USAGE",
"FINISH_REASON",
"DURATION",
"_lazy_load_arthur",
"ArthurCallbackHandler",
]
3 changes: 1 addition & 2 deletions libs/langchain/langchain/callbacks/clearml_callback.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from langchain_community.callbacks.clearml_callback import (
ClearMLCallbackHandler,
import_clearml,
)

__all__ = ["import_clearml", "ClearMLCallbackHandler"]
__all__ = ["ClearMLCallbackHandler"]
10 changes: 0 additions & 10 deletions libs/langchain/langchain/callbacks/comet_ml_callback.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
from langchain_community.callbacks.comet_ml_callback import (
LANGCHAIN_MODEL_NAME,
CometCallbackHandler,
_fetch_text_complexity_metrics,
_get_experiment,
_summarize_metrics_for_generated_outputs,
import_comet_ml,
)

__all__ = [
"LANGCHAIN_MODEL_NAME",
"import_comet_ml",
"_get_experiment",
"_fetch_text_complexity_metrics",
"_summarize_metrics_for_generated_outputs",
"CometCallbackHandler",
]
3 changes: 1 addition & 2 deletions libs/langchain/langchain/callbacks/context_callback.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from langchain_community.callbacks.context_callback import (
ContextCallbackHandler,
import_context,
)

__all__ = ["import_context", "ContextCallbackHandler"]
__all__ = ["ContextCallbackHandler"]
4 changes: 1 addition & 3 deletions libs/langchain/langchain/callbacks/flyte_callback.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from langchain_community.callbacks.flyte_callback import (
FlyteCallbackHandler,
analyze_text,
import_flytekit,
)

__all__ = ["import_flytekit", "analyze_text", "FlyteCallbackHandler"]
__all__ = ["FlyteCallbackHandler"]
4 changes: 0 additions & 4 deletions libs/langchain/langchain/callbacks/human.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
AsyncHumanApprovalCallbackHandler,
HumanApprovalCallbackHandler,
HumanRejectedException,
_default_approve,
_default_true,
)

__all__ = [
"_default_approve",
"_default_true",
"HumanRejectedException",
"HumanApprovalCallbackHandler",
"AsyncHumanApprovalCallbackHandler",
Expand Down
6 changes: 0 additions & 6 deletions libs/langchain/langchain/callbacks/infino_callback.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
from langchain_community.callbacks.infino_callback import (
InfinoCallbackHandler,
get_num_tokens,
import_infino,
import_tiktoken,
)

__all__ = [
"import_infino",
"import_tiktoken",
"get_num_tokens",
"InfinoCallbackHandler",
]
28 changes: 0 additions & 28 deletions libs/langchain/langchain/callbacks/llmonitor_callback.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,7 @@
from langchain_community.callbacks.llmonitor_callback import (
DEFAULT_API_URL,
PARAMS_TO_CAPTURE,
LLMonitorCallbackHandler,
UserContextManager,
_get_user_id,
_get_user_props,
_parse_input,
_parse_lc_message,
_parse_lc_messages,
_parse_lc_role,
_parse_output,
_serialize,
identify,
user_ctx,
user_props_ctx,
)

__all__ = [
"DEFAULT_API_URL",
"user_ctx",
"user_props_ctx",
"PARAMS_TO_CAPTURE",
"UserContextManager",
"identify",
"_serialize",
"_parse_input",
"_parse_output",
"_parse_lc_role",
"_get_user_id",
"_get_user_props",
"_parse_lc_message",
"_parse_lc_messages",
"LLMonitorCallbackHandler",
]
2 changes: 0 additions & 2 deletions libs/langchain/langchain/callbacks/mlflow_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
MlflowLogger,
analyze_text,
construct_html_from_prompt_and_generation,
import_mlflow,
)

__all__ = [
"import_mlflow",
"analyze_text",
"construct_html_from_prompt_and_generation",
"MlflowLogger",
Expand Down
6 changes: 0 additions & 6 deletions libs/langchain/langchain/callbacks/openai_info.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
from langchain_community.callbacks.openai_info import (
MODEL_COST_PER_1K_TOKENS,
OpenAICallbackHandler,
get_openai_token_cost_for_model,
standardize_model_name,
)

__all__ = [
"MODEL_COST_PER_1K_TOKENS",
"standardize_model_name",
"get_openai_token_cost_for_model",
"OpenAICallbackHandler",
]
3 changes: 1 addition & 2 deletions libs/langchain/langchain/callbacks/promptlayer_callback.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from langchain_community.callbacks.promptlayer_callback import (
PromptLayerCallbackHandler,
_lazy_import_promptlayer,
)

__all__ = ["_lazy_import_promptlayer", "PromptLayerCallbackHandler"]
__all__ = ["PromptLayerCallbackHandler"]
3 changes: 1 addition & 2 deletions libs/langchain/langchain/callbacks/sagemaker_callback.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from langchain_community.callbacks.sagemaker_callback import (
SageMakerCallbackHandler,
save_json,
)

__all__ = ["save_json", "SageMakerCallbackHandler"]
__all__ = ["SageMakerCallbackHandler"]
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
LLMThoughtState,
StreamlitCallbackHandler,
ToolRecord,
_convert_newlines,
)

__all__ = [
"_convert_newlines",
"CHECKMARK_EMOJI",
"THINKING_EMOJI",
"HISTORY_EMOJI",
Expand Down
3 changes: 1 addition & 2 deletions libs/langchain/langchain/callbacks/tracers/comet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from langchain_community.callbacks.tracers.comet import (
CometTracer,
_get_run_type,
import_comet_llm_api,
)

__all__ = ["_get_run_type", "import_comet_llm_api", "CometTracer"]
__all__ = ["import_comet_llm_api", "CometTracer"]
2 changes: 0 additions & 2 deletions libs/langchain/langchain/callbacks/tracers/wandb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
RunProcessor,
WandbRunArgs,
WandbTracer,
_serialize_io,
)

__all__ = [
"PRINT_WARNINGS",
"_serialize_io",
"RunProcessor",
"WandbRunArgs",
"WandbTracer",
Expand Down
3 changes: 1 addition & 2 deletions libs/langchain/langchain/callbacks/trubrics_callback.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from langchain_community.callbacks.trubrics_callback import (
TrubricsCallbackHandler,
_convert_message_to_dict,
)

__all__ = ["_convert_message_to_dict", "TrubricsCallbackHandler"]
__all__ = ["TrubricsCallbackHandler"]
8 changes: 0 additions & 8 deletions libs/langchain/langchain/callbacks/wandb_callback.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
from langchain_community.callbacks.wandb_callback import (
WandbCallbackHandler,
analyze_text,
construct_html_from_prompt_and_generation,
import_wandb,
load_json_to_dict,
)

__all__ = [
"import_wandb",
"load_json_to_dict",
"analyze_text",
"construct_html_from_prompt_and_generation",
"WandbCallbackHandler",
]
4 changes: 1 addition & 3 deletions libs/langchain/langchain/callbacks/whylabs_callback.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from langchain_community.callbacks.whylabs_callback import (
WhyLabsCallbackHandler,
diagnostic_logger,
import_langkit,
)

__all__ = ["diagnostic_logger", "import_langkit", "WhyLabsCallbackHandler"]
__all__ = ["WhyLabsCallbackHandler"]
2 changes: 1 addition & 1 deletion libs/langchain/langchain/chains/ernie_functions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def convert_python_function_to_ernie_function(


def convert_to_ernie_function(
function: Union[Dict[str, Any], Type[BaseModel], Callable]
function: Union[Dict[str, Any], Type[BaseModel], Callable],
) -> Dict[str, Any]:
"""Convert a raw function/class to an Ernie function.
Expand Down
2 changes: 1 addition & 1 deletion libs/langchain/langchain/chains/openai_functions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def convert_python_function_to_openai_function(


def convert_to_openai_function(
function: Union[Dict[str, Any], Type[BaseModel], Callable]
function: Union[Dict[str, Any], Type[BaseModel], Callable],
) -> Dict[str, Any]:
"""Convert a raw function/class to an OpenAI function.
Expand Down
4 changes: 1 addition & 3 deletions libs/langchain/langchain/chat_loaders/gmail.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from langchain_community.chat_loaders.gmail import (
GMailLoader,
_extract_email_content,
_get_message_data,
)

__all__ = ["_extract_email_content", "_get_message_data", "GMailLoader"]
__all__ = ["GMailLoader"]
Loading

0 comments on commit 94251f3

Please sign in to comment.