Skip to content

Commit

Permalink
Generalize naming support
Browse files Browse the repository at this point in the history
  • Loading branch information
rlazo committed Jan 31, 2024
1 parent 5a24830 commit 6430fa8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ internal class APIController(
* Models must be prepended with the `models/` prefix when communicating with the backend.
*/
private fun fullModelName(name: String): String =
name.takeIf { it.startsWith("models/") || it.startsWith("tunedModels/") } ?: "models/$name"
name.takeIf { it.contains("/") } ?: "models/$name"

/**
* Makes a POST request to the specified [url] and returns a [Flow] of deserialized response objects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ internal class ModelNamingTests(private val modelName: String, private val actua
fun data() =
listOf(
arrayOf("gemini-pro", "models/gemini-pro"),
arrayOf("x/gemini-pro", "models/x/gemini-pro"),
arrayOf("x/gemini-pro", "x/gemini-pro"),
arrayOf("models/gemini-pro", "models/gemini-pro"),
arrayOf("tunedModels/mymodel", "tunedModels/mymodel"),
arrayOf("tuneModels/mymodel", "models/tuneModels/mymodel"),
arrayOf("/modelname", "/modelname"),
arrayOf("modifiedNaming/mymodel", "modifiedNaming/mymodel"),
)
}
}

0 comments on commit 6430fa8

Please sign in to comment.