-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add missing fields to Sign Template Signer and fix AI schema (bo…
- Loading branch information
1 parent
0074ee3
commit 31920e6
Showing
17 changed files
with
355 additions
and
140 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ "engineHash": "0b023a8", "specHash": "da821cd", "version": "0.3.0" } | ||
{ "engineHash": "6dfffba", "specHash": "57614c2", "version": "0.3.1" } |
Large diffs are not rendered by default.
Oops, something went wrong.
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
20 changes: 10 additions & 10 deletions
20
Sources/Schemas/AiAgentBasicGenTool/AiAgentBasicGenTool.swift
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
54 changes: 54 additions & 0 deletions
54
Sources/Schemas/AiAgentBasicTextTool/AiAgentBasicTextTool.swift
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,54 @@ | ||
import Foundation | ||
|
||
/// AI agent tool used to handle basic text. | ||
public class AiAgentBasicTextTool: AiAgentBasicTextToolBase { | ||
private enum CodingKeys: String, CodingKey { | ||
case systemMessage = "system_message" | ||
case promptTemplate = "prompt_template" | ||
} | ||
|
||
/// System messages try to help the LLM "understand" its role and what it is supposed to do. | ||
public let systemMessage: String? | ||
|
||
/// The prompt template contains contextual information of the request and the user prompt. | ||
/// | ||
/// When passing `prompt_template` parameters, you **must include** inputs for `{user_question}` and `{content}`. | ||
/// | ||
/// Input for `{current_date}` is optional, depending on the use. | ||
public let promptTemplate: String? | ||
|
||
/// Initializer for a AiAgentBasicTextTool. | ||
/// | ||
/// - Parameters: | ||
/// - model: The model used for the AI Agent for basic text. | ||
/// - numTokensForCompletion: The number of tokens for completion. | ||
/// - llmEndpointParams: The parameters for the LLM endpoint specific to OpenAI / Google models. | ||
/// - systemMessage: System messages try to help the LLM "understand" its role and what it is supposed to do. | ||
/// - promptTemplate: The prompt template contains contextual information of the request and the user prompt. | ||
/// | ||
/// When passing `prompt_template` parameters, you **must include** inputs for `{user_question}` and `{content}`. | ||
/// | ||
/// Input for `{current_date}` is optional, depending on the use. | ||
public init(model: String? = nil, numTokensForCompletion: Int64? = nil, llmEndpointParams: AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi? = nil, systemMessage: String? = nil, promptTemplate: String? = nil) { | ||
self.systemMessage = systemMessage | ||
self.promptTemplate = promptTemplate | ||
|
||
super.init(model: model, numTokensForCompletion: numTokensForCompletion, llmEndpointParams: llmEndpointParams) | ||
} | ||
|
||
required public init(from decoder: Decoder) throws { | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
systemMessage = try container.decodeIfPresent(String.self, forKey: .systemMessage) | ||
promptTemplate = try container.decodeIfPresent(String.self, forKey: .promptTemplate) | ||
|
||
try super.init(from: decoder) | ||
} | ||
|
||
public override func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
try container.encodeIfPresent(systemMessage, forKey: .systemMessage) | ||
try container.encodeIfPresent(promptTemplate, forKey: .promptTemplate) | ||
try super.encode(to: encoder) | ||
} | ||
|
||
} |
26 changes: 3 additions & 23 deletions
26
...TextToolAsk/AiAgentBasicTextToolAsk.swift → ...xtToolBase/AiAgentBasicTextToolBase.swift
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
45 changes: 15 additions & 30 deletions
45
Sources/Schemas/AiAgentBasicTextToolTextGen/AiAgentBasicTextToolTextGen.swift
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 |
---|---|---|
@@ -1,69 +1,54 @@ | ||
import Foundation | ||
|
||
/// AI agent tool used to handle basic text. | ||
public class AiAgentBasicTextToolTextGen: Codable { | ||
public class AiAgentBasicTextToolTextGen: AiAgentBasicTextToolBase { | ||
private enum CodingKeys: String, CodingKey { | ||
case model | ||
case systemMessage = "system_message" | ||
case promptTemplate = "prompt_template" | ||
case numTokensForCompletion = "num_tokens_for_completion" | ||
case llmEndpointParams = "llm_endpoint_params" | ||
} | ||
|
||
/// The model to be used for the AI Agent for basic text. | ||
public let model: String? | ||
|
||
/// System messages try to help the LLM "understand" its role and what it is supposed to do. | ||
/// This parameter requires using `{current_date}`. | ||
/// Input for `{current_date}` is optional, depending on the use. | ||
public let systemMessage: String? | ||
|
||
/// The prompt template contains contextual information of the request and the user prompt. | ||
/// | ||
/// When using the `prompt_template` parameter, you **must include** input for `{user_question}`. | ||
/// Inputs for `{current_date}` and`{content}` are optional, depending on the use. | ||
/// Inputs for `{current_date}` and `{content}` are optional, depending on the use. | ||
public let promptTemplate: String? | ||
|
||
/// The number of tokens for completion. | ||
public let numTokensForCompletion: Int64? | ||
|
||
public let llmEndpointParams: AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi? | ||
|
||
/// Initializer for a AiAgentBasicTextToolTextGen. | ||
/// | ||
/// - Parameters: | ||
/// - model: The model to be used for the AI Agent for basic text. | ||
/// - model: The model used for the AI Agent for basic text. | ||
/// - numTokensForCompletion: The number of tokens for completion. | ||
/// - llmEndpointParams: The parameters for the LLM endpoint specific to OpenAI / Google models. | ||
/// - systemMessage: System messages try to help the LLM "understand" its role and what it is supposed to do. | ||
/// This parameter requires using `{current_date}`. | ||
/// Input for `{current_date}` is optional, depending on the use. | ||
/// - promptTemplate: The prompt template contains contextual information of the request and the user prompt. | ||
/// | ||
/// When using the `prompt_template` parameter, you **must include** input for `{user_question}`. | ||
/// Inputs for `{current_date}` and`{content}` are optional, depending on the use. | ||
/// - numTokensForCompletion: The number of tokens for completion. | ||
/// - llmEndpointParams: | ||
public init(model: String? = nil, systemMessage: String? = nil, promptTemplate: String? = nil, numTokensForCompletion: Int64? = nil, llmEndpointParams: AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi? = nil) { | ||
self.model = model | ||
/// Inputs for `{current_date}` and `{content}` are optional, depending on the use. | ||
public init(model: String? = nil, numTokensForCompletion: Int64? = nil, llmEndpointParams: AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi? = nil, systemMessage: String? = nil, promptTemplate: String? = nil) { | ||
self.systemMessage = systemMessage | ||
self.promptTemplate = promptTemplate | ||
self.numTokensForCompletion = numTokensForCompletion | ||
self.llmEndpointParams = llmEndpointParams | ||
|
||
super.init(model: model, numTokensForCompletion: numTokensForCompletion, llmEndpointParams: llmEndpointParams) | ||
} | ||
|
||
required public init(from decoder: Decoder) throws { | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
model = try container.decodeIfPresent(String.self, forKey: .model) | ||
systemMessage = try container.decodeIfPresent(String.self, forKey: .systemMessage) | ||
promptTemplate = try container.decodeIfPresent(String.self, forKey: .promptTemplate) | ||
numTokensForCompletion = try container.decodeIfPresent(Int64.self, forKey: .numTokensForCompletion) | ||
llmEndpointParams = try container.decodeIfPresent(AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.self, forKey: .llmEndpointParams) | ||
|
||
try super.init(from: decoder) | ||
} | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
public override func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
try container.encodeIfPresent(model, forKey: .model) | ||
try container.encodeIfPresent(systemMessage, forKey: .systemMessage) | ||
try container.encodeIfPresent(promptTemplate, forKey: .promptTemplate) | ||
try container.encodeIfPresent(numTokensForCompletion, forKey: .numTokensForCompletion) | ||
try container.encodeIfPresent(llmEndpointParams, forKey: .llmEndpointParams) | ||
try super.encode(to: encoder) | ||
} | ||
|
||
} |
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.