Skip to content

header updated #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/unstract/llmwhisperer/client_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from typing import IO

import requests
from typing import Optional, Dict

BASE_URL_V2 = "https://llmwhisperer-api.us-central.unstract.com/api/v2"

Expand Down Expand Up @@ -76,6 +77,7 @@ def __init__(
base_url: str = "",
api_key: str = "",
logging_level: str = "",
custom_headers: Optional[Dict[str, str]] = None,
):
"""Initializes the LLMWhispererClient with the given parameters.

Expand All @@ -92,6 +94,12 @@ def __init__(
value of the LLMWHISPERER_LOGGING_LEVEL
environment variable, or "DEBUG" if the
environment variable is not set.
custom_headers (Optional[Dict[str, str]], optional): Custom headers to add to
every request. These will
be merged with default
headers, with custom
headers taking precedence.
Defaults to None.
"""
if logging_level == "":
logging_level = os.getenv("LLMWHISPERER_LOGGING_LEVEL", "DEBUG")
Expand All @@ -117,6 +125,8 @@ def __init__(
self.api_key = api_key

self.headers = {"unstract-key": self.api_key}
if custom_headers:
self.headers.update(custom_headers)
# For test purpose
# self.headers = {
# "Subscription-Id": "python-client",
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/client_v2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_whisper_v2_url_in_post(client_v2, data_dir, output_mode, mode, url, inp
"url,token,webhook_name",
[
(
"https://webhook.site/b76ecc5f-8320-4410-b24f-66525d2c92cb",
"https://webhook.site/62bb38ac-408c-4fcf-b8f1-cb22adbf3f96", # need to find a clean solution
"",
"client_v2_test",
),
Expand Down
Loading