Skip to content

Commit 4f3da56

Browse files
committed
Release 0.8.0b13
1 parent 340c853 commit 4f3da56

28 files changed

+2409
-404
lines changed

README.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,95 @@ except ApiError as e:
117117
print(e.body)
118118
```
119119

120+
## Streaming
121+
122+
The SDK supports streaming responses, as well, the response will be a generator that you can loop over.
123+
124+
```python
125+
from humanloop import Humanloop
126+
127+
client = Humanloop(
128+
api_key="YOUR_API_KEY",
129+
)
130+
response = client.prompts.call_stream(
131+
version_id="string",
132+
environment="string",
133+
path="string",
134+
id="string",
135+
messages=[
136+
{
137+
"content": "string",
138+
"name": "string",
139+
"tool_call_id": "string",
140+
"role": "user",
141+
"tool_calls": [
142+
{
143+
"id": "string",
144+
"type": "function",
145+
"function": {
146+
"name": "string",
147+
"arguments": {"key": "value"},
148+
},
149+
}
150+
],
151+
}
152+
],
153+
prompt={
154+
"model": "string",
155+
"endpoint": "complete",
156+
"template": "string",
157+
"provider": "openai",
158+
"max_tokens": 1,
159+
"temperature": 1.1,
160+
"top_p": 1.1,
161+
"stop": "string",
162+
"presence_penalty": 1.1,
163+
"frequency_penalty": 1.1,
164+
"other": {"string": {"key": "value"}},
165+
"seed": 1,
166+
"response_format": {
167+
"type": "json_object",
168+
"json_schema": {"string": {"key": "value"}},
169+
},
170+
"tools": [
171+
{
172+
"name": "string",
173+
"description": "string",
174+
"strict": {"key": "value"},
175+
"parameters": {"key": "value"},
176+
}
177+
],
178+
"linked_tools": ["string"],
179+
"attributes": {"string": {"key": "value"}},
180+
},
181+
inputs={"string": {"key": "value"}},
182+
source="string",
183+
metadata={"string": {"key": "value"}},
184+
session_id="string",
185+
parent_id="string",
186+
source_datapoint_id="string",
187+
batches=["string"],
188+
user="string",
189+
prompts_call_stream_request_environment="string",
190+
save=True,
191+
provider_api_keys={
192+
"openai": "string",
193+
"ai_21": "string",
194+
"mock": "string",
195+
"anthropic": "string",
196+
"cohere": "string",
197+
"openai_azure": "string",
198+
"openai_azure_endpoint": "string",
199+
},
200+
num_samples=1,
201+
return_inputs=True,
202+
logprobs=1,
203+
suffix="string",
204+
)
205+
for chunk in response:
206+
yield chunk
207+
```
208+
120209
## Pagination
121210

122211
Paginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the underlying object.

poetry.lock

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "humanloop"
3-
version = "0.8.0b12"
3+
version = "0.8.0b13"
44
description = ""
55
readme = "README.md"
66
authors = []
@@ -33,6 +33,7 @@ Repository = 'https://github.com/humanloop/humanloop-python-beta'
3333
[tool.poetry.dependencies]
3434
python = "^3.8"
3535
httpx = ">=0.21.2"
36+
httpx-sse = "0.4.0"
3637
pydantic = ">= 1.9.2"
3738
pydantic-core = "^2.18.2"
3839
typing_extensions = ">= 4.0.0"

0 commit comments

Comments
 (0)