PyGeoModel 1.0.6__tar.gz → 1.0.7__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.
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/PKG-INFO +2 -2
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/PyGeoModel.egg-info/PKG-INFO +2 -2
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/README.md +1 -1
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/__init__.py +1 -1
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/config.py +10 -5
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/results.py +1 -1
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/setup.py +1 -1
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/tests/test_core_api.py +46 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/LICENSE +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/MANIFEST.in +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/PyGeoModel.egg-info/SOURCES.txt +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/PyGeoModel.egg-info/dependency_links.txt +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/PyGeoModel.egg-info/requires.txt +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/PyGeoModel.egg-info/top_level.txt +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/ogmsServer2/__init__.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/ogmsServer2/base.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/ogmsServer2/constants.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/ogmsServer2/openModel.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/ogmsServer2/openUtils/__init__.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/ogmsServer2/openUtils/exceptions.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/ogmsServer2/openUtils/http_client.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/ogmsServer2/openUtils/mdlUtils.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/ogmsServer2/openUtils/parameterValidator.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/ogmsServer2/openUtils/stateManager.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/client.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/consensus.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/context.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/data/__init__.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/data/computeModel.json +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/data/modelContext.txt +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/modeler.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/models.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/notebook.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/qa.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/pygeomodel/recommendation.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/scripts.py +0 -0
- {pygeomodel-1.0.6 → pygeomodel-1.0.7}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyGeoModel
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: A Python package for integrating OpenGMS geographic model services.
|
|
5
5
|
Home-page: https://github.com/MpLebron/PyGeoModel
|
|
6
6
|
Author: Peilong Ma
|
|
@@ -124,7 +124,7 @@ answer = modeler.ask_model("SWAT_Model", "What input data are required?")
|
|
|
124
124
|
answer.to_json("qa_record.json")
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
-
The recommendation service automatically builds notebook/data context and calls the configured Dify workflow.
|
|
127
|
+
The recommendation service automatically builds notebook/data context and calls the configured Dify workflow. Q&A uses OpenGMS model metadata and an OpenAI-compatible web-enabled model. PyGeoModel includes public demo credentials for these services so the main notebook workflow can run out of the box. For stable, private, or high-volume use, configure your own credentials with `DIFY_API_KEY`, `OPENAI_API_KEY`, `OPENAI_BASE_URL`, and `OPENAI_MODEL`.
|
|
128
128
|
|
|
129
129
|
## Relation to OpenGMS
|
|
130
130
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyGeoModel
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: A Python package for integrating OpenGMS geographic model services.
|
|
5
5
|
Home-page: https://github.com/MpLebron/PyGeoModel
|
|
6
6
|
Author: Peilong Ma
|
|
@@ -124,7 +124,7 @@ answer = modeler.ask_model("SWAT_Model", "What input data are required?")
|
|
|
124
124
|
answer.to_json("qa_record.json")
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
-
The recommendation service automatically builds notebook/data context and calls the configured Dify workflow.
|
|
127
|
+
The recommendation service automatically builds notebook/data context and calls the configured Dify workflow. Q&A uses OpenGMS model metadata and an OpenAI-compatible web-enabled model. PyGeoModel includes public demo credentials for these services so the main notebook workflow can run out of the box. For stable, private, or high-volume use, configure your own credentials with `DIFY_API_KEY`, `OPENAI_API_KEY`, `OPENAI_BASE_URL`, and `OPENAI_MODEL`.
|
|
128
128
|
|
|
129
129
|
## Relation to OpenGMS
|
|
130
130
|
|
|
@@ -78,7 +78,7 @@ answer = modeler.ask_model("SWAT_Model", "What input data are required?")
|
|
|
78
78
|
answer.to_json("qa_record.json")
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
The recommendation service automatically builds notebook/data context and calls the configured Dify workflow.
|
|
81
|
+
The recommendation service automatically builds notebook/data context and calls the configured Dify workflow. Q&A uses OpenGMS model metadata and an OpenAI-compatible web-enabled model. PyGeoModel includes public demo credentials for these services so the main notebook workflow can run out of the box. For stable, private, or high-volume use, configure your own credentials with `DIFY_API_KEY`, `OPENAI_API_KEY`, `OPENAI_BASE_URL`, and `OPENAI_MODEL`.
|
|
82
82
|
|
|
83
83
|
## Relation to OpenGMS
|
|
84
84
|
|
|
@@ -9,6 +9,11 @@ from pathlib import Path
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
PUBLIC_DEMO_OGMS_TOKEN = '6U3O1Sy5696I5ryJFaYCYVjcIV7rhd1MKK0QGX9A7zafogi8xTdvejl6ISUP1lEs'
|
|
12
|
+
PUBLIC_DEMO_DIFY_API_KEY = 'app-CuNONc6hSct2ap07nmUgcaw9'
|
|
13
|
+
PUBLIC_DEMO_DIFY_BASE_URL = 'https://api.dify.ai/v1'
|
|
14
|
+
PUBLIC_DEMO_OPENAI_API_KEY = 'sk-4bp5a1DcdLSHCiw1401270055f47424b9eA58cAd587266A3'
|
|
15
|
+
PUBLIC_DEMO_OPENAI_BASE_URL = 'https://aihubmix.com/v1'
|
|
16
|
+
PUBLIC_DEMO_OPENAI_MODEL = 'gpt-5.2-low'
|
|
12
17
|
|
|
13
18
|
|
|
14
19
|
@dataclass(frozen=True)
|
|
@@ -47,11 +52,11 @@ def get_llm_config() -> LLMConfig:
|
|
|
47
52
|
dify = local.get("dify", {})
|
|
48
53
|
consensus = local.get("consensus", {})
|
|
49
54
|
return LLMConfig(
|
|
50
|
-
openai_api_key=
|
|
51
|
-
openai_base_url=
|
|
52
|
-
openai_model=
|
|
53
|
-
dify_api_key=
|
|
54
|
-
dify_base_url=
|
|
55
|
+
openai_api_key=os.environ.get("OPENAI_API_KEY") or openai.get("api_key") or PUBLIC_DEMO_OPENAI_API_KEY,
|
|
56
|
+
openai_base_url=os.environ.get("OPENAI_BASE_URL") or openai.get("base_url") or PUBLIC_DEMO_OPENAI_BASE_URL,
|
|
57
|
+
openai_model=os.environ.get("OPENAI_MODEL") or openai.get("model") or PUBLIC_DEMO_OPENAI_MODEL,
|
|
58
|
+
dify_api_key=os.environ.get("DIFY_API_KEY") or dify.get("api_key") or PUBLIC_DEMO_DIFY_API_KEY,
|
|
59
|
+
dify_base_url=os.environ.get("DIFY_BASE_URL") or dify.get("base_url") or PUBLIC_DEMO_DIFY_BASE_URL,
|
|
55
60
|
consensus_api_key=consensus.get("api_key") or os.environ.get("CONSENSUS_API_KEY"),
|
|
56
61
|
consensus_base_url=consensus.get("base_url") or os.environ.get("CONSENSUS_BASE_URL") or LLMConfig.consensus_base_url,
|
|
57
62
|
)
|
|
@@ -29,7 +29,7 @@ class TaskResult:
|
|
|
29
29
|
params: dict[str, Any] = field(default_factory=dict)
|
|
30
30
|
uploaded_inputs: dict[str, Any] = field(default_factory=dict)
|
|
31
31
|
endpoint: str | None = None
|
|
32
|
-
pygeomodel_version: str = "1.0.
|
|
32
|
+
pygeomodel_version: str = "1.0.7"
|
|
33
33
|
execution_time: float | None = None
|
|
34
34
|
created_at: float = field(default_factory=time.time)
|
|
35
35
|
|
|
@@ -323,6 +323,52 @@ class CoreApiTests(unittest.TestCase):
|
|
|
323
323
|
else:
|
|
324
324
|
os.environ["OGMS_TOKEN"] = original_env
|
|
325
325
|
|
|
326
|
+
def test_llm_config_uses_public_demo_credentials_as_fallback(self):
|
|
327
|
+
import pygeomodel.config as config_module
|
|
328
|
+
|
|
329
|
+
env_keys = ["DIFY_API_KEY", "DIFY_BASE_URL", "OPENAI_API_KEY", "OPENAI_BASE_URL", "OPENAI_MODEL"]
|
|
330
|
+
original_env = {key: os.environ.get(key) for key in env_keys}
|
|
331
|
+
original_loader = config_module._load_local_api_keys
|
|
332
|
+
try:
|
|
333
|
+
config_module._load_local_api_keys = lambda: {}
|
|
334
|
+
for key in env_keys:
|
|
335
|
+
os.environ.pop(key, None)
|
|
336
|
+
|
|
337
|
+
cfg = config_module.get_llm_config()
|
|
338
|
+
self.assertEqual(cfg.dify_api_key, config_module.PUBLIC_DEMO_DIFY_API_KEY)
|
|
339
|
+
self.assertEqual(cfg.dify_base_url, config_module.PUBLIC_DEMO_DIFY_BASE_URL)
|
|
340
|
+
self.assertEqual(cfg.openai_api_key, config_module.PUBLIC_DEMO_OPENAI_API_KEY)
|
|
341
|
+
self.assertEqual(cfg.openai_base_url, config_module.PUBLIC_DEMO_OPENAI_BASE_URL)
|
|
342
|
+
self.assertEqual(cfg.openai_model, config_module.PUBLIC_DEMO_OPENAI_MODEL)
|
|
343
|
+
|
|
344
|
+
config_module._load_local_api_keys = lambda: {
|
|
345
|
+
"dify": {"api_key": "local-dify", "base_url": "https://local-dify.example/v1"},
|
|
346
|
+
"openai": {
|
|
347
|
+
"api_key": "local-openai",
|
|
348
|
+
"base_url": "https://local-openai.example/v1",
|
|
349
|
+
"model": "local-model",
|
|
350
|
+
},
|
|
351
|
+
}
|
|
352
|
+
cfg = config_module.get_llm_config()
|
|
353
|
+
self.assertEqual(cfg.dify_api_key, "local-dify")
|
|
354
|
+
self.assertEqual(cfg.openai_api_key, "local-openai")
|
|
355
|
+
self.assertEqual(cfg.openai_model, "local-model")
|
|
356
|
+
|
|
357
|
+
os.environ["DIFY_API_KEY"] = "env-dify"
|
|
358
|
+
os.environ["OPENAI_API_KEY"] = "env-openai"
|
|
359
|
+
os.environ["OPENAI_MODEL"] = "env-model"
|
|
360
|
+
cfg = config_module.get_llm_config()
|
|
361
|
+
self.assertEqual(cfg.dify_api_key, "env-dify")
|
|
362
|
+
self.assertEqual(cfg.openai_api_key, "env-openai")
|
|
363
|
+
self.assertEqual(cfg.openai_model, "env-model")
|
|
364
|
+
finally:
|
|
365
|
+
config_module._load_local_api_keys = original_loader
|
|
366
|
+
for key, value in original_env.items():
|
|
367
|
+
if value is None:
|
|
368
|
+
os.environ.pop(key, None)
|
|
369
|
+
else:
|
|
370
|
+
os.environ[key] = value
|
|
371
|
+
|
|
326
372
|
def test_recommendation_result_has_notebook_rich_display(self):
|
|
327
373
|
from pygeomodel import RecommendationResult
|
|
328
374
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|