-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add support for structured output in OpenAI
- Loading branch information
Showing
18 changed files
with
310 additions
and
94 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
49 changes: 49 additions & 0 deletions
49
...eployment/src/main/java/io/quarkiverse/langchain4j/deployment/ObjectSubstitutionUtil.java
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,49 @@ | ||
package io.quarkiverse.langchain4j.deployment; | ||
|
||
import dev.langchain4j.model.chat.request.json.JsonArraySchema; | ||
import dev.langchain4j.model.chat.request.json.JsonBooleanSchema; | ||
import dev.langchain4j.model.chat.request.json.JsonEnumSchema; | ||
import dev.langchain4j.model.chat.request.json.JsonIntegerSchema; | ||
import dev.langchain4j.model.chat.request.json.JsonNumberSchema; | ||
import dev.langchain4j.model.chat.request.json.JsonObjectSchema; | ||
import dev.langchain4j.model.chat.request.json.JsonReferenceSchema; | ||
import dev.langchain4j.model.chat.request.json.JsonSchema; | ||
import dev.langchain4j.model.chat.request.json.JsonStringSchema; | ||
import io.quarkiverse.langchain4j.runtime.substitution.JsonArraySchemaObjectSubstitution; | ||
import io.quarkiverse.langchain4j.runtime.substitution.JsonBooleanSchemaObjectSubstitution; | ||
import io.quarkiverse.langchain4j.runtime.substitution.JsonEnumSchemaObjectSubstitution; | ||
import io.quarkiverse.langchain4j.runtime.substitution.JsonIntegerSchemaObjectSubstitution; | ||
import io.quarkiverse.langchain4j.runtime.substitution.JsonNumberSchemaObjectSubstitution; | ||
import io.quarkiverse.langchain4j.runtime.substitution.JsonObjectSchemaObjectSubstitution; | ||
import io.quarkiverse.langchain4j.runtime.substitution.JsonReferenceSchemaObjectSubstitution; | ||
import io.quarkiverse.langchain4j.runtime.substitution.JsonSchemaObjectSubstitution; | ||
import io.quarkiverse.langchain4j.runtime.substitution.JsonStringSchemaObjectSubstitution; | ||
import io.quarkus.deployment.recording.RecorderContext; | ||
|
||
final class ObjectSubstitutionUtil { | ||
|
||
private ObjectSubstitutionUtil() { | ||
} | ||
|
||
static void registerJsonSchema(RecorderContext recorderContext) { | ||
recorderContext.registerSubstitution(JsonSchema.class, JsonSchemaObjectSubstitution.Serialized.class, | ||
JsonSchemaObjectSubstitution.class); | ||
recorderContext.registerSubstitution(JsonArraySchema.class, JsonArraySchemaObjectSubstitution.Serialized.class, | ||
JsonArraySchemaObjectSubstitution.class); | ||
recorderContext.registerSubstitution(JsonBooleanSchema.class, JsonBooleanSchemaObjectSubstitution.Serialized.class, | ||
JsonBooleanSchemaObjectSubstitution.class); | ||
recorderContext.registerSubstitution(JsonEnumSchema.class, JsonEnumSchemaObjectSubstitution.Serialized.class, | ||
JsonEnumSchemaObjectSubstitution.class); | ||
recorderContext.registerSubstitution(JsonIntegerSchema.class, JsonIntegerSchemaObjectSubstitution.Serialized.class, | ||
JsonIntegerSchemaObjectSubstitution.class); | ||
recorderContext.registerSubstitution(JsonNumberSchema.class, JsonNumberSchemaObjectSubstitution.Serialized.class, | ||
JsonNumberSchemaObjectSubstitution.class); | ||
recorderContext.registerSubstitution(JsonObjectSchema.class, JsonObjectSchemaObjectSubstitution.Serialized.class, | ||
JsonObjectSchemaObjectSubstitution.class); | ||
recorderContext.registerSubstitution(JsonReferenceSchema.class, | ||
JsonReferenceSchemaObjectSubstitution.Serialized.class, | ||
JsonReferenceSchemaObjectSubstitution.class); | ||
recorderContext.registerSubstitution(JsonStringSchema.class, JsonStringSchemaObjectSubstitution.Serialized.class, | ||
JsonStringSchemaObjectSubstitution.class); | ||
} | ||
} |
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
Oops, something went wrong.