-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Zipstack/fix/assign-api-key-in-init
fix: Assign api_key on init call
- Loading branch information
Showing
8 changed files
with
489 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ dependencies = [ | |
"requests~=2.32.3", | ||
] | ||
readme = "README.md" | ||
urls = { Homepage = "https://llmwhisperer.unstract.com" } | ||
urls = { Homepage = "https://llmwhisperer.unstract.com", Source = "https://github.com/Zipstack/llm-whisperer-python-client" } | ||
license = {text = "AGPL v3"} | ||
authors = [ | ||
{name = "Zipstack Inc", email = "[email protected]"}, | ||
|
@@ -29,6 +29,13 @@ classifiers = [ | |
] | ||
|
||
[tool.pdm.dev-dependencies] | ||
test = [ | ||
"pytest>=8.2.2", | ||
"pytest-mock>=3.14.0", | ||
"pytest-dotenv>=0.5.2", | ||
"pytest-cov>=5.0.0", | ||
"pytest-md-report>=0.6.2", | ||
] | ||
lint = [ | ||
"autopep8~=2.0.2", | ||
"black~=23.3.0", | ||
|
@@ -41,6 +48,10 @@ lint = [ | |
"mypy~=1.10.0" | ||
] | ||
|
||
[tool.pdm.version] | ||
source = "file" | ||
path = "src/llmwhisperer/__init__.py" | ||
|
||
[tool.isort] | ||
line_length = 120 | ||
multi_line_output = 3 | ||
|
@@ -57,7 +68,13 @@ max-line-length = 120 | |
includes = ["src"] | ||
package-dir = "src" | ||
|
||
[tool.pdm.version] | ||
source = "file" | ||
path = "src/llmwhisperer/__init__.py" | ||
[tool.pytest.ini_options] | ||
env_files = ["tests/.env"] | ||
addopts = "-s" | ||
log_level = "INFO" | ||
log_cli = true | ||
|
||
[tool.pdm.scripts] | ||
test.cmd = "pytest" | ||
test.env_file = "tests/.env" | ||
test.help = "Runs pytests for LLM Whisperer client" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
__version__ = "0.11.0" | ||
|
||
__version__ = "0.1.1" | ||
|
||
def get_sdk_version(): | ||
"""Returns the SDK version.""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class LLMWhispererUtils: | ||
@staticmethod | ||
def redact_key(api_key: str, reveal_length=4) -> str: | ||
"""Hides sensitive information partially. Useful for logging keys. | ||
Args: | ||
api_key (str): API key to redact | ||
Returns: | ||
str: Redacted API key | ||
""" | ||
if not isinstance(api_key, str): | ||
raise ValueError("API key must be a string") | ||
|
||
if reveal_length < 0: | ||
raise ValueError("Reveal length must be a non-negative integer") | ||
|
||
redacted_length = max(len(api_key) - reveal_length, 0) | ||
revealed_part = api_key[:reveal_length] | ||
redacted_part = "x" * redacted_length | ||
return revealed_part + redacted_part |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export LLMWHISPERER_BASE_URL=https://llmwhisperer-api.unstract.com/v1 | ||
export LLMWHISPERER_LOG_LEVEL=DEBUG | ||
export LLMWHISPERER_API_KEY= | ||
LLMWHISPERER_BASE_URL=https://llmwhisperer-api.unstract.com/v1 | ||
LLMWHISPERER_LOG_LEVEL=DEBUG | ||
LLMWHISPERER_API_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters