Skip to content

Commit

Permalink
follow redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
0thernet committed May 6, 2024
1 parent 654f226 commit 67d9aaa
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ dist
.pypirc

examples/notebooks/scratch.py
examples/scratch.py
examples/scratch*.py
20 changes: 11 additions & 9 deletions examples/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@
if api_key is None:
raise EnvironmentError("No SUBSTRATE_API_KEY set")

from substrate import Substrate, GenerateText, sb
from substrate import Substrate, TranscribeMedia

substrate = Substrate(api_key=api_key)
substrate = Substrate(api_key=api_key, timeout=60 * 5)

story = GenerateText({"prompt": "tell me a story"})
transcribe = TranscribeMedia({"audio_uri": "s3://"})

summary = GenerateText({"prompt": sb.concat("summarize this story in one sentence: ", story.future.text)})
# summary = GenerateText({"prompt": sb.concat("summarize this story in one sentence: ", story.future.text)})

response = substrate.run(story, summary)
response = substrate.run(transcribe)
print(response.api_response.json)
print(response.api_response.status_code)

summary_out = response.get(summary)
print(summary_out.text)
# summary_out = response.get(summary)
# print(summary_out.text)

viz = Substrate.visualize(story, summary)
print(viz)
# viz = Substrate.visualize(ry)
# print(viz)
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 = "poetry.core.masonry.api"

[tool.poetry]
name = "substrate"
version = "120240502.0.0"
version = "120240502.0.1"
description = "Substrate Python SDK"
readme = "README.md"
authors = [ "vprtwn <[email protected]>", "liamgriffiths <[email protected]>",]
Expand Down
2 changes: 1 addition & 1 deletion scripts/sync_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def ok(message):
print("\033[32m✓\033[0m", message)


SDK_VERSION = "1.0.0"
SDK_VERSION = "1.0.1"

# Update version
version_path = "substrate/GEN_VERSION"
Expand Down
4 changes: 2 additions & 2 deletions substrate/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ def __init__(
self._base_url = base_url
self._backend = backend
self._additional_headers = additional_headers
self._client = httpx.Client(timeout=timeout)
self._async_client = httpx.AsyncClient(timeout=timeout)
self._client = httpx.Client(timeout=timeout, follow_redirects=True)
self._async_client = httpx.AsyncClient(timeout=timeout, follow_redirects=True)
self._version = __version__

@property
Expand Down

0 comments on commit 67d9aaa

Please sign in to comment.