Skip to content

Commit

Permalink
fixes, so many fixes [circular import bonanza] (#11032)
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-markewich authored Feb 20, 2024
1 parent 5a47396 commit 1cffd25
Show file tree
Hide file tree
Showing 103 changed files with 122 additions and 122 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:

jobs:
test:
runs-on: ubuntu-latest-4core
runs-on: ubuntu-latest-unit-tester
strategy:
# You can use PyPy versions in python-version.
# For example, pypy-2.7 and pypy-3.8
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/pipeline/query_pipeline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -982,14 +982,14 @@
" OutputKeys,\n",
")\n",
"from typing import Dict, Any\n",
"from llama_index.core.llms.llm import BaseLLM\n",
"from llama_index.core.llms.llm import LLM\n",
"from pydantic import Field\n",
"\n",
"\n",
"class RelatedMovieComponent(CustomQueryComponent):\n",
" \"\"\"Related movie component.\"\"\"\n",
"\n",
" llm: BaseLLM = Field(..., description=\"OpenAI LLM\")\n",
" llm: LLM = Field(..., description=\"OpenAI LLM\")\n",
"\n",
" def _validate_component_inputs(\n",
" self, input: Dict[str, Any]\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/module_guides/models/llms/usage_custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ from llama_index.core.llms import (
CompletionResponseGen,
LLMMetadata,
)
from llama_index.core.llms.base import llm_completion_callback
from llama_index.core.llms.callbacks import llm_completion_callback
from llama_index.core import Settings


Expand Down
2 changes: 1 addition & 1 deletion llama-index-core/llama_index/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Init file of LlamaIndex."""

__version__ = "0.10.7"
__version__ = "0.10.8.post1"

import logging
from logging import NullHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
AgentChatResponse,
StreamingAgentChatResponse,
)
from llama_index.core.llms.base import ChatMessage, ChatResponse
from llama_index.core.base.llms.types import ChatMessage, ChatResponse
from llama_index.core.llms.llm import LLM
from llama_index.core.memory.chat_memory_buffer import ChatMemoryBuffer
from llama_index.core.memory.types import BaseMemory
Expand Down
2 changes: 1 addition & 1 deletion llama-index-core/llama_index/core/agent/react/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
AgentChatResponse,
StreamingAgentChatResponse,
)
from llama_index.core.llms.base import ChatMessage, ChatResponse
from llama_index.core.base.llms.types import ChatMessage, ChatResponse
from llama_index.core.llms.llm import LLM
from llama_index.core.memory.chat_memory_buffer import ChatMemoryBuffer
from llama_index.core.memory.types import BaseMemory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
AGENT_CHAT_RESPONSE_TYPE,
AgentChatResponse,
)
from llama_index.core.llms.base import ChatMessage, ChatResponse
from llama_index.core.base.llms.types import ChatMessage, ChatResponse
from llama_index.core.memory.chat_memory_buffer import ChatMemoryBuffer
from llama_index.core.memory.types import BaseMemory
from llama_index.core.multi_modal_llms.base import MultiModalLLM
Expand Down
2 changes: 1 addition & 1 deletion llama-index-core/llama_index/core/agent/runner/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
ChatResponseMode,
StreamingAgentChatResponse,
)
from llama_index.core.llms.base import ChatMessage
from llama_index.core.base.llms.types import ChatMessage
from llama_index.core.llms.llm import LLM
from llama_index.core.memory import BaseMemory, ChatMemoryBuffer
from llama_index.core.memory.types import BaseMemory
Expand Down
2 changes: 1 addition & 1 deletion llama-index-core/llama_index/core/agent/runner/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
ChatResponseMode,
StreamingAgentChatResponse,
)
from llama_index.core.llms.base import ChatMessage
from llama_index.core.base.llms.types import ChatMessage
from llama_index.core.llms.llm import LLM
from llama_index.core.memory import BaseMemory, ChatMemoryBuffer
from llama_index.core.memory.types import BaseMemory
Expand Down
4 changes: 1 addition & 3 deletions llama-index-core/llama_index/core/agent/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"""Agent utils."""


from llama_index.core.agent.types import TaskStep
from llama_index.core.base.llms.types import MessageRole
from llama_index.core.llms.base import ChatMessage
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.memory import BaseMemory


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from llama_index.core.indices.base_retriever import BaseRetriever
from llama_index.core.indices.query.schema import QueryBundle
from llama_index.core.indices.service_context import ServiceContext
from llama_index.core.llms.generic_utils import messages_to_history_str
from llama_index.core.base.llms.generic_utils import messages_to_history_str
from llama_index.core.llms.llm import LLM
from llama_index.core.memory import BaseMemory, ChatMemoryBuffer
from llama_index.core.postprocessor.types import BaseNodePostprocessor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
)
from llama_index.core.chat_engine.utils import response_gen_from_query_engine
from llama_index.core.embeddings.mock_embed_model import MockEmbedding
from llama_index.core.llms.generic_utils import messages_to_history_str
from llama_index.core.base.llms.generic_utils import messages_to_history_str
from llama_index.core.llms.llm import LLM
from llama_index.core.memory import BaseMemory, ChatMemoryBuffer
from llama_index.core.prompts.base import BasePromptTemplate, PromptTemplate
Expand Down
2 changes: 1 addition & 1 deletion llama-index-core/llama_index/core/llms/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
llm_chat_callback,
llm_completion_callback,
)
from llama_index.core.llms.generic_utils import (
from llama_index.core.base.llms.generic_utils import (
completion_response_to_chat_response,
stream_completion_response_to_chat_response,
)
Expand Down
6 changes: 3 additions & 3 deletions llama-index-core/llama_index/core/llms/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
validator,
)
from llama_index.core.callbacks import CBEventType, EventPayload
from llama_index.core.llms.base import BaseLLM
from llama_index.core.llms.generic_utils import (
from llama_index.core.base.llms.base import BaseLLM
from llama_index.core.base.llms.generic_utils import (
messages_to_prompt as generic_messages_to_prompt,
)
from llama_index.core.llms.generic_utils import (
from llama_index.core.base.llms.generic_utils import (
prompt_to_messages,
)
from llama_index.core.prompts import BasePromptTemplate, PromptTemplate
Expand Down
6 changes: 3 additions & 3 deletions llama-index-core/llama_index/core/prompts/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
validate_and_convert_stringable,
)
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.llms.base import BaseLLM
from llama_index.core.llms.generic_utils import (
from llama_index.core.base.llms.base import BaseLLM
from llama_index.core.base.llms.generic_utils import (
messages_to_prompt as default_messages_to_prompt,
)
from llama_index.core.llms.generic_utils import (
from llama_index.core.base.llms.generic_utils import (
prompt_to_messages,
)
from llama_index.core.prompts.prompt_type import PromptType
Expand Down
2 changes: 1 addition & 1 deletion llama-index-core/llama_index/core/prompts/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from string import Formatter
from typing import List

from llama_index.core.llms.base import BaseLLM
from llama_index.core.base.llms.base import BaseLLM


def get_template_vars(template_str: str) -> List[str]:
Expand Down
2 changes: 1 addition & 1 deletion llama-index-core/llama_index/core/service_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
LLMPredictor,
BaseLLMPredictor,
)
from llama_index.core.llms.base import LLMMetadata
from llama_index.core.base.llms.types import LLMMetadata
from llama_index.core.llms.llm import LLM
from llama_index.core.llms.utils import LLMType, resolve_llm
from llama_index.core.service_context_elements.llama_logger import LlamaLogger
Expand Down
2 changes: 1 addition & 1 deletion llama-index-core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ name = "llama-index-core"
packages = [{include = "llama_index"}]
readme = "README.md"
repository = "https://github.com/run-llama/llama_index"
version = "0.10.8"
version = "0.10.8.post1"

[tool.poetry.dependencies]
SQLAlchemy = {extras = ["asyncio"], version = ">=1.4.49"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def save_finetuning_events(self, path: str) -> None:
},
...
"""
from llama_index.core.llms.generic_utils import messages_to_history_str
from llama_index.core.base.llms.generic_utils import messages_to_history_str

events_dict = self.get_finetuning_events()
json_strs = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from llama_index.agent.openai.step import OpenAIAgentWorker
from llama_index.core.agent.runner.base import AgentRunner
from llama_index.core.callbacks import CallbackManager
from llama_index.core.llms.base import ChatMessage
from llama_index.core.base.llms.types import ChatMessage
from llama_index.core.llms.llm import LLM
from llama_index.core.memory.chat_memory_buffer import ChatMemoryBuffer
from llama_index.core.memory.types import BaseMemory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
ChatResponseMode,
StreamingAgentChatResponse,
)
from llama_index.core.llms.base import ChatMessage, ChatResponse
from llama_index.core.base.llms.types import ChatMessage, ChatResponse
from llama_index.core.llms.llm import LLM
from llama_index.core.memory import BaseMemory, ChatMemoryBuffer
from llama_index.core.objects.base import ObjectRetriever
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -937,20 +937,19 @@
"metadata": {},
"outputs": [],
"source": [
"from llama_index.query_pipeline import (\n",
"from llama_index.core.query_pipeline import (\n",
" CustomQueryComponent,\n",
" InputKeys,\n",
" OutputKeys,\n",
")\n",
"from llama_index.core.base.query_pipeline.query import InputKeys, OutputKeys\n",
"from typing import Dict, Any\n",
"from llama_index.llms.llm import BaseLLM\n",
"from llama_index.core.llms.llm import LLM\n",
"from pydantic import Field\n",
"\n",
"\n",
"class RelatedMovieComponent(CustomQueryComponent):\n",
" \"\"\"Related movie component.\"\"\"\n",
"\n",
" llm: BaseLLM = Field(..., description=\"OpenAI LLM\")\n",
" llm: LLM = Field(..., description=\"OpenAI LLM\")\n",
"\n",
" def _validate_component_inputs(self, input: Dict[str, Any]) -> Dict[str, Any]:\n",
" \"\"\"Validate component inputs during run_component.\"\"\"\n",
Expand Down Expand Up @@ -1080,9 +1079,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "llama_integrations",
"display_name": "llama-index-4aB9_5sa-py3.10",
"language": "python",
"name": "llama_integrations"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional, Tuple

from llama_index.core.llms.generic_utils import get_from_param_or_env
from llama_index.core.base.llms.generic_utils import get_from_param_or_env

DEFAULT_ANYSCALE_API_BASE = "https://api.endpoints.anyscale.com/v1"
DEFAULT_ANYSCALE_API_VERSION = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from llama_index.core.bridge.pydantic import Field, PrivateAttr, root_validator
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.constants import DEFAULT_EMBED_BATCH_SIZE
from llama_index.core.llms.generic_utils import get_from_param_or_env
from llama_index.core.base.llms.generic_utils import get_from_param_or_env
from llama_index.embeddings.openai import (
OpenAIEmbedding,
OpenAIEmbeddingMode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
)
from llama_index.core.bridge.pydantic import Field, PrivateAttr
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.llms.generic_utils import get_from_param_or_env
from llama_index.core.base.llms.generic_utils import get_from_param_or_env

MAX_BATCH_SIZE = 2048

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.llms.generic_utils import get_from_param_or_env
from llama_index.core.base.llms.generic_utils import get_from_param_or_env

from mistralai.async_client import MistralAsyncClient
from mistralai.client import MistralClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
from typing import Any, Callable, Optional, Tuple, Union

from llama_index.core.llms.generic_utils import get_from_param_or_env
from llama_index.core.base.llms.generic_utils import get_from_param_or_env
from tenacity import (
before_sleep_log,
retry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from llama_index.core.callbacks import CallbackManager
from llama_index.core.llms.callbacks import llm_chat_callback, llm_completion_callback
from llama_index.core.llms.custom import CustomLLM
from llama_index.core.llms.generic_utils import (
from llama_index.core.base.llms.generic_utils import (
completion_to_chat_decorator,
get_from_param_or_env,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from llama_index.core.llms.base import BaseLLM
from llama_index.core.base.llms.base import BaseLLM
from llama_index.llms.ai21 import AI21


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
llm_chat_callback,
llm_completion_callback,
)
from llama_index.core.llms.generic_utils import (
from llama_index.core.base.llms.generic_utils import (
achat_to_completion_decorator,
astream_chat_to_completion_decorator,
chat_to_completion_decorator,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from llama_index.core.llms.base import BaseLLM
from llama_index.core.base.llms.base import BaseLLM
from llama_index.llms.anthropic import Anthropic


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from llama_index.core.base.llms.types import ChatMessage, LLMMetadata
from llama_index.core.callbacks import CallbackManager
from llama_index.core.constants import DEFAULT_NUM_OUTPUTS, DEFAULT_TEMPERATURE
from llama_index.core.llms.generic_utils import get_from_param_or_env
from llama_index.core.base.llms.generic_utils import get_from_param_or_env
from llama_index.core.types import BaseOutputParser, PydanticProgramMode
from llama_index.llms.anyscale.utils import (
anyscale_modelname_to_contextsize,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any, Dict, List, Optional, Sequence, Tuple

from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.llms.generic_utils import get_from_param_or_env
from llama_index.core.base.llms.generic_utils import get_from_param_or_env

DEFAULT_ANYSCALE_API_BASE = "https://api.endpoints.anyscale.com/v1"
DEFAULT_ANYSCALE_API_VERSION = ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from llama_index.core.llms.base import BaseLLM
from llama_index.core.base.llms.base import BaseLLM
from llama_index.llms.anyscale import Anyscale


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from llama_index.core.base.llms.types import ChatMessage
from llama_index.core.bridge.pydantic import Field, PrivateAttr, root_validator
from llama_index.core.callbacks import CallbackManager
from llama_index.core.llms.generic_utils import get_from_param_or_env
from llama_index.core.base.llms.generic_utils import get_from_param_or_env
from llama_index.core.types import BaseOutputParser, PydanticProgramMode
from llama_index.llms.azure_openai.utils import (
refresh_openai_azuread_token,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from llama_index.core.llms.base import BaseLLM
from llama_index.core.base.llms.base import BaseLLM
from llama_index.llms.azure_openai import AzureOpenAI


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
llm_chat_callback,
llm_completion_callback,
)
from llama_index.core.llms.generic_utils import (
from llama_index.core.base.llms.generic_utils import (
completion_response_to_chat_response,
stream_completion_response_to_chat_response,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Any, Callable, Optional, Sequence

from llama_index.core.base.llms.types import ChatMessage
from llama_index.core.llms.generic_utils import (
from llama_index.core.base.llms.generic_utils import (
prompt_to_messages,
)
from llama_index.llms.anthropic.utils import messages_to_anthropic_prompt
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from llama_index.core.llms.base import BaseLLM
from llama_index.core.base.llms.base import BaseLLM
from llama_index.llms.bedrock import Bedrock


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from llama_index.core.llms.base import BaseLLM
from llama_index.core.base.llms.base import BaseLLM
from llama_index.llms.cohere import Cohere


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from llama_index.core.llms.base import BaseLLM
from llama_index.core.base.llms.base import BaseLLM
from llama_index.llms.dashscope import DashScope


Expand Down
Loading

0 comments on commit 1cffd25

Please sign in to comment.