Skip to content

Commit c511289

Browse files
committed
[0.5.1] [fix] bug in endpoints module
1 parent 0923590 commit c511289

File tree

8 files changed

+25
-16
lines changed

8 files changed

+25
-16
lines changed

cookbooks/finetuning.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
"source": [
107107
"ft = te.FinetuningAPI(\n",
108108
" tune_api_key=\"xxxxx\",\n",
109-
" tune_org_id=\"e3365ae7-ceeb-425b-b983-1703e8456f76\",\n",
109+
" tune_org_id=\"yyyyy\", # ignore this if you don't have multiple orgs\n",
110110
")\n",
111111
"out = ft.upload_dataset(\n",
112112
" threads=threads,\n",

docs/changelog.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ minor versions.
77

88
All relevant steps to be taken will be mentioned here.
99

10+
0.5.1
11+
-----
12+
13+
- Fix bug in the endpoints module where error was raised despite correct inputs
14+
1015
0.5.0 **(breaking)**
1116
--------------------
1217

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
project = "tuneapi"
1414
copyright = "2024, Frello Technologies"
1515
author = "Frello Technologies"
16-
release = "0.5.0"
16+
release = "0.5.1"
1717

1818
# -- General configuration ---------------------------------------------------
1919
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "tuneapi"
3-
version = "0.5.0"
3+
version = "0.5.1"
44
description = "Tune AI APIs."
55
authors = ["Frello Technology Private Limited <[email protected]>"]
66
license = "MIT"

tuneapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Copyright © 2023- Frello Technology Private Limited
22

3-
__version__ = "0.5.0"
3+
__version__ = "0.5.1"

tuneapi/endpoints/assistants.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@ def __init__(
2323
self,
2424
tune_org_id: str = None,
2525
tune_api_key: str = None,
26-
base_url: str = "https://studio.tune.app/v1/assistants",
26+
base_url: str = "https://studio.tune.app/",
2727
):
2828
self.tune_org_id = tune_org_id or tu.ENV.TUNEORG_ID()
2929
self.tune_api_key = tune_api_key or tu.ENV.TUNEAPI_TOKEN()
3030
self.base_url = base_url
31-
if not tune_api_key:
31+
if not self.tune_api_key:
3232
raise ValueError("Either pass tune_api_key or set Env var TUNEAPI_TOKEN")
33-
self.sub = get_sub(base_url, self.tune_org_id, self.tune_api_key)
33+
self.sub = get_sub(
34+
base_url + "v1/assistants/", self.tune_org_id, self.tune_api_key
35+
)
3436

3537
def list_assistants(self, limit: int = 10, order: str = "desc"):
3638
out = self.sub(params={"limit": limit, "order": order})

tuneapi/endpoints/finetune.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(
3232
self.tune_org_id = tune_org_id or tu.ENV.TUNEORG_ID()
3333
self.tune_api_key = tune_api_key or tu.ENV.TUNEAPI_TOKEN()
3434
self.base_url = base_url
35-
if not tune_api_key:
35+
if not self.tune_api_key:
3636
raise ValueError("Either pass tune_api_key or set Env var TUNEAPI_TOKEN")
3737
self.sub = get_sub(
3838
base_url + "tune.Studio/", self.tune_org_id, self.tune_api_key

tuneapi/endpoints/threads.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ def __init__(
1919
self,
2020
tune_org_id: str = None,
2121
tune_api_key: str = None,
22-
base_url: str = "https://studio.tune.app/v1/threads",
22+
base_url: str = "https://studio.tune.app/",
2323
):
2424
self.tune_org_id = tune_org_id or tu.ENV.TUNEORG_ID()
2525
self.tune_api_key = tune_api_key or tu.ENV.TUNEAPI_TOKEN()
2626
self.base_url = base_url
27-
if not tune_api_key:
27+
if not self.tune_api_key:
2828
raise ValueError("Either pass tune_api_key or set Env var TUNEAPI_TOKEN")
29-
self.sub = get_sub(base_url, self.tune_org_id, self.tune_api_key)
29+
self.sub = get_sub(
30+
base_url + "v1/threads/", self.tune_org_id, self.tune_api_key
31+
)
3032

3133
def put_thread(self, thread: tt.Thread) -> tt.Thread:
3234
if not thread.title:
@@ -46,7 +48,7 @@ def put_thread(self, thread: tt.Thread) -> tt.Thread:
4648

4749
tu.logger.info("Creating new thread")
4850
print(tu.to_json(body))
49-
out = self.sub.threads("post", json=body)
51+
out = self.sub("post", json=body)
5052
thread.id = out["id"]
5153
return thread
5254

@@ -56,7 +58,7 @@ def get_thread(
5658
messages: bool = False,
5759
) -> tt.Thread:
5860
# GET /threads/{thread_id}
59-
fn = self.sub.threads.u(thread_id)
61+
fn = self.sub.u(thread_id)
6062
data = fn()
6163
meta = data.get("metadata", {})
6264
if meta == None:
@@ -74,7 +76,7 @@ def get_thread(
7476

7577
if messages:
7678
# GET /threads/{thread_id}/messages
77-
fn = self.sub.threads.u(thread_id).messages
79+
fn = self.sub.u(thread_id).messages
7880
data = fn()
7981
for m in data["data"]:
8082
text_items = list(filter(lambda x: x["type"] == "text", m["content"]))
@@ -101,7 +103,7 @@ def list_threads(
101103
dataset_id: Optional[str] = None,
102104
) -> List[tt.Thread]:
103105
# GET /threads
104-
fn = self.sub.threads
106+
fn = self.sub
105107
params = {
106108
"limit": limit,
107109
"order": order,
@@ -125,7 +127,7 @@ def list_threads(
125127

126128
def fill_thread_messages(self, thread: tt.Thread):
127129
# GET /threads/{thread_id}/messages
128-
fn = self.sub.threads.u(thread.id).messages
130+
fn = self.sub.u(thread.id).messages
129131
data = fn()
130132
for m in data["data"]:
131133
text_items = list(filter(lambda x: x["type"] == "text", m["content"]))

0 commit comments

Comments
 (0)