Skip to content

Commit

Permalink
🐛 Model creation now possible with auth token by env var
Browse files Browse the repository at this point in the history
The model tried to access a value in the super init method which was not yet set. Fixed this problem in a weird way by assigning the model parameter twice.
  • Loading branch information
redadmiral committed Feb 8, 2024
1 parent 934963f commit 84ed146
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@
## 0.1.4 -> 0.1.4.1
- Added parameters to handle the lifecycle of DB objects. Since SQLAlchemy expires objects after commiting they can't
be accessed anymore. The `expire_on_commit=False` parameter disables this behaviour.

## 0.1.4 -> 0.1.4.2
- Fixed a bug with which it was not possible to init the model without passing a auth token
- IGEL now also accepts "IGEL_URL" to query the llm endpoint.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "brdata-rag-tools"
version = "0.1.4.1"
version = "0.1.4.2"
authors = [
{ name = "Marco Lehner", email = "[email protected]" },
]
Expand Down
4 changes: 3 additions & 1 deletion src/brdata_rag_tools/models.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ class OpenAi(Generator):
"""

def __init__(self, model: LLMConfig, auth_token: str):
self.model = model
super().__init__(
model=model,
auth_token=auth_token,
Expand Down Expand Up @@ -319,6 +320,7 @@ class IGEL(Generator):
"""

def __init__(self, model, auth_token=None):
self.model = model
super().__init__(
model=model,
temperature=1.0,
Expand All @@ -342,7 +344,7 @@ def prompt(self, prompt: str):
}

response = requests.post(
"https://modelhub-gpu.brdata-dev.de/v1/prompt", headers=headers,
os.environ.get("IGEL_URL", "https://modelhub-gpu.brdata-dev.de/v1/prompt"), headers=headers,
json=data
)

Expand Down

0 comments on commit 84ed146

Please sign in to comment.