-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Images Vision API * Updating timeout to 60 sec in ApiClient --------- Co-authored-by: Javi Pacheco <[email protected]>
- Loading branch information
1 parent
f338c03
commit 248771d
Showing
7 changed files
with
98 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
examples/src/main/kotlin/com/xebia/functional/xef/dsl/vision/VisionExample.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.xebia.functional.xef.dsl.vision | ||
|
||
import com.xebia.functional.xef.AI | ||
|
||
suspend fun main() { | ||
val images = AI.images() | ||
val stream = | ||
images.vision( | ||
prompt = "Describe the image in detail", | ||
url = "https://apod.nasa.gov/apod/image/2401/ngc1232b_vlt_960.jpg" | ||
) | ||
stream.collect(::print) | ||
} |
20 changes: 20 additions & 0 deletions
20
examples/src/main/kotlin/com/xebia/functional/xef/dsl/vision/VisionExample2ShotsFunction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.xebia.functional.xef.dsl.vision | ||
|
||
import com.xebia.functional.xef.AI | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ImageAnalysisResult( | ||
val topic: String, | ||
val description: String, | ||
) | ||
|
||
suspend fun main() { | ||
val images = AI.images() | ||
val result: ImageAnalysisResult = | ||
images.visionStructured( | ||
prompt = "Describe the image in detail", | ||
url = "https://apod.nasa.gov/apod/image/2401/ngc1232b_vlt_960.jpg" | ||
) | ||
println(result) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters