All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.launchableinc.openai.completion.chat.ChatFunctionDynamic Maven / Gradle / Ivy

There is a newer version: 0.4.0
Show newest version
package com.launchableinc.openai.completion.chat;

import lombok.Data;
import lombok.NonNull;


@Data
public class ChatFunctionDynamic {

	/**
	 * The name of the function being called.
	 */
	@NonNull
	private String name;

	/**
	 * A description of what the function does, used by the model to choose when and how to call the
	 * function.
	 */
	private String description;

	/**
	 * The parameters the functions accepts.
	 */
	private ChatFunctionParameters parameters;

	public static Builder builder() {
		return new Builder();
	}

	public static class Builder {

		private String name;
		private String description;
		private ChatFunctionParameters parameters = new ChatFunctionParameters();

		public Builder name(String name) {
			this.name = name;
			return this;
		}

		public Builder description(String description) {
			this.description = description;
			return this;
		}

		public Builder parameters(ChatFunctionParameters parameters) {
			this.parameters = parameters;
			return this;
		}

		public Builder addProperty(ChatFunctionProperty property) {
			this.parameters.addProperty(property);
			return this;
		}

		public ChatFunctionDynamic build() {
			ChatFunctionDynamic chatFunction = new ChatFunctionDynamic(name);
			chatFunction.setDescription(description);
			chatFunction.setParameters(parameters);
			return chatFunction;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy