c1groupy 0.4.1__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {c1groupy-0.4.1 → c1groupy-0.4.2}/PKG-INFO +1 -1
- {c1groupy-0.4.1 → c1groupy-0.4.2}/pyproject.toml +7 -1
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/llm_handler/handler.py +2 -1
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/llm_handler/provider_registry.py +27 -2
- {c1groupy-0.4.1 → c1groupy-0.4.2}/LICENCE +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/README.md +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/__init__.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/.gitignore +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/.pre-commit-config.yaml +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/Dockerfile +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/README.md.template +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/docker-compose.yml +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/pyproject.toml.template +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/src/__init__.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/src/api_interface.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/src/endpoints/__init__.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/src/endpoints/router1/__init__.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/src/endpoints/router1/example_endpoint.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/src/endpoints/router2/__init__.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/src/endpoints/router2/example_endpoint.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/src/entrypoint.sh +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/src/routers/__init__.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/src/routers/router1.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/src/routers/router2.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/tests/__init__.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/tests/test_example.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/google_utils.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/init_fastapi_project.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/init_streamlit_project.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/llm_handler/__init__.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/llm_handler/config.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/llm_handler/exceptions.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/llm_handler/langfuse_client.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/logging.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/.gitignore +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/.pre-commit-config.yaml +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/Dockerfile +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/README.md.template +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/docker-compose.yml +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/pyproject.toml.template +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/src/app/App.py.template +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/src/app/__init__.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/src/app/pages/1_Page_1.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/src/app/pages/2_Page_2.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/src/app/pages/__init__.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/src/app/pages/home.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/src/entrypoint.sh +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/tests/__init__.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/tests/test_example.py +0 -0
- {c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "c1groupy"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.2"
|
|
4
4
|
description = "C1G company Python module for utilities and project setup"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Tim M Schendzielorz",email = "tim.schendzielorz@googlemail.com"},
|
|
@@ -40,3 +40,9 @@ packages = [{include = "c1gpy", from = "src"}]
|
|
|
40
40
|
[build-system]
|
|
41
41
|
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
42
42
|
build-backend = "poetry.core.masonry.api"
|
|
43
|
+
|
|
44
|
+
[dependency-groups]
|
|
45
|
+
dev = [
|
|
46
|
+
"pytest>=9.0.2",
|
|
47
|
+
"pytest-asyncio>=1.3.0",
|
|
48
|
+
]
|
|
@@ -8,6 +8,7 @@ Factories use lazy imports so optional provider dependencies are only required
|
|
|
8
8
|
when that provider is used.
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
+
import os
|
|
11
12
|
from enum import Enum
|
|
12
13
|
from typing import Any, Callable
|
|
13
14
|
|
|
@@ -24,6 +25,29 @@ class ModelProvider(Enum):
|
|
|
24
25
|
GOOGLE = "google"
|
|
25
26
|
|
|
26
27
|
|
|
28
|
+
_ENV_API_KEY_VARS: dict[ModelProvider, tuple[str, ...]] = {
|
|
29
|
+
ModelProvider.OPENAI: ("OPENAI_API_KEY",),
|
|
30
|
+
ModelProvider.ANTHROPIC: ("ANTHROPIC_API_KEY",),
|
|
31
|
+
ModelProvider.GOOGLE: ("GOOGLE_API_KEY", "GEMINI_API_KEY"),
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _resolve_api_key(provider: ModelProvider, api_key: str | None) -> str:
|
|
36
|
+
if api_key is not None and api_key.strip() != "":
|
|
37
|
+
return api_key
|
|
38
|
+
|
|
39
|
+
for env_var in _ENV_API_KEY_VARS.get(provider, ()):
|
|
40
|
+
env_value = os.getenv(env_var)
|
|
41
|
+
if env_value:
|
|
42
|
+
return env_value
|
|
43
|
+
|
|
44
|
+
raise ProviderError(
|
|
45
|
+
"Missing API key. Provide 'api_key' or set one of these environment variables: "
|
|
46
|
+
f"{_ENV_API_KEY_VARS.get(provider, ())}",
|
|
47
|
+
provider=provider.value,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
27
51
|
# Registry of provider detection rules and LLM constructors.
|
|
28
52
|
_PROVIDER_REGISTRY: dict[
|
|
29
53
|
ModelProvider,
|
|
@@ -69,7 +93,7 @@ def detect_provider(model_name: str) -> ModelProvider:
|
|
|
69
93
|
def create_llm(
|
|
70
94
|
provider: ModelProvider,
|
|
71
95
|
model_name: str,
|
|
72
|
-
api_key: str,
|
|
96
|
+
api_key: str | None = None,
|
|
73
97
|
**kwargs: Any,
|
|
74
98
|
) -> BaseChatModel:
|
|
75
99
|
"""Construct a LangChain chat model for the given provider."""
|
|
@@ -81,7 +105,8 @@ def create_llm(
|
|
|
81
105
|
provider=str(provider),
|
|
82
106
|
)
|
|
83
107
|
|
|
84
|
-
|
|
108
|
+
resolved_api_key = _resolve_api_key(provider, api_key)
|
|
109
|
+
return factory(model_name, resolved_api_key, kwargs)
|
|
85
110
|
|
|
86
111
|
|
|
87
112
|
def _create_openai_llm(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/src/endpoints/router1/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/fastapi_project_files/src/endpoints/router2/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/src/app/pages/1_Page_1.py
RENAMED
|
File without changes
|
{c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/src/app/pages/2_Page_2.py
RENAMED
|
File without changes
|
{c1groupy-0.4.1 → c1groupy-0.4.2}/src/c1gpy/streamlit_project_files/src/app/pages/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|