Skip to content

Commit 7f94e25

Browse files
authored
feat(api): add custom Skill management
Add typed synchronous and asynchronous Skill management, binary ZIP uploads, guarded revisions, and validated path parameters.
1 parent 12037dd commit 7f94e25

13 files changed

Lines changed: 1228 additions & 26 deletions

File tree

‎BUILD.bazel‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ bazel_py_test(
6969
"src",
7070
"typing_decisions.py",
7171
"typing_responses.py",
72+
"typing_skills.py",
7273
],
7374
data = [
7475
"pyproject.toml",
7576
"typing_decisions.py",
7677
"typing_responses.py",
78+
"typing_skills.py",
7779
"//src:perplexity",
7880
],
7981
deps = PYTHON_DEPS,

‎api.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,34 @@ Methods:
149149

150150
- <code title="post /v1/contextualizedembeddings">client.contextualized_embeddings.<a href="./src/perplexity/resources/contextualized_embeddings.py">create</a>(\*\*<a href="src/perplexity/types/contextualized_embedding_create_params.py">params</a>) -> <a href="./src/perplexity/types/contextualized_embedding_create_response.py">ContextualizedEmbeddingCreateResponse</a></code>
151151

152+
# Skills
153+
154+
Upload custom Skill ZIP bundles using bytes or `(filename, bytes, content_type)`.
155+
Updates and deletion require `expected_revision` set to the Skill's current
156+
`latest_revision`. List responses expose
157+
`next_page_token`; pass it as `page_token` to request another page.
158+
159+
```python
160+
skill = client.skills.create(file=("bundle.zip", zip_bytes, "application/zip"))
161+
page = client.skills.list(limit=20)
162+
skill = client.skills.retrieve(skill.skill_id)
163+
if skill.latest_revision is None:
164+
raise ValueError("A current revision is required to update")
165+
skill = client.skills.update(
166+
skill.skill_id,
167+
expected_revision=skill.latest_revision,
168+
file=("bundle.zip", zip_bytes, "application/zip"),
169+
)
170+
if skill.latest_revision is None:
171+
raise ValueError("A current revision is required to delete")
172+
revisions = client.skills.revisions.list(skill.skill_id)
173+
download = client.skills.download(skill.skill_id, revision=skill.latest_revision)
174+
client.skills.delete(skill.skill_id, expected_revision=skill.latest_revision)
175+
```
176+
177+
`download` returns a signed URL and revision; it does not fetch the ZIP.
178+
The same methods are available on `AsyncPerplexity`.
179+
152180
# Browser
153181

154182
## Sessions

0 commit comments

Comments
 (0)