Skip to content

Commit ffcbf3b

Browse files
committed
[0.5.13] house keeping on tuneapi
1 parent 0e55110 commit ffcbf3b

File tree

6 files changed

+27
-18
lines changed

6 files changed

+27
-18
lines changed

docs/changelog.rst

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

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

10+
0.5.13
11+
-----
12+
13+
- ``tuneapi.types.ModelInterface`` has an ``extra_headers`` attribute in it.
14+
15+
0.5.12
16+
-----
17+
18+
- Remove code to sanitize assistant message in for Tune and OpenAI LLM APIs.
19+
20+
0.5.11
21+
-----
22+
23+
- Fix bug where ``parallel_tool_calls`` was sent even for non tool calls.
24+
1025
0.5.10
1126
-----
1227

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.10"
16+
release = "0.5.13"
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.10"
3+
version = "0.5.13"
44
description = "Tune AI APIs."
55
authors = ["Frello Technology Private Limited <[email protected]>"]
66
license = "MIT"

tuneapi/apis/model_openai.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,7 @@ def _process_input(self, chats, token: Optional[str] = None):
4848
elif m.role == tt.Message.HUMAN:
4949
final_messages.append({"role": "user", "content": m.value})
5050
elif m.role == tt.Message.GPT:
51-
final_messages.append(
52-
{
53-
"role": "assistant",
54-
"content": m.value.strip(),
55-
}
56-
)
51+
final_messages.append({"role": "assistant", "content": m.value})
5752
elif m.role == tt.Message.FUNCTION_CALL:
5853
_m = tu.from_json(m.value) if isinstance(m.value, str) else m.value
5954
final_messages.append(
@@ -97,7 +92,7 @@ def chat(
9792
self,
9893
chats: tt.Thread | str,
9994
model: Optional[str] = None,
100-
max_tokens: int = 1024,
95+
max_tokens: int = None,
10196
temperature: float = 1,
10297
parallel_tool_calls: bool = False,
10398
token: Optional[str] = None,
@@ -126,7 +121,7 @@ def stream_chat(
126121
self,
127122
chats: tt.Thread | str,
128123
model: Optional[str] = None,
129-
max_tokens: int = 1024,
124+
max_tokens: int = None,
130125
temperature: float = 1,
131126
parallel_tool_calls: bool = False,
132127
token: Optional[str] = None,
@@ -144,13 +139,14 @@ def stream_chat(
144139
"messages": messages,
145140
"model": model or self.model_id,
146141
"stream": True,
147-
"max_tokens": max_tokens,
148-
"parallel_tool_calls": parallel_tool_calls,
149142
}
143+
if max_tokens:
144+
data["max_tokens"] = max_tokens
150145
if isinstance(chats, tt.Thread) and len(chats.tools):
151146
data["tools"] = [
152147
{"type": "function", "function": x.to_dict()} for x in chats.tools
153148
]
149+
data["parallel_tool_calls"] = parallel_tool_calls
154150
if debug:
155151
fp = "sample_oai.json"
156152
print("Saving at path " + fp)

tuneapi/apis/model_tune.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,7 @@ def _process_input(self, chats, token: Optional[str] = None):
6464
elif m.role == tt.Message.HUMAN:
6565
final_messages.append({"role": "user", "content": m.value})
6666
elif m.role == tt.Message.GPT:
67-
final_messages.append(
68-
{
69-
"role": "assistant",
70-
"content": m.value.strip(),
71-
}
72-
)
67+
final_messages.append({"role": "assistant", "content": m.value})
7368
elif m.role == tt.Message.FUNCTION_CALL:
7469
_m = tu.from_json(m.value) if isinstance(m.value, str) else m.value
7570
final_messages.append(

tuneapi/types/chats.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ class ModelInterface:
305305
api_token: str
306306
"""This is the API token for the model"""
307307

308+
extra_headers: Dict[str, Any]
309+
"""This is the placeholder for any extra headers to be passed during request"""
310+
308311
def set_api_token(self, token: str) -> None:
309312
"""This are used to set the API token for the model"""
310313
raise NotImplementedError("This model has no operation for this.")

0 commit comments

Comments
 (0)