Class Model.Builder

java.lang.Object
com.langfuse.client.resources.commons.types.Model.Builder
All Implemented Interfaces:
Model._FinalStage, Model.CreatedAtStage, Model.IdStage, Model.IsLangfuseManagedStage, Model.MatchPatternStage, Model.ModelNameStage, Model.TokenizerConfigStage
Enclosing class:
Model

  • Method Details

    • from

      public Model.Builder from(Model other)
      Specified by:
      from in interface Model.IdStage
    • id

      public Model.ModelNameStage id(@NotNull String id)
      Specified by:
      id in interface Model.IdStage
    • modelName

      public Model.MatchPatternStage modelName(@NotNull String modelName)

      Name of the model definition. If multiple with the same name exist, they are applied in the following order: (1) custom over built-in, (2) newest according to startTime where model.startTime<observation.startTime

      Name of the model definition. If multiple with the same name exist, they are applied in the following order: (1) custom over built-in, (2) newest according to startTime where model.startTime<observation.startTime

      Specified by:
      modelName in interface Model.ModelNameStage
      Returns:
      Reference to this so that method calls can be chained together.
    • matchPattern

      public Model.TokenizerConfigStage matchPattern(@NotNull String matchPattern)

      Regex pattern which matches this model definition to generation.model. Useful in case of fine-tuned models. If you want to exact match, use (?i)^modelname$

      Regex pattern which matches this model definition to generation.model. Useful in case of fine-tuned models. If you want to exact match, use (?i)^modelname$

      Specified by:
      matchPattern in interface Model.MatchPatternStage
      Returns:
      Reference to this so that method calls can be chained together.
    • tokenizerConfig

      public Model.IsLangfuseManagedStage tokenizerConfig(Object tokenizerConfig)

      Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details.

      Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details.

      Specified by:
      tokenizerConfig in interface Model.TokenizerConfigStage
      Returns:
      Reference to this so that method calls can be chained together.
    • isLangfuseManaged

      public Model.CreatedAtStage isLangfuseManaged(boolean isLangfuseManaged)
      Specified by:
      isLangfuseManaged in interface Model.IsLangfuseManagedStage
    • createdAt

      public Model._FinalStage createdAt(@NotNull OffsetDateTime createdAt)

      Timestamp when the model was created

      Timestamp when the model was created

      Specified by:
      createdAt in interface Model.CreatedAtStage
      Returns:
      Reference to this so that method calls can be chained together.
    • addAllPricingTiers

      public Model._FinalStage addAllPricingTiers(List<PricingTier> pricingTiers)

      Array of pricing tiers with conditional pricing based on usage thresholds.

      Pricing tiers enable accurate cost tracking for models that charge different rates based on usage patterns (e.g., different rates for high-volume usage, large context windows, or cached tokens).

      Each model must have exactly one default tier (isDefault=true, priority=0) that serves as a fallback. Additional conditional tiers can be defined with specific matching criteria.

      If this array is empty, the model uses legacy flat pricing from the inputPrice/outputPrice/totalPrice fields.

      Specified by:
      addAllPricingTiers in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • addPricingTiers

      public Model._FinalStage addPricingTiers(PricingTier pricingTiers)

      Array of pricing tiers with conditional pricing based on usage thresholds.

      Pricing tiers enable accurate cost tracking for models that charge different rates based on usage patterns (e.g., different rates for high-volume usage, large context windows, or cached tokens).

      Each model must have exactly one default tier (isDefault=true, priority=0) that serves as a fallback. Additional conditional tiers can be defined with specific matching criteria.

      If this array is empty, the model uses legacy flat pricing from the inputPrice/outputPrice/totalPrice fields.

      Specified by:
      addPricingTiers in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • pricingTiers

      public Model._FinalStage pricingTiers(List<PricingTier> pricingTiers)

      Array of pricing tiers with conditional pricing based on usage thresholds.

      Pricing tiers enable accurate cost tracking for models that charge different rates based on usage patterns (e.g., different rates for high-volume usage, large context windows, or cached tokens).

      Each model must have exactly one default tier (isDefault=true, priority=0) that serves as a fallback. Additional conditional tiers can be defined with specific matching criteria.

      If this array is empty, the model uses legacy flat pricing from the inputPrice/outputPrice/totalPrice fields.

      Specified by:
      pricingTiers in interface Model._FinalStage
    • prices

      public Model._FinalStage prices(String key, ModelPrice value)

      Deprecated. Use 'pricingTiers' instead for models with usage-based pricing variations.

      This field shows prices by usage type from the default pricing tier. Maintained for backward compatibility. If the model uses tiered pricing, this field will be populated from the default tier's prices.

      Specified by:
      prices in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • putAllPrices

      public Model._FinalStage putAllPrices(Map<String,ModelPrice> prices)

      Deprecated. Use 'pricingTiers' instead for models with usage-based pricing variations.

      This field shows prices by usage type from the default pricing tier. Maintained for backward compatibility. If the model uses tiered pricing, this field will be populated from the default tier's prices.

      Specified by:
      putAllPrices in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • prices

      public Model._FinalStage prices(Map<String,ModelPrice> prices)

      Deprecated. Use 'pricingTiers' instead for models with usage-based pricing variations.

      This field shows prices by usage type from the default pricing tier. Maintained for backward compatibility. If the model uses tiered pricing, this field will be populated from the default tier's prices.

      Specified by:
      prices in interface Model._FinalStage
    • tokenizerId

      public Model._FinalStage tokenizerId(Nullable<String> tokenizerId)

      Optional. Tokenizer to be applied to observations which match to this model. See docs for more details.

      Specified by:
      tokenizerId in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • tokenizerId

      public Model._FinalStage tokenizerId(String tokenizerId)

      Optional. Tokenizer to be applied to observations which match to this model. See docs for more details.

      Specified by:
      tokenizerId in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • tokenizerId

      public Model._FinalStage tokenizerId(Optional<String> tokenizerId)

      Optional. Tokenizer to be applied to observations which match to this model. See docs for more details.

      Specified by:
      tokenizerId in interface Model._FinalStage
    • totalPrice

      public Model._FinalStage totalPrice(Nullable<Double> totalPrice)

      Deprecated. See 'prices' instead. Price (USD) per total unit. Cannot be set if input or output price is set.

      Specified by:
      totalPrice in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • totalPrice

      public Model._FinalStage totalPrice(Double totalPrice)

      Deprecated. See 'prices' instead. Price (USD) per total unit. Cannot be set if input or output price is set.

      Specified by:
      totalPrice in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • totalPrice

      public Model._FinalStage totalPrice(Optional<Double> totalPrice)

      Deprecated. See 'prices' instead. Price (USD) per total unit. Cannot be set if input or output price is set.

      Specified by:
      totalPrice in interface Model._FinalStage
    • outputPrice

      public Model._FinalStage outputPrice(Nullable<Double> outputPrice)

      Deprecated. See 'prices' instead. Price (USD) per output unit

      Specified by:
      outputPrice in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • outputPrice

      public Model._FinalStage outputPrice(Double outputPrice)

      Deprecated. See 'prices' instead. Price (USD) per output unit

      Specified by:
      outputPrice in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • outputPrice

      public Model._FinalStage outputPrice(Optional<Double> outputPrice)

      Deprecated. See 'prices' instead. Price (USD) per output unit

      Specified by:
      outputPrice in interface Model._FinalStage
    • inputPrice

      public Model._FinalStage inputPrice(Nullable<Double> inputPrice)

      Deprecated. See 'prices' instead. Price (USD) per input unit

      Specified by:
      inputPrice in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • inputPrice

      public Model._FinalStage inputPrice(Double inputPrice)

      Deprecated. See 'prices' instead. Price (USD) per input unit

      Specified by:
      inputPrice in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • inputPrice

      public Model._FinalStage inputPrice(Optional<Double> inputPrice)

      Deprecated. See 'prices' instead. Price (USD) per input unit

      Specified by:
      inputPrice in interface Model._FinalStage
    • unit

      Unit used by this model.

      Specified by:
      unit in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • unit

      public Model._FinalStage unit(ModelUsageUnit unit)

      Unit used by this model.

      Specified by:
      unit in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • unit

      Unit used by this model.

      Specified by:
      unit in interface Model._FinalStage
    • startDate

      public Model._FinalStage startDate(Nullable<OffsetDateTime> startDate)

      Apply only to generations which are newer than this ISO date.

      Specified by:
      startDate in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • startDate

      public Model._FinalStage startDate(OffsetDateTime startDate)

      Apply only to generations which are newer than this ISO date.

      Specified by:
      startDate in interface Model._FinalStage
      Returns:
      Reference to this so that method calls can be chained together.
    • startDate

      public Model._FinalStage startDate(Optional<OffsetDateTime> startDate)

      Apply only to generations which are newer than this ISO date.

      Specified by:
      startDate in interface Model._FinalStage
    • build

      public Model build()
      Specified by:
      build in interface Model._FinalStage
    • additionalProperty

      public Model.Builder additionalProperty(String key, Object value)
      Specified by:
      additionalProperty in interface Model._FinalStage
    • additionalProperties

      public Model.Builder additionalProperties(Map<String,Object> additionalProperties)
      Specified by:
      additionalProperties in interface Model._FinalStage