galet 0.1.0__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.
- galet-0.1.0/LICENSE +21 -0
- galet-0.1.0/PKG-INFO +102 -0
- galet-0.1.0/README.md +77 -0
- galet-0.1.0/pyproject.toml +33 -0
- galet-0.1.0/setup.cfg +4 -0
- galet-0.1.0/src/galet/__init__.py +43 -0
- galet-0.1.0/src/galet/adapter_interface.py +53 -0
- galet-0.1.0/src/galet/deepseek_responses.py +359 -0
- galet-0.1.0/src/galet/dto.py +35 -0
- galet-0.1.0/src/galet/embedding_dto.py +16 -0
- galet-0.1.0/src/galet/embedding_interface.py +16 -0
- galet-0.1.0/src/galet/embedding_router.py +35 -0
- galet-0.1.0/src/galet/gemini_api.py +354 -0
- galet-0.1.0/src/galet/gemini_imagegen.py +186 -0
- galet-0.1.0/src/galet/imagegen_dto.py +22 -0
- galet-0.1.0/src/galet/imagegen_interface.py +19 -0
- galet-0.1.0/src/galet/imagegen_router.py +54 -0
- galet-0.1.0/src/galet/interface.py +31 -0
- galet-0.1.0/src/galet/mistral_api.py +432 -0
- galet-0.1.0/src/galet/mistral_embedding.py +133 -0
- galet-0.1.0/src/galet/mistral_responses_adapter.py +88 -0
- galet-0.1.0/src/galet/ollama_api.py +362 -0
- galet-0.1.0/src/galet/openai_embedding.py +163 -0
- galet-0.1.0/src/galet/openai_imagegen.py +196 -0
- galet-0.1.0/src/galet/openai_responses.py +369 -0
- galet-0.1.0/src/galet/openai_responses_adapter.py +98 -0
- galet-0.1.0/src/galet/provider_registry.py +116 -0
- galet-0.1.0/src/galet/router_api.py +82 -0
- galet-0.1.0/src/galet/settings.py +72 -0
- galet-0.1.0/src/galet/tool_output.py +20 -0
- galet-0.1.0/src/galet.egg-info/PKG-INFO +102 -0
- galet-0.1.0/src/galet.egg-info/SOURCES.txt +49 -0
- galet-0.1.0/src/galet.egg-info/dependency_links.txt +1 -0
- galet-0.1.0/src/galet.egg-info/requires.txt +7 -0
- galet-0.1.0/src/galet.egg-info/top_level.txt +1 -0
- galet-0.1.0/tests/test_adapters_get_usage.py +49 -0
- galet-0.1.0/tests/test_embedding_dto.py +64 -0
- galet-0.1.0/tests/test_embedding_interface.py +59 -0
- galet-0.1.0/tests/test_embedding_router.py +98 -0
- galet-0.1.0/tests/test_gemini_api.py +398 -0
- galet-0.1.0/tests/test_gemini_imagegen.py +272 -0
- galet-0.1.0/tests/test_imagegen_dto.py +85 -0
- galet-0.1.0/tests/test_imagegen_interface.py +51 -0
- galet-0.1.0/tests/test_imagegen_router.py +148 -0
- galet-0.1.0/tests/test_mistral_embedding.py +150 -0
- galet-0.1.0/tests/test_ollama_api.py +318 -0
- galet-0.1.0/tests/test_openai_embedding.py +244 -0
- galet-0.1.0/tests/test_openai_imagegen.py +353 -0
- galet-0.1.0/tests/test_settings.py +37 -0
- galet-0.1.0/tests/test_supports_image_processing.py +107 -0
- galet-0.1.0/tests/test_tool_output.py +29 -0
galet-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 junwin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
galet-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: galet
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Provider-agnostic LLM, embedding, and image generation stack extracted from the Lucy monorepo
|
|
5
|
+
Author-email: junwin <jdunwin@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/junwin/galet
|
|
8
|
+
Project-URL: Repository, https://github.com/junwin/galet
|
|
9
|
+
Keywords: llm,openai,gemini,mistral,deepseek,ollama,embeddings,image-generation
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: openai
|
|
20
|
+
Provides-Extra: openai
|
|
21
|
+
Requires-Dist: openai; extra == "openai"
|
|
22
|
+
Provides-Extra: gemini
|
|
23
|
+
Requires-Dist: google-genai; extra == "gemini"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# galet
|
|
27
|
+
|
|
28
|
+
Provider-agnostic LLM, embedding, and image generation stack.
|
|
29
|
+
|
|
30
|
+
## Lineage
|
|
31
|
+
|
|
32
|
+
This package is extracted from the Lucy monorepo (`src/llm` in
|
|
33
|
+
`/home/junwin/src/repos/lucy`) as described in
|
|
34
|
+
`software/ai/lucy/design/llm-module-extraction.md`.
|
|
35
|
+
|
|
36
|
+
It is a fresh repository with no shared git history. The extracted module's
|
|
37
|
+
behaviour, public interface, optional-SDK import fallbacks, and
|
|
38
|
+
no-fail-on-missing-credential semantics are preserved as-is; the only
|
|
39
|
+
intentional change is the configuration boundary (see `settings.py` in later
|
|
40
|
+
checkpoints).
|
|
41
|
+
|
|
42
|
+
## Status
|
|
43
|
+
|
|
44
|
+
Scaffold only. The `src/llm` modules and their tests are moved into this
|
|
45
|
+
package in subsequent checkpoints.
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
galet needs two pieces of configuration, and both can be set with an
|
|
50
|
+
environment variable or a command-line flag.
|
|
51
|
+
|
|
52
|
+
### Credentials (API keys)
|
|
53
|
+
|
|
54
|
+
Only non-Ollama providers need an API key. galet resolves a key in this order:
|
|
55
|
+
|
|
56
|
+
1. The provider's own environment variable (`OPENAI_API_KEY`,
|
|
57
|
+
`DEEPSEEK_API_KEY`, `GEMINI_API_KEY`, `MISTRAL_API_KEY`).
|
|
58
|
+
2. A credential file in the directory named by `--credential-path`, or the
|
|
59
|
+
`GALET_CREDENTIAL_PATH` environment variable when no flag is given.
|
|
60
|
+
|
|
61
|
+
Credential file names:
|
|
62
|
+
|
|
63
|
+
| Provider | File | Key(s) in the file |
|
|
64
|
+
|-----------|---------------------|-------------------------------|
|
|
65
|
+
| openai | `oaicred.json` | `openai_api_key` |
|
|
66
|
+
| deepseek | `deepseek_cred.json`| `deepseek_api_key` |
|
|
67
|
+
| gemini | `gemini_cred.json` | `gemini_api_key`, `api_key` |
|
|
68
|
+
| mistral | `mistral_cred.json` | `mistral_api_key` |
|
|
69
|
+
|
|
70
|
+
Example credential file (`oaicred.json`):
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{"openai_api_key": "sk-..."}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
python samples/send_request.py --credential-path /path/to/credentials --provider openai "hi"
|
|
78
|
+
GALET_CREDENTIAL_PATH=/path/to/credentials python samples/send_request.py --provider openai "hi"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Ollama base URL
|
|
82
|
+
|
|
83
|
+
Ollama needs no API key, but galet must know where the Ollama server is. galet
|
|
84
|
+
resolves the address in this order:
|
|
85
|
+
|
|
86
|
+
1. `--ollama-base-url` (command-line flag)
|
|
87
|
+
2. `OLLAMA_BASE_URL` (environment variable)
|
|
88
|
+
3. `http://localhost:11434/v1` (default, Ollama's OpenAI-compatible endpoint)
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Default local Ollama
|
|
92
|
+
python samples/send_request.py --provider ollama "hi"
|
|
93
|
+
|
|
94
|
+
# Explicit URL
|
|
95
|
+
python samples/send_request.py --provider ollama --ollama-base-url http://localhost:11434/v1 "hi"
|
|
96
|
+
|
|
97
|
+
# Environment variable
|
|
98
|
+
OLLAMA_BASE_URL=http://192.168.87.40:11434/v1 python samples/send_request.py --provider ollama "hi"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Note the `/v1` suffix: galet talks to Ollama's OpenAI-compatible endpoint, not
|
|
102
|
+
the native Ollama API.
|
galet-0.1.0/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# galet
|
|
2
|
+
|
|
3
|
+
Provider-agnostic LLM, embedding, and image generation stack.
|
|
4
|
+
|
|
5
|
+
## Lineage
|
|
6
|
+
|
|
7
|
+
This package is extracted from the Lucy monorepo (`src/llm` in
|
|
8
|
+
`/home/junwin/src/repos/lucy`) as described in
|
|
9
|
+
`software/ai/lucy/design/llm-module-extraction.md`.
|
|
10
|
+
|
|
11
|
+
It is a fresh repository with no shared git history. The extracted module's
|
|
12
|
+
behaviour, public interface, optional-SDK import fallbacks, and
|
|
13
|
+
no-fail-on-missing-credential semantics are preserved as-is; the only
|
|
14
|
+
intentional change is the configuration boundary (see `settings.py` in later
|
|
15
|
+
checkpoints).
|
|
16
|
+
|
|
17
|
+
## Status
|
|
18
|
+
|
|
19
|
+
Scaffold only. The `src/llm` modules and their tests are moved into this
|
|
20
|
+
package in subsequent checkpoints.
|
|
21
|
+
|
|
22
|
+
## Configuration
|
|
23
|
+
|
|
24
|
+
galet needs two pieces of configuration, and both can be set with an
|
|
25
|
+
environment variable or a command-line flag.
|
|
26
|
+
|
|
27
|
+
### Credentials (API keys)
|
|
28
|
+
|
|
29
|
+
Only non-Ollama providers need an API key. galet resolves a key in this order:
|
|
30
|
+
|
|
31
|
+
1. The provider's own environment variable (`OPENAI_API_KEY`,
|
|
32
|
+
`DEEPSEEK_API_KEY`, `GEMINI_API_KEY`, `MISTRAL_API_KEY`).
|
|
33
|
+
2. A credential file in the directory named by `--credential-path`, or the
|
|
34
|
+
`GALET_CREDENTIAL_PATH` environment variable when no flag is given.
|
|
35
|
+
|
|
36
|
+
Credential file names:
|
|
37
|
+
|
|
38
|
+
| Provider | File | Key(s) in the file |
|
|
39
|
+
|-----------|---------------------|-------------------------------|
|
|
40
|
+
| openai | `oaicred.json` | `openai_api_key` |
|
|
41
|
+
| deepseek | `deepseek_cred.json`| `deepseek_api_key` |
|
|
42
|
+
| gemini | `gemini_cred.json` | `gemini_api_key`, `api_key` |
|
|
43
|
+
| mistral | `mistral_cred.json` | `mistral_api_key` |
|
|
44
|
+
|
|
45
|
+
Example credential file (`oaicred.json`):
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{"openai_api_key": "sk-..."}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
python samples/send_request.py --credential-path /path/to/credentials --provider openai "hi"
|
|
53
|
+
GALET_CREDENTIAL_PATH=/path/to/credentials python samples/send_request.py --provider openai "hi"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Ollama base URL
|
|
57
|
+
|
|
58
|
+
Ollama needs no API key, but galet must know where the Ollama server is. galet
|
|
59
|
+
resolves the address in this order:
|
|
60
|
+
|
|
61
|
+
1. `--ollama-base-url` (command-line flag)
|
|
62
|
+
2. `OLLAMA_BASE_URL` (environment variable)
|
|
63
|
+
3. `http://localhost:11434/v1` (default, Ollama's OpenAI-compatible endpoint)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Default local Ollama
|
|
67
|
+
python samples/send_request.py --provider ollama "hi"
|
|
68
|
+
|
|
69
|
+
# Explicit URL
|
|
70
|
+
python samples/send_request.py --provider ollama --ollama-base-url http://localhost:11434/v1 "hi"
|
|
71
|
+
|
|
72
|
+
# Environment variable
|
|
73
|
+
OLLAMA_BASE_URL=http://192.168.87.40:11434/v1 python samples/send_request.py --provider ollama "hi"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Note the `/v1` suffix: galet talks to Ollama's OpenAI-compatible endpoint, not
|
|
77
|
+
the native Ollama API.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "galet"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Provider-agnostic LLM, embedding, and image generation stack extracted from the Lucy monorepo"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "junwin", email = "jdunwin@gmail.com" }]
|
|
13
|
+
keywords = ["llm", "openai", "gemini", "mistral", "deepseek", "ollama", "embeddings", "image-generation"]
|
|
14
|
+
dependencies = ["openai"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Topic :: Software Development :: Libraries",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
openai = ["openai"]
|
|
26
|
+
gemini = ["google-genai"]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/junwin/galet"
|
|
30
|
+
Repository = "https://github.com/junwin/galet"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.packages.find]
|
|
33
|
+
where = ["src"]
|
galet-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from .dto import LLMResponse, LLMUsage, ToolCall
|
|
2
|
+
from .interface import LLMApi
|
|
3
|
+
from .adapter_interface import LLMAdapter
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
from .openai_responses import OpenAIResponsesApi
|
|
7
|
+
from .openai_responses_adapter import OpenAIResponsesAdapter
|
|
8
|
+
except Exception:
|
|
9
|
+
# openai and related adapters are optional for test environments; avoid
|
|
10
|
+
# failing import when the 'openai' package is not installed.
|
|
11
|
+
OpenAIResponsesApi = None
|
|
12
|
+
OpenAIResponsesAdapter = None
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
from .mistral_api import MistralApi
|
|
16
|
+
from .mistral_responses_adapter import MistralResponsesAdapter
|
|
17
|
+
except Exception:
|
|
18
|
+
MistralApi = None
|
|
19
|
+
MistralResponsesAdapter = None
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
from .ollama_api import OllamaApi
|
|
23
|
+
except Exception:
|
|
24
|
+
OllamaApi = None
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
from .gemini_api import GeminiApi
|
|
28
|
+
except Exception:
|
|
29
|
+
GeminiApi = None
|
|
30
|
+
|
|
31
|
+
__all__ = [
|
|
32
|
+
"LLMApi",
|
|
33
|
+
"LLMAdapter",
|
|
34
|
+
"LLMResponse",
|
|
35
|
+
"LLMUsage",
|
|
36
|
+
"ToolCall",
|
|
37
|
+
"OpenAIResponsesApi",
|
|
38
|
+
"OpenAIResponsesAdapter",
|
|
39
|
+
"MistralApi",
|
|
40
|
+
"MistralResponsesAdapter",
|
|
41
|
+
"OllamaApi",
|
|
42
|
+
"GeminiApi",
|
|
43
|
+
]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List, Optional, Protocol
|
|
4
|
+
|
|
5
|
+
from .dto import LLMUsage
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class LLMAdapter(Protocol):
|
|
9
|
+
"""Protocol glue between the FunctionCallingProcessor and a specific LLM API.
|
|
10
|
+
|
|
11
|
+
The processor should remain LLM-agnostic. The adapter is responsible for:
|
|
12
|
+
- calling the model
|
|
13
|
+
- extracting tool calls in a normalized shape
|
|
14
|
+
- formatting tool outputs in the model's expected protocol
|
|
15
|
+
|
|
16
|
+
For now, we keep messages and tool definitions OpenAI-shaped.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def supports_image_processing(self, model: str, provider: Optional[str] = None) -> bool:
|
|
20
|
+
"""Return True if the selected model can natively process images."""
|
|
21
|
+
...
|
|
22
|
+
|
|
23
|
+
def call_model(
|
|
24
|
+
self,
|
|
25
|
+
*,
|
|
26
|
+
model: str,
|
|
27
|
+
input: Any,
|
|
28
|
+
temperature: Optional[float] = None,
|
|
29
|
+
tools: Optional[List[Dict[str, Any]]] = None,
|
|
30
|
+
tool_choice: Optional[str] = None,
|
|
31
|
+
store: Optional[bool] = None,
|
|
32
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
33
|
+
previous_response_id: Optional[str] = None,
|
|
34
|
+
text: Optional[Dict[str, Any]] = None,
|
|
35
|
+
provider: Optional[str] = None,
|
|
36
|
+
) -> Any: ...
|
|
37
|
+
|
|
38
|
+
def extract_tool_calls(self, response: Any) -> List[Dict[str, Any]]: ...
|
|
39
|
+
|
|
40
|
+
def format_tool_output(
|
|
41
|
+
self,
|
|
42
|
+
*,
|
|
43
|
+
call_id: str,
|
|
44
|
+
output: str,
|
|
45
|
+
name: Optional[str] = None,
|
|
46
|
+
provider: Optional[str] = None,
|
|
47
|
+
) -> Dict[str, Any]: ...
|
|
48
|
+
|
|
49
|
+
def get_text(self, response: Any) -> str: ...
|
|
50
|
+
|
|
51
|
+
def get_response_id(self, response: Any) -> Optional[str]: ...
|
|
52
|
+
|
|
53
|
+
def get_usage(self, response: Any) -> Optional[LLMUsage]: ...
|