Skip to content

Commit

Permalink
OpenAIService - support for after and limit for listFineTuneEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbanda committed Sep 29, 2023
1 parent b017da2 commit 37d8bac
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,16 @@ private trait OpenAIServiceImpl extends OpenAICoreServiceImpl with OpenAIService
).map(response => handleNotFoundAndError(response).map(_.asSafe[FineTuneJob]))

override def listFineTuneEvents(
fineTuneId: String
fineTuneId: String,
after: Option[String] = None,
limit: Option[Int] = None
): Future[Option[Seq[FineTuneEvent]]] =
execGETWithStatus(
EndPoint.fine_tunes,
endPointParam = Some(s"$fineTuneId/events"),
params = Seq(
Param.after -> after,
Param.limit -> limit,
Param.stream -> Some(false) // TODO: is streaming still supported?
)
).map { response =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ trait OpenAIService extends OpenAICoreService {
* image response (might contain multiple data items - one per image)
*
* @see
* <a href="https://platform.openai.com/docs/api-reference/images/create-edit">OpenAI
* Doc</a>
* <a https://platform.openai.com/docs/api-reference/images/createEdit">OpenAI Doc</a>
*/
def createImageEdit(
prompt: String,
Expand All @@ -144,7 +143,7 @@ trait OpenAIService extends OpenAICoreService {
* image response (might contain multiple data items - one per image)
*
* @see
* <a href="https://platform.openai.com/docs/api-reference/images/create-variation">OpenAI
* <a href="https://platform.openai.com/docs/api-reference/images/createVariation">OpenAI
* Doc</a>
*/
def createImageVariation(
Expand Down Expand Up @@ -375,11 +374,10 @@ trait OpenAIService extends OpenAICoreService {
* <a href="https://platform.openai.com/docs/api-reference/fine-tuning/list-events">OpenAI
* Doc</a>
*/
// TODO: add pagination: after: Option[String], limit: Option[Int]
def listFineTuneEvents(
fineTuneId: String
// after: Option[String] = None,
// limit: Option[Int] = None
fineTuneId: String,
after: Option[String] = None,
limit: Option[Int] = None
): Future[Option[Seq[FineTuneEvent]]]

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ trait OpenAIServiceWrapper extends OpenAIService {
)

override def listFineTuneEvents(
fineTuneId: String
fineTuneId: String,
after: Option[String],
limit: Option[Int]
): Future[Option[Seq[FineTuneEvent]]] = wrap(
_.listFineTuneEvents(fineTuneId)
_.listFineTuneEvents(fineTuneId, after, limit)
)

override def deleteFineTuneModel(
Expand Down

0 comments on commit 37d8bac

Please sign in to comment.