Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/mckinsey/vizro into score_t…
Browse files Browse the repository at this point in the history
…ests_improvements
  • Loading branch information
l0uden committed Jan 16, 2025
2 parents 459f482 + b53a9b3 commit c11fcb4
Show file tree
Hide file tree
Showing 26 changed files with 180 additions and 221 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ repos:
args: [--autofix]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.1
rev: v0.8.6
hooks:
- id: ruff
args: [--fix]
Expand Down Expand Up @@ -85,7 +85,7 @@ repos:
args: ["--fix"]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.18
rev: 0.7.21
hooks:
- id: mdformat
args:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ authors = [
{name = "Vizro Team"}
]
description = "Vizro is a package to facilitate visual analytics."
dynamic = ["version"]
name = "vizro"

[tool.bandit]
Expand Down
12 changes: 12 additions & 0 deletions vizro-ai/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ See the fragment files in the [changelog.d directory](https://github.com/mckinse

<!-- scriv-insert-here -->

<a id='changelog-0.3.3'></a>

# 0.3.3 — 2025-01-16

## Changed

- Pinned the Vizro upper bound to prepare for Pydantic V2 migration. ([#923](https://github.com/mckinsey/vizro/pull/923))

## Fixed

- Fixed the "Model name could not be retrieved" error when using VizroAI with AWS Bedrock. ([#953](https://github.com/mckinsey/vizro/pull/953))

<a id='changelog-0.3.2'></a>

# 0.3.2 — 2024-11-08
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,42 @@ Uncomment the section that is right (remove the HTML comment wrapper).
<!--
### Highlights ✨
- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->

<!--
### Removed
- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->

<!--
### Added
- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->

<!--
### Changed
- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->

<!--
### Deprecated
- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->

<!--
### Fixed
- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->

<!--
### Security
- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
2 changes: 1 addition & 1 deletion vizro-ai/docs/pages/user-guides/customize-vizro-ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ Consider upgrading to, in the case of OpenAI the `gpt-4o` and `gpt-4` model seri

### Dashboard generation

At the time of writing we find that cheaper models only work for basic dashboards. For a reasonably complex dashboard we recommend the flagship models of the leading vendors, for example `gpt-4o` or `claude-3-5-sonnet-latest`.
At the time of writing we find that cheaper models only work for basic dashboards. For a reasonably complex dashboard we recommend the flagship models of the leading vendors, for example `gpt-4o`.
7 changes: 2 additions & 5 deletions vizro-ai/hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies = [
"langchain-community",
"langchain_mistralai",
"langchain-anthropic",
"langchain-aws",
"pre-commit"
]
installer = "uv"
Expand All @@ -39,6 +40,7 @@ example = "cd examples; python example.py"
example-create-dashboard = "cd examples; python example_dashboard.py"
example-ui = "cd examples/dashboard_ui; python app.py"
lint = "pre-commit run {args} --all-files"
notebook = "cd examples; jupyter notebook"
pip = '"{env:HATCH_UV}" pip {args}'
prep-release = [
"hatch version release",
Expand Down Expand Up @@ -77,11 +79,6 @@ link-check = "linkchecker site --check-extern --no-warnings --ignore=404.html --
pip = '"{env:HATCH_UV}" pip {args}'
serve = "mkdocs serve --open"

[envs.hatch-uv]
dependencies = [
"uv<0.5.10" # https://github.com/astral-sh/uv/issues/10039
]

[envs.lower-bounds]
extra-dependencies = ["pydantic==1.10.16"]
python = "3.9"
Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/src/vizro_ai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

__all__ = ["VizroAI"]

__version__ = "0.3.3.dev0"
__version__ = "0.3.4.dev0"

# TODO: I think this collides with the VIZRO_LOG_LEVEL setting, as basicConfig can only be set once
logging.basicConfig(level=os.getenv("VIZRO_AI_LOG_LEVEL", "INFO"))
14 changes: 0 additions & 14 deletions vizro-ai/src/vizro_ai/_llm_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from contextlib import suppress
from typing import Optional, Union

from langchain_core.language_models.chat_models import BaseChatModel
Expand Down Expand Up @@ -74,19 +73,6 @@ def _get_llm_model(model: Optional[Union[BaseChatModel, str]] = None) -> BaseCha
)


def _get_model_name(model: BaseChatModel) -> str:
methods = [
lambda: model.model_name, # OpenAI models
lambda: model.model, # Anthropic models
]

for method in methods:
with suppress(AttributeError):
return method()

raise ValueError("Model name could not be retrieved")


if __name__ == "__main__":
llm_chat_openai = _get_llm_model(model="gpt-4o-mini")
print(repr(llm_chat_openai)) # noqa: T201
Expand Down
10 changes: 4 additions & 6 deletions vizro-ai/src/vizro_ai/_vizro_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from langchain_core.language_models.chat_models import BaseChatModel
from langchain_core.messages import HumanMessage

from vizro_ai._llm_models import _get_llm_model, _get_model_name
from vizro_ai._llm_models import _get_llm_model
from vizro_ai.dashboard._graph.dashboard_creation import _create_and_compile_graph
from vizro_ai.dashboard._pydantic_output import _get_pydantic_model # TODO: make general, ie remove from dashboard
from vizro_ai.dashboard.utils import DashboardOutputs, _extract_overall_imports_and_code, _register_data
Expand Down Expand Up @@ -50,12 +50,10 @@ def __init__(self, model: Optional[Union[BaseChatModel, str]] = None):
self.components_instances = {}

# TODO add pending URL link to docs
model_name = _get_model_name(self.model)
logger.info(
f"You have selected {model_name},"
f"Engaging with LLMs (Large Language Models) carries certain risks. "
f"Users are advised to become familiar with these risks to make informed decisions, "
f"and visit this page for detailed information: "
"Engaging with LLMs (Large Language Models) carries certain risks. "
"Users are advised to become familiar with these risks to make informed decisions, "
"and visit this page for detailed information: "
"https://vizro-ai.readthedocs.io/en/latest/pages/explanation/disclaimer/"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,42 @@ Uncomment the section that is right (remove the HTML comment wrapper).
<!--
### Highlights ✨
- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->

<!--
### Removed
- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->

<!--
### Added
- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->

<!--
### Changed
- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->

<!--
### Deprecated
- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->

<!--
### Fixed

- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- Fix hidden axis and tick labels for Graph components using `px.parallel_coordinates`. ([#941](https://github.com/mckinsey/vizro/pull/941))

-->

<!--
### Security
- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
Loading

0 comments on commit c11fcb4

Please sign in to comment.