Assistant API

Call the assistant API

import io.github.quafadas.dairect.*
import cats.effect.IO

val (assistantApi,_) = AssistantApi.defaultAuthLogToFileAddHeader(fs2.io.file.Path("assistant.txt")).allocated.Ø
// assistantApi: AssistantApi = io.github.quafadas.dairect.AssistantApi$proxy$1@3cee1012
val allAssisants = assistantApi.list().Ø
// allAssisants: AssistantList = AssistantList(
//   object = "list",
//   data = List(
//     Assistant(
//       id = "asst_vqkpVfU96n4roGEOz8NcPrsM",
//       object = "assistant",
//       created_at = 1724846262L,
//       name = None,
//       description = None,
//       model = "gpt-4o-mini",
//       instructions = None,
//       tools = List(
//         code_interpreter(),
//         file_search(file_search = AssistantFileSearch(max_num_results = None)),
//         function(
//           function = AssistantToolFunction(
//             name = "testy",
//             parameters = Some(
//               value = DObject(
//                 value = Map(
//                   "type" -> DString(value = "object"),
//                   "properties" -> DObject(
//                     value = Map(
//                       "price" -> DObject(value = Map("type" -> DString(value = "number")))
//                     )
//                   )
//                 )
//               )
//             ),
//             description = None,
//             strict = Some(value = false)
//           )
//         )
//       ),
//       tool_resources = Some(
//         value = ToolResources(
//           code_interpreter = Some(value = CodeInterpreter(file_ids = List())),
//           file_search = Some(
//             value = FileSearch(
//               vector_store_ids = Some(value = List()),
//               vector_stores = None
//             )
//           )
//         )
//       ),
//       metadata = Map(),
//       top_p = 1.0,
//       temperature = 1.0,
// ...
val first = assistantApi.getAssisstant(allAssisants.data.head.id).Ø
// first: Assistant = Assistant(
//   id = "asst_vqkpVfU96n4roGEOz8NcPrsM",
//   object = "assistant",
//   created_at = 1724846262L,
//   name = None,
//   description = None,
//   model = "gpt-4o-mini",
//   instructions = None,
//   tools = List(
//     code_interpreter(),
//     file_search(file_search = AssistantFileSearch(max_num_results = None)),
//     function(
//       function = AssistantToolFunction(
//         name = "testy",
//         parameters = Some(
//           value = DObject(
//             value = Map(
//               "type" -> DString(value = "object"),
//               "properties" -> DObject(
//                 value = Map(
//                   "price" -> DObject(value = Map("type" -> DString(value = "number")))
//                 )
//               )
//             )
//           )
//         ),
//         description = None,
//         strict = Some(value = false)
//       )
//     )
//   ),
//   tool_resources = Some(
//     value = ToolResources(
//       code_interpreter = Some(value = CodeInterpreter(file_ids = List())),
//       file_search = Some(
//         value = FileSearch(
//           vector_store_ids = Some(value = List()),
//           vector_stores = None
//         )
//       )
//     )
//   ),
//   metadata = Map(),
//   top_p = 1.0,
//   temperature = 1.0,
//   response_format = Auto(t = "auto")
// )

/**  Other API calls.

assistantApi.deleteAssisstant(first.data.id).Ø
assistantApi.create("gpt-4o-mini").Ø

**/
In this article