Skip to content

Commit

Permalink
Remove circular package dep (#16070)
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-markewich authored Sep 18, 2024
1 parent 0a5d302 commit 044a439
Show file tree
Hide file tree
Showing 37 changed files with 28 additions and 212 deletions.
4 changes: 2 additions & 2 deletions llama-index-experimental/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ exclude = ["**/BUILD"]
license = "MIT"
name = "llama-index-experimental"
readme = "README.md"
version = "0.3.1"
version = "0.3.2"

[tool.poetry.dependencies]
python = ">=3.9,<4.0"
python = ">=3.10,<4.0"
llama-index-core = "^0.11.0"
llama-index-finetuning = "^0.2.0"
pandas = "*"
Expand Down
4 changes: 3 additions & 1 deletion llama-index-experimental/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
python_tests()
python_tests(
interpreter_constraints=["==3.10.*"]
)
3 changes: 0 additions & 3 deletions llama-index-experimental/tests/param_tuner/BUILD

This file was deleted.

Empty file.
53 changes: 0 additions & 53 deletions llama-index-experimental/tests/param_tuner/test_base.py

This file was deleted.

This file was deleted.

10 changes: 4 additions & 6 deletions llama-index-finetuning/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ exclude = ["**/BUILD"]
license = "MIT"
name = "llama-index-finetuning"
readme = "README.md"
version = "0.2.0"
version = "0.2.1"

[tool.poetry.dependencies]
python = ">=3.9,<4.0"
python = ">=3.10,<4.0"
llama-index-core = "^0.11.0"
llama-index-llms-openai = "^0.2.0"
llama-index-llms-azure-openai = "^0.2.0"
llama-index-llms-mistralai = "^0.2.0"
llama-index-postprocessor-cohere-rerank = "^0.2.0"
llama-index-embeddings-adapter = "^0.2.0"
sentence-transformers = "^2.3.0"
tenacity = ">=8.2.0,<8.4.0"
llama-index-llms-azure-openai = "^0.2.0"
sentence-transformers = ">=2.3.0"

[tool.poetry.group.dev.dependencies]
ipython = "8.10.0"
Expand Down
3 changes: 0 additions & 3 deletions llama-index-finetuning/tests/BUILD

This file was deleted.

Empty file.
4 changes: 0 additions & 4 deletions llama-index-finetuning/tests/azure_openai/BUILD

This file was deleted.

Empty file.

This file was deleted.

4 changes: 0 additions & 4 deletions llama-index-finetuning/tests/callbacks/BUILD

This file was deleted.

Empty file.

This file was deleted.

4 changes: 0 additions & 4 deletions llama-index-finetuning/tests/cross_encoders/BUILD

This file was deleted.

Empty file.

This file was deleted.

4 changes: 0 additions & 4 deletions llama-index-finetuning/tests/embeddings/BUILD

This file was deleted.

Empty file.
15 changes: 0 additions & 15 deletions llama-index-finetuning/tests/embeddings/test_embeddings_classes.py

This file was deleted.

4 changes: 0 additions & 4 deletions llama-index-finetuning/tests/mistralai/BUILD

This file was deleted.

Empty file.

This file was deleted.

4 changes: 0 additions & 4 deletions llama-index-finetuning/tests/openai/BUILD

This file was deleted.

Empty file.
7 changes: 0 additions & 7 deletions llama-index-finetuning/tests/openai/test_openai_classes.py

This file was deleted.

4 changes: 0 additions & 4 deletions llama-index-finetuning/tests/rerankers/BUILD

This file was deleted.

Empty file.

This file was deleted.

22 changes: 0 additions & 22 deletions llama-index-finetuning/tests/test_base.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
"""Utils for OpenAI agent."""

from typing import Union
from llama_index.llms.openai.utils import resolve_tool_choice


def resolve_tool_choice(tool_choice: Union[str, dict] = "auto") -> Union[str, dict]:
"""Resolve tool choice.
If tool_choice is a function name string, return the appropriate dict.
"""
if isinstance(tool_choice, str) and tool_choice not in ["none", "auto", "required"]:
return {"type": "function", "function": {"name": tool_choice}}

return tool_choice
__all__ = ["resolve_tool_choice"]
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ exclude = ["**/BUILD"]
license = "MIT"
name = "llama-index-agent-openai"
readme = "README.md"
version = "0.3.1"
version = "0.3.3"

[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
llama-index-llms-openai = "^0.2.0"
openai = ">=1.14.0"
llama-index-llms-openai = "^0.2.0"
llama-index-core = "^0.11.0"

[tool.poetry.group.dev.dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ exclude = ["**/BUILD"]
license = "MIT"
name = "llama-index-embeddings-adapter"
readme = "README.md"
version = "0.2.1"
version = "0.2.2"

[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
torch = "^2.1.2"
torch = ">=2.0.0"
llama-index-core = "^0.11.0"

[tool.poetry.group.dev.dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
openai_modelname_to_contextsize,
resolve_openai_credentials,
to_openai_message_dicts,
resolve_tool_choice,
)
from llama_index.core.bridge.pydantic import (
BaseModel,
Expand Down Expand Up @@ -873,9 +874,6 @@ def _prepare_chat_with_tools(
**kwargs: Any,
) -> Dict[str, Any]:
"""Predict and call the tool."""
from llama_index.agent.openai.utils import resolve_tool_choice

# misralai uses the same openai tool format
tool_specs = [tool.metadata.to_openai_tool() for tool in tools]

# if strict is passed in, use, else default to the class-level attribute, else default to True`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,3 +428,14 @@ def validate_openai_api_key(api_key: Optional[str] = None) -> None:

if not openai_api_key:
raise ValueError(MISSING_API_KEY_ERROR_MESSAGE)


def resolve_tool_choice(tool_choice: Union[str, dict] = "auto") -> Union[str, dict]:
"""Resolve tool choice.
If tool_choice is a function name string, return the appropriate dict.
"""
if isinstance(tool_choice, str) and tool_choice not in ["none", "auto", "required"]:
return {"type": "function", "function": {"name": tool_choice}}

return tool_choice
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ exclude = ["**/BUILD"]
license = "MIT"
name = "llama-index-llms-openai"
readme = "README.md"
version = "0.2.7"
version = "0.2.9"

[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
openai = "^1.40.0"
llama-index-core = "^0.11.7"
llama-index-agent-openai = "^0.3.1"

[tool.poetry.group.dev.dependencies]
ipython = "8.10.0"
Expand Down

0 comments on commit 044a439

Please sign in to comment.