@@ -15,6 +15,7 @@ import com.langchain.smith.core.checkKnown
1515import com.langchain.smith.core.checkRequired
1616import com.langchain.smith.core.toImmutable
1717import com.langchain.smith.errors.LangChainInvalidDataException
18+ import com.langchain.smith.models.runs.RunTypeEnum
1819import java.time.OffsetDateTime
1920import java.util.Collections
2021import java.util.Objects
@@ -30,7 +31,7 @@ private constructor(
3031 private val dottedOrder: JsonField <String >,
3132 private val name: JsonField <String >,
3233 private val queueRunId: JsonField <String >,
33- private val runType: JsonField <RunType >,
34+ private val runType: JsonField <RunTypeEnum >,
3435 private val sessionId: JsonField <String >,
3536 private val status: JsonField <String >,
3637 private val traceId: JsonField <String >,
@@ -98,7 +99,9 @@ private constructor(
9899 @JsonProperty(" queue_run_id" )
99100 @ExcludeMissing
100101 queueRunId: JsonField <String > = JsonMissing .of(),
101- @JsonProperty(" run_type" ) @ExcludeMissing runType: JsonField <RunType > = JsonMissing .of(),
102+ @JsonProperty(" run_type" )
103+ @ExcludeMissing
104+ runType: JsonField <RunTypeEnum > = JsonMissing .of(),
102105 @JsonProperty(" session_id" ) @ExcludeMissing sessionId: JsonField <String > = JsonMissing .of(),
103106 @JsonProperty(" status" ) @ExcludeMissing status: JsonField <String > = JsonMissing .of(),
104107 @JsonProperty(" trace_id" ) @ExcludeMissing traceId: JsonField <String > = JsonMissing .of(),
@@ -331,7 +334,7 @@ private constructor(
331334 * @throws LangChainInvalidDataException if the JSON field has an unexpected type or is
332335 * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
333336 */
334- fun runType (): RunType = runType.getRequired(" run_type" )
337+ fun runType (): RunTypeEnum = runType.getRequired(" run_type" )
335338
336339 /* *
337340 * @throws LangChainInvalidDataException if the JSON field has an unexpected type or is
@@ -705,7 +708,7 @@ private constructor(
705708 *
706709 * Unlike [runType], this method doesn't throw if the JSON field has an unexpected type.
707710 */
708- @JsonProperty(" run_type" ) @ExcludeMissing fun _runType (): JsonField <RunType > = runType
711+ @JsonProperty(" run_type" ) @ExcludeMissing fun _runType (): JsonField <RunTypeEnum > = runType
709712
710713 /* *
711714 * Returns the raw JSON value of [sessionId].
@@ -1195,7 +1198,7 @@ private constructor(
11951198 private var dottedOrder: JsonField <String >? = null
11961199 private var name: JsonField <String >? = null
11971200 private var queueRunId: JsonField <String >? = null
1198- private var runType: JsonField <RunType >? = null
1201+ private var runType: JsonField <RunTypeEnum >? = null
11991202 private var sessionId: JsonField <String >? = null
12001203 private var status: JsonField <String >? = null
12011204 private var traceId: JsonField <String >? = null
@@ -1373,15 +1376,16 @@ private constructor(
13731376 fun queueRunId (queueRunId : JsonField <String >) = apply { this .queueRunId = queueRunId }
13741377
13751378 /* * Enum for run types. */
1376- fun runType (runType : RunType ) = runType(JsonField .of(runType))
1379+ fun runType (runType : RunTypeEnum ) = runType(JsonField .of(runType))
13771380
13781381 /* *
13791382 * Sets [Builder.runType] to an arbitrary JSON value.
13801383 *
1381- * You should usually call [Builder.runType] with a well-typed [RunType] value instead. This
1382- * method is primarily for setting the field to an undocumented or not yet supported value.
1384+ * You should usually call [Builder.runType] with a well-typed [RunTypeEnum] value instead.
1385+ * This method is primarily for setting the field to an undocumented or not yet supported
1386+ * value.
13831387 */
1384- fun runType (runType : JsonField <RunType >) = apply { this .runType = runType }
1388+ fun runType (runType : JsonField <RunTypeEnum >) = apply { this .runType = runType }
13851389
13861390 fun sessionId (sessionId : String ) = sessionId(JsonField .of(sessionId))
13871391
@@ -2539,164 +2543,6 @@ private constructor(
25392543 (if (traceUpgrade.asKnown().isPresent) 1 else 0 ) +
25402544 (if (ttlSeconds.asKnown().isPresent) 1 else 0 )
25412545
2542- /* * Enum for run types. */
2543- class RunType @JsonCreator private constructor(private val value : JsonField <String >) : Enum {
2544-
2545- /* *
2546- * Returns this class instance's raw value.
2547- *
2548- * This is usually only useful if this instance was deserialized from data that doesn't
2549- * match any known member, and you want to know that value. For example, if the SDK is on an
2550- * older version than the API, then the API may respond with new members that the SDK is
2551- * unaware of.
2552- */
2553- @com.fasterxml.jackson.annotation.JsonValue fun _value (): JsonField <String > = value
2554-
2555- companion object {
2556-
2557- @JvmField val TOOL = of(" tool" )
2558-
2559- @JvmField val CHAIN = of(" chain" )
2560-
2561- @JvmField val LLM = of(" llm" )
2562-
2563- @JvmField val RETRIEVER = of(" retriever" )
2564-
2565- @JvmField val EMBEDDING = of(" embedding" )
2566-
2567- @JvmField val PROMPT = of(" prompt" )
2568-
2569- @JvmField val PARSER = of(" parser" )
2570-
2571- @JvmStatic fun of (value : String ) = RunType (JsonField .of(value))
2572- }
2573-
2574- /* * An enum containing [RunType]'s known values. */
2575- enum class Known {
2576- TOOL ,
2577- CHAIN ,
2578- LLM ,
2579- RETRIEVER ,
2580- EMBEDDING ,
2581- PROMPT ,
2582- PARSER ,
2583- }
2584-
2585- /* *
2586- * An enum containing [RunType]'s known values, as well as an [_UNKNOWN] member.
2587- *
2588- * An instance of [RunType] can contain an unknown value in a couple of cases:
2589- * - It was deserialized from data that doesn't match any known member. For example, if the
2590- * SDK is on an older version than the API, then the API may respond with new members that
2591- * the SDK is unaware of.
2592- * - It was constructed with an arbitrary value using the [of] method.
2593- */
2594- enum class Value {
2595- TOOL ,
2596- CHAIN ,
2597- LLM ,
2598- RETRIEVER ,
2599- EMBEDDING ,
2600- PROMPT ,
2601- PARSER ,
2602- /* * An enum member indicating that [RunType] was instantiated with an unknown value. */
2603- _UNKNOWN ,
2604- }
2605-
2606- /* *
2607- * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
2608- * if the class was instantiated with an unknown value.
2609- *
2610- * Use the [known] method instead if you're certain the value is always known or if you want
2611- * to throw for the unknown case.
2612- */
2613- fun value (): Value =
2614- when (this ) {
2615- TOOL -> Value .TOOL
2616- CHAIN -> Value .CHAIN
2617- LLM -> Value .LLM
2618- RETRIEVER -> Value .RETRIEVER
2619- EMBEDDING -> Value .EMBEDDING
2620- PROMPT -> Value .PROMPT
2621- PARSER -> Value .PARSER
2622- else -> Value ._UNKNOWN
2623- }
2624-
2625- /* *
2626- * Returns an enum member corresponding to this class instance's value.
2627- *
2628- * Use the [value] method instead if you're uncertain the value is always known and don't
2629- * want to throw for the unknown case.
2630- *
2631- * @throws LangChainInvalidDataException if this class instance's value is a not a known
2632- * member.
2633- */
2634- fun known (): Known =
2635- when (this ) {
2636- TOOL -> Known .TOOL
2637- CHAIN -> Known .CHAIN
2638- LLM -> Known .LLM
2639- RETRIEVER -> Known .RETRIEVER
2640- EMBEDDING -> Known .EMBEDDING
2641- PROMPT -> Known .PROMPT
2642- PARSER -> Known .PARSER
2643- else -> throw LangChainInvalidDataException (" Unknown RunType: $value " )
2644- }
2645-
2646- /* *
2647- * Returns this class instance's primitive wire representation.
2648- *
2649- * This differs from the [toString] method because that method is primarily for debugging
2650- * and generally doesn't throw.
2651- *
2652- * @throws LangChainInvalidDataException if this class instance's value does not have the
2653- * expected primitive type.
2654- */
2655- fun asString (): String =
2656- _value ().asString().orElseThrow {
2657- LangChainInvalidDataException (" Value is not a String" )
2658- }
2659-
2660- private var validated: Boolean = false
2661-
2662- fun validate (): RunType = apply {
2663- if (validated) {
2664- return @apply
2665- }
2666-
2667- known()
2668- validated = true
2669- }
2670-
2671- fun isValid (): Boolean =
2672- try {
2673- validate()
2674- true
2675- } catch (e: LangChainInvalidDataException ) {
2676- false
2677- }
2678-
2679- /* *
2680- * Returns a score indicating how many valid values are contained in this object
2681- * recursively.
2682- *
2683- * Used for best match union deserialization.
2684- */
2685- @JvmSynthetic internal fun validity (): Int = if (value() == Value ._UNKNOWN ) 0 else 1
2686-
2687- override fun equals (other : Any? ): Boolean {
2688- if (this == = other) {
2689- return true
2690- }
2691-
2692- return other is RunType && value == other.value
2693- }
2694-
2695- override fun hashCode () = value.hashCode()
2696-
2697- override fun toString () = value.toString()
2698- }
2699-
27002546 class CompletionCostDetails
27012547 @JsonCreator
27022548 private constructor (
0 commit comments