@@ -2,14 +2,30 @@ package io.cequence.openaiscala.anthropic.service
22
33import akka .NotUsed
44import akka .stream .scaladsl .Source
5- import io .cequence .openaiscala .anthropic .domain .Message
5+ import akka .util .ByteString
6+ import io .cequence .openaiscala .anthropic .domain .{
7+ FileDeleteResponse ,
8+ FileListResponse ,
9+ FileMetadata ,
10+ Message
11+ }
612import io .cequence .openaiscala .anthropic .domain .response .{
713 ContentBlockDelta ,
814 CreateMessageResponse
915}
1016import io .cequence .openaiscala .anthropic .domain .settings .AnthropicCreateMessageSettings
17+ import io .cequence .openaiscala .anthropic .domain .skills .{
18+ DeleteSkillResponse ,
19+ DeleteSkillVersionResponse ,
20+ ListSkillVersionsResponse ,
21+ ListSkillsResponse ,
22+ Skill ,
23+ SkillSource ,
24+ SkillVersion
25+ }
1126import io .cequence .wsclient .service .CloseableService
1227
28+ import java .io .File
1329import scala .concurrent .Future
1430
1531trait AnthropicService extends CloseableService with AnthropicServiceConsts {
@@ -57,4 +73,255 @@ trait AnthropicService extends CloseableService with AnthropicServiceConsts {
5773 messages : Seq [Message ],
5874 settings : AnthropicCreateMessageSettings = DefaultSettings .CreateMessage
5975 ): Source [ContentBlockDelta , NotUsed ]
76+
77+ /**
78+ * Creates a custom skill.
79+ *
80+ * Skills allow you to define custom tools and behaviors that Claude can use. All files must
81+ * be in the same top-level directory and must include a SKILL.md file at the root of that
82+ * directory.
83+ *
84+ * @param displayTitle
85+ * Display title for the skill. This is a human-readable label that is not included in the
86+ * prompt sent to the model.
87+ * @param files
88+ * Files to upload for the skill as tuples of (File, filename). The filename should include
89+ * the directory structure, e.g., "skill-name/SKILL.md". All files must be in the same
90+ * top-level directory and must include a SKILL.md file at the root of that directory.
91+ * @return
92+ * The created skill
93+ * @see
94+ * <a href="https://docs.claude.com/en/api/skills/create-skill">Anthropic Skills Doc</a>
95+ */
96+ def createSkill (
97+ displayTitle : Option [String ] = None ,
98+ files : Seq [(File , String )]
99+ ): Future [Skill ]
100+
101+ /**
102+ * Lists all skills.
103+ *
104+ * Retrieves a paginated list of all skills in your workspace.
105+ *
106+ * @param page
107+ * Pagination token for fetching a specific page of results. Pass the value from a previous
108+ * response's next_page field to get the next page of results.
109+ * @param limit
110+ * Number of results to return per page. Maximum value is 100. Defaults to 20.
111+ * @param source
112+ * Filter skills by source. If provided, only skills from the specified source will be
113+ * returned: "custom" for user-created skills or "anthropic" for Anthropic-created skills.
114+ * @return
115+ * List of skills with pagination information
116+ * @see
117+ * <a href="https://docs.claude.com/en/api/skills/list-skills">Anthropic Skills Doc</a>
118+ */
119+ def listSkills (
120+ page : Option [String ] = None ,
121+ limit : Option [Int ] = None ,
122+ source : Option [SkillSource ] = None
123+ ): Future [ListSkillsResponse ]
124+
125+ /**
126+ * Retrieves a specific skill by ID.
127+ *
128+ * @param skillId
129+ * Unique identifier for the skill.
130+ * @return
131+ * The skill object
132+ * @see
133+ * <a href="https://docs.claude.com/en/api/skills/get-skill">Anthropic Skills Doc</a>
134+ */
135+ def getSkill (skillId : String ): Future [Skill ]
136+
137+ /**
138+ * Deletes a custom skill.
139+ *
140+ * Only custom skills (created by the user) can be deleted. Anthropic-created skills cannot
141+ * be deleted.
142+ *
143+ * @param skillId
144+ * Unique identifier for the skill to delete.
145+ * @return
146+ * Confirmation of deletion
147+ * @see
148+ * <a href="https://docs.claude.com/en/api/skills/delete-skill">Anthropic Skills Doc</a>
149+ */
150+ def deleteSkill (skillId : String ): Future [DeleteSkillResponse ]
151+
152+ /**
153+ * Creates a new version of an existing skill.
154+ *
155+ * Creates a new version of a skill by uploading files. All files must be in the same
156+ * top-level directory and must include a SKILL.md file at the root of that directory.
157+ *
158+ * @param skillId
159+ * Unique identifier for the skill to create a new version for.
160+ * @param files
161+ * Files to upload for the skill version as tuples of (File, filename). The filename should
162+ * include the directory structure, e.g., "skill-name/SKILL.md". All files must be in the
163+ * same top-level directory and must include a SKILL.md file at the root of that directory.
164+ * @return
165+ * The created skill version
166+ * @see
167+ * <a href="https://docs.claude.com/en/api/skills/create-skill-version">Anthropic Skills
168+ * Doc</a>
169+ */
170+ def createSkillVersion (
171+ skillId : String ,
172+ files : Seq [(File , String )]
173+ ): Future [SkillVersion ]
174+
175+ /**
176+ * Lists all versions of a skill.
177+ *
178+ * Retrieves a paginated list of all versions for a specific skill. Skills can have multiple
179+ * versions, each identified by a Unix epoch timestamp. The list is sorted in reverse
180+ * chronological order, with the most recent version first.
181+ *
182+ * @param skillId
183+ * Unique identifier for the skill whose versions should be retrieved.
184+ * @param page
185+ * Pagination token for fetching a specific page of results. Pass the value from a previous
186+ * response's next_page field to get the next page of results.
187+ * @param limit
188+ * Number of results to return per page. Maximum value is 100. Defaults to 20.
189+ * @return
190+ * List of skill versions with pagination information
191+ * @see
192+ * <a href="https://docs.claude.com/en/api/skills/list-skill-versions">Anthropic Skills
193+ * Doc</a>
194+ */
195+ def listSkillVersions (
196+ skillId : String ,
197+ page : Option [String ] = None ,
198+ limit : Option [Int ] = None
199+ ): Future [ListSkillVersionsResponse ]
200+
201+ /**
202+ * Retrieves a specific version of a skill.
203+ *
204+ * @param skillId
205+ * Unique identifier for the skill.
206+ * @param version
207+ * Version identifier for the skill. Each version is identified by a Unix epoch timestamp
208+ * (e.g., "1759178010641129").
209+ * @return
210+ * The skill version object
211+ * @see
212+ * <a href="https://docs.claude.com/en/api/skills/get-skill-version">Anthropic Skills
213+ * Doc</a>
214+ */
215+ def getSkillVersion (
216+ skillId : String ,
217+ version : String
218+ ): Future [SkillVersion ]
219+
220+ /**
221+ * Deletes a specific version of a skill.
222+ *
223+ * Only custom skill versions (created by the user) can be deleted. Anthropic-created skill
224+ * versions cannot be deleted.
225+ *
226+ * @param skillId
227+ * Unique identifier for the skill.
228+ * @param version
229+ * Version identifier for the skill. Each version is identified by a Unix epoch timestamp
230+ * (e.g., "1759178010641129").
231+ * @return
232+ * Confirmation of deletion
233+ * @see
234+ * <a href="https://docs.claude.com/en/api/skills/delete-skill-version">Anthropic Skills
235+ * Doc</a>
236+ */
237+ def deleteSkillVersion (
238+ skillId : String ,
239+ version : String
240+ ): Future [DeleteSkillVersionResponse ]
241+
242+ /**
243+ * Uploads a file.
244+ *
245+ * Upload a file that can be referenced in messages.
246+ *
247+ * @param file
248+ * The file to upload.
249+ * @param filename
250+ * Optional custom filename to use instead of the file's actual name.
251+ * @return
252+ * Metadata for the uploaded file
253+ * @see
254+ * <a href="https://docs.anthropic.com/en/api/files">Anthropic Files Doc</a>
255+ */
256+ def createFile (
257+ file : File ,
258+ filename : Option [String ] = None
259+ ): Future [FileMetadata ]
260+
261+ /**
262+ * Lists files within a workspace.
263+ *
264+ * Retrieves a paginated list of all files in your workspace.
265+ *
266+ * @param beforeId
267+ * ID of the object to use as a cursor for pagination. When provided, returns the page of
268+ * results immediately before this object.
269+ * @param afterId
270+ * ID of the object to use as a cursor for pagination. When provided, returns the page of
271+ * results immediately after this object.
272+ * @param limit
273+ * Number of items to return per page. Defaults to 20. Ranges from 1 to 1000.
274+ * @return
275+ * List of files with pagination information
276+ * @see
277+ * <a href="https://docs.claude.com/en/api/files-list">Anthropic Files Doc</a>
278+ */
279+ def listFiles (
280+ beforeId : Option [String ] = None ,
281+ afterId : Option [String ] = None ,
282+ limit : Option [Int ] = None
283+ ): Future [FileListResponse ]
284+
285+ /**
286+ * Retrieves metadata for a specific file.
287+ *
288+ * Returns metadata information about a file identified by its ID. Returns None if the file
289+ * is not found.
290+ *
291+ * @param fileId
292+ * ID of the file.
293+ * @return
294+ * File metadata if found, None otherwise
295+ * @see
296+ * <a href="https://docs.claude.com/en/api/files-metadata">Anthropic Files Doc</a>
297+ */
298+ def getFileMetadata (fileId : String ): Future [Option [FileMetadata ]]
299+
300+ /**
301+ * Downloads the contents of a Claude generated file.
302+ *
303+ * Returns the binary content of a file. Returns None if the file is not found.
304+ *
305+ * @param fileId
306+ * ID of the file to download.
307+ * @return
308+ * File content as byte stream if found, None otherwise
309+ * @see
310+ * <a href="https://docs.claude.com/en/api/files-content">Anthropic Files Doc</a>
311+ */
312+ def downloadFile (fileId : String ): Future [Option [Source [ByteString , _]]]
313+
314+ /**
315+ * Deletes a file.
316+ *
317+ * Makes a file inaccessible through the API.
318+ *
319+ * @param fileId
320+ * ID of the file to delete.
321+ * @return
322+ * Confirmation of deletion with the file ID
323+ * @see
324+ * <a href="https://docs.anthropic.com/en/api/files">Anthropic Files Doc</a>
325+ */
326+ def deleteFile (fileId : String ): Future [FileDeleteResponse ]
60327}
0 commit comments