From 31c0ca4bbe5c3dbbf1f67d71ae705fb18d74c6a3 Mon Sep 17 00:00:00 2001 From: timouche Date: Mon, 27 May 2024 10:46:00 +0200 Subject: [PATCH 01/14] test add a custom function call llm try 1 --- src/PhpSpreadsheet/Calculation/Calculation.php | 12 ++++++++++++ src/PhpSpreadsheet/Calculation/Category.php | 1 + .../Calculation/External/Llm.php | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 src/PhpSpreadsheet/Calculation/External/Llm.php diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 6028a9d72f..946a035400 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -1634,6 +1634,18 @@ public static function getExcelConstants(string $key): bool|null 'functionCall' => [Statistical\Trends::class, 'LINEST'], 'argumentCount' => '1-4', ], + + + 'LMM' => [ + 'category' => Category::CATEGORY_IA, + 'functionCall' => [External\Llm::class, 'call'], + 'argumentCount' => '1-2', + ], + + + + + 'LN' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, 'functionCall' => [MathTrig\Logarithms::class, 'natural'], diff --git a/src/PhpSpreadsheet/Calculation/Category.php b/src/PhpSpreadsheet/Calculation/Category.php index b661fafec0..e7e434cee7 100644 --- a/src/PhpSpreadsheet/Calculation/Category.php +++ b/src/PhpSpreadsheet/Calculation/Category.php @@ -18,4 +18,5 @@ abstract class Category const CATEGORY_TEXT_AND_DATA = 'Text and Data'; const CATEGORY_WEB = 'Web'; const CATEGORY_UNCATEGORISED = 'Uncategorised'; + const CATEGORY_IA = 'IA'; } diff --git a/src/PhpSpreadsheet/Calculation/External/Llm.php b/src/PhpSpreadsheet/Calculation/External/Llm.php new file mode 100644 index 0000000000..d2179f73e4 --- /dev/null +++ b/src/PhpSpreadsheet/Calculation/External/Llm.php @@ -0,0 +1,18 @@ + Date: Mon, 27 May 2024 13:04:04 +0200 Subject: [PATCH 02/14] test add a custom function call llm try 2 --- src/PhpSpreadsheet/Calculation/Calculation.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 946a035400..0b9180c08f 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -1634,18 +1634,11 @@ public static function getExcelConstants(string $key): bool|null 'functionCall' => [Statistical\Trends::class, 'LINEST'], 'argumentCount' => '1-4', ], - - 'LMM' => [ 'category' => Category::CATEGORY_IA, 'functionCall' => [External\Llm::class, 'call'], 'argumentCount' => '1-2', - ], - - - - - + ], 'LN' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, 'functionCall' => [MathTrig\Logarithms::class, 'natural'], From 644bf119b4528a0547e7706ac0985dd850c923b8 Mon Sep 17 00:00:00 2001 From: timouche Date: Mon, 27 May 2024 13:11:36 +0200 Subject: [PATCH 03/14] test add a custom function call llm try 3 --- src/PhpSpreadsheet/Calculation/External/Llm.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/External/Llm.php b/src/PhpSpreadsheet/Calculation/External/Llm.php index d2179f73e4..e58b8c82f5 100644 --- a/src/PhpSpreadsheet/Calculation/External/Llm.php +++ b/src/PhpSpreadsheet/Calculation/External/Llm.php @@ -11,8 +11,8 @@ class Llm - public static function call(string $model = "dolphinLama2.3", string $prompt): string + public static function call( string $prompt , string $model = "dolphinLama2.3",): string { - return "falue"; + return "falue"; } } From 8c50287564d342ac6000d98dd2c56cd86cc108d1 Mon Sep 17 00:00:00 2001 From: timouche Date: Mon, 27 May 2024 13:32:17 +0200 Subject: [PATCH 04/14] test add a custom function call llm try 4 --- src/PhpSpreadsheet/Calculation/External/Llm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpSpreadsheet/Calculation/External/Llm.php b/src/PhpSpreadsheet/Calculation/External/Llm.php index e58b8c82f5..2fef8cd2cf 100644 --- a/src/PhpSpreadsheet/Calculation/External/Llm.php +++ b/src/PhpSpreadsheet/Calculation/External/Llm.php @@ -11,7 +11,7 @@ class Llm - public static function call( string $prompt , string $model = "dolphinLama2.3",): string + public static function call(string $prompt,string $model="dolphinLama2.3"): string { return "falue"; } From 38dd55f5fe4443b7efef10132664ab00fa7379db Mon Sep 17 00:00:00 2001 From: timouche Date: Mon, 27 May 2024 13:50:05 +0200 Subject: [PATCH 05/14] test add a custom function call llm try 5 --- src/PhpSpreadsheet/Calculation/External/Llm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpSpreadsheet/Calculation/External/Llm.php b/src/PhpSpreadsheet/Calculation/External/Llm.php index 2fef8cd2cf..bf7e5b8fee 100644 --- a/src/PhpSpreadsheet/Calculation/External/Llm.php +++ b/src/PhpSpreadsheet/Calculation/External/Llm.php @@ -11,7 +11,7 @@ class Llm - public static function call(string $prompt,string $model="dolphinLama2.3"): string + public static function call(string $prompt, string $model = "dolphinLama2.3"): string { return "falue"; } From 5d12967d092e6b454ce2b9a92f8e15f04d7f5504 Mon Sep 17 00:00:00 2001 From: timouche Date: Mon, 27 May 2024 14:44:18 +0200 Subject: [PATCH 06/14] test add a custom function call llm try 6 --- src/PhpSpreadsheet/Calculation/External/Llm.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/External/Llm.php b/src/PhpSpreadsheet/Calculation/External/Llm.php index bf7e5b8fee..aa38b0e0d2 100644 --- a/src/PhpSpreadsheet/Calculation/External/Llm.php +++ b/src/PhpSpreadsheet/Calculation/External/Llm.php @@ -2,15 +2,9 @@ namespace PhpOffice\PhpSpreadsheet\Calculation\External; -use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; -use PhpOffice\PhpSpreadsheet\Calculation\Exception; - class Llm { - use ArrayEnabled; - - public static function call(string $prompt, string $model = "dolphinLama2.3"): string { return "falue"; From 2999bd9a4d58ac983523e7da8164053366bf6b81 Mon Sep 17 00:00:00 2001 From: timouche Date: Mon, 27 May 2024 15:58:38 +0200 Subject: [PATCH 07/14] test add a custom function call llm try 7 --- src/PhpSpreadsheet/Calculation/Calculation.php | 2 +- src/PhpSpreadsheet/Calculation/External/Llm.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 0b9180c08f..84e662e979 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -1634,7 +1634,7 @@ public static function getExcelConstants(string $key): bool|null 'functionCall' => [Statistical\Trends::class, 'LINEST'], 'argumentCount' => '1-4', ], - 'LMM' => [ + 'LLM' => [ 'category' => Category::CATEGORY_IA, 'functionCall' => [External\Llm::class, 'call'], 'argumentCount' => '1-2', diff --git a/src/PhpSpreadsheet/Calculation/External/Llm.php b/src/PhpSpreadsheet/Calculation/External/Llm.php index aa38b0e0d2..b5c31115f4 100644 --- a/src/PhpSpreadsheet/Calculation/External/Llm.php +++ b/src/PhpSpreadsheet/Calculation/External/Llm.php @@ -4,7 +4,6 @@ class Llm { - public static function call(string $prompt, string $model = "dolphinLama2.3"): string { return "falue"; From 17ede4de18c0749ed9c8e9a9b2c3c50d0ba3bfe1 Mon Sep 17 00:00:00 2001 From: timouchee <95432245+timouchee@users.noreply.github.com> Date: Tue, 28 May 2024 12:58:48 +0200 Subject: [PATCH 08/14] Update Calculation.php --- src/PhpSpreadsheet/Calculation/Calculation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 84e662e979..132a9f9fbc 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -1633,12 +1633,12 @@ public static function getExcelConstants(string $key): bool|null 'category' => Category::CATEGORY_STATISTICAL, 'functionCall' => [Statistical\Trends::class, 'LINEST'], 'argumentCount' => '1-4', - ], + ],/* 'LLM' => [ 'category' => Category::CATEGORY_IA, 'functionCall' => [External\Llm::class, 'call'], 'argumentCount' => '1-2', - ], + ],*/ 'LN' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, 'functionCall' => [MathTrig\Logarithms::class, 'natural'], From fc66d1fe97442c34506170e4de330fb773ab3dce Mon Sep 17 00:00:00 2001 From: timouchee <95432245+timouchee@users.noreply.github.com> Date: Tue, 28 May 2024 13:02:57 +0200 Subject: [PATCH 09/14] Update Calculation.php --- src/PhpSpreadsheet/Calculation/Calculation.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 132a9f9fbc..e85548c77f 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -2879,6 +2879,15 @@ public static function getExcelConstants(string $key): bool|null ], ]; + + public function regstermyfunction() + { + + self::$phpSpreadsheetFunctions['LLM'] = [External\Llm::class, 'call']; + + } + + public function __construct(?Spreadsheet $spreadsheet = null) { $this->spreadsheet = $spreadsheet; From 0dbc2537a88d6fa700b9276d534c7785b5b8b16f Mon Sep 17 00:00:00 2001 From: timouchee <95432245+timouchee@users.noreply.github.com> Date: Tue, 28 May 2024 13:08:55 +0200 Subject: [PATCH 10/14] Update Calculation.php --- src/PhpSpreadsheet/Calculation/Calculation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index e85548c77f..debb82d29c 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -2880,7 +2880,7 @@ public static function getExcelConstants(string $key): bool|null ]; - public function regstermyfunction() + public static function regstermyfunction():void { self::$phpSpreadsheetFunctions['LLM'] = [External\Llm::class, 'call']; From 0d520d2d804fa81e39f17146d4865a8378f082bb Mon Sep 17 00:00:00 2001 From: timouchee <95432245+timouchee@users.noreply.github.com> Date: Tue, 28 May 2024 13:53:56 +0200 Subject: [PATCH 11/14] Update Calculation.php --- src/PhpSpreadsheet/Calculation/Calculation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index debb82d29c..b4638bf837 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -2879,14 +2879,14 @@ public static function getExcelConstants(string $key): bool|null ], ]; - +/* public static function regstermyfunction():void { self::$phpSpreadsheetFunctions['LLM'] = [External\Llm::class, 'call']; } - +*/ public function __construct(?Spreadsheet $spreadsheet = null) { From 596b6ee55459ee187df9c4b563904bbda02aa48a Mon Sep 17 00:00:00 2001 From: timouchee <95432245+timouchee@users.noreply.github.com> Date: Tue, 28 May 2024 14:01:31 +0200 Subject: [PATCH 12/14] Update Category.php --- src/PhpSpreadsheet/Calculation/Category.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpSpreadsheet/Calculation/Category.php b/src/PhpSpreadsheet/Calculation/Category.php index e7e434cee7..9a229f0641 100644 --- a/src/PhpSpreadsheet/Calculation/Category.php +++ b/src/PhpSpreadsheet/Calculation/Category.php @@ -18,5 +18,5 @@ abstract class Category const CATEGORY_TEXT_AND_DATA = 'Text and Data'; const CATEGORY_WEB = 'Web'; const CATEGORY_UNCATEGORISED = 'Uncategorised'; - const CATEGORY_IA = 'IA'; + /*const CATEGORY_IA = 'IA';*/ } From d153c3014336c28d1390d6162fa1d54195b2d9cb Mon Sep 17 00:00:00 2001 From: timouchee <95432245+timouchee@users.noreply.github.com> Date: Tue, 28 May 2024 14:48:58 +0200 Subject: [PATCH 13/14] Update Category.php --- src/PhpSpreadsheet/Calculation/Category.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/PhpSpreadsheet/Calculation/Category.php b/src/PhpSpreadsheet/Calculation/Category.php index 9a229f0641..b661fafec0 100644 --- a/src/PhpSpreadsheet/Calculation/Category.php +++ b/src/PhpSpreadsheet/Calculation/Category.php @@ -18,5 +18,4 @@ abstract class Category const CATEGORY_TEXT_AND_DATA = 'Text and Data'; const CATEGORY_WEB = 'Web'; const CATEGORY_UNCATEGORISED = 'Uncategorised'; - /*const CATEGORY_IA = 'IA';*/ } From 725c5aef8a0b82e954698de216883711b1e1e31e Mon Sep 17 00:00:00 2001 From: timouchee <95432245+timouchee@users.noreply.github.com> Date: Tue, 28 May 2024 14:50:01 +0200 Subject: [PATCH 14/14] Update Calculation.php --- src/PhpSpreadsheet/Calculation/Calculation.php | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index b4638bf837..ff7cf13416 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -1633,12 +1633,7 @@ public static function getExcelConstants(string $key): bool|null 'category' => Category::CATEGORY_STATISTICAL, 'functionCall' => [Statistical\Trends::class, 'LINEST'], 'argumentCount' => '1-4', - ],/* - 'LLM' => [ - 'category' => Category::CATEGORY_IA, - 'functionCall' => [External\Llm::class, 'call'], - 'argumentCount' => '1-2', - ],*/ + ], 'LN' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, 'functionCall' => [MathTrig\Logarithms::class, 'natural'], @@ -2878,16 +2873,7 @@ public static function getExcelConstants(string $key): bool|null 'functionCall' => [Internal\WildcardMatch::class, 'compare'], ], ]; - -/* - public static function regstermyfunction():void - { - - self::$phpSpreadsheetFunctions['LLM'] = [External\Llm::class, 'call']; - - } -*/ - + public function __construct(?Spreadsheet $spreadsheet = null) { $this->spreadsheet = $spreadsheet;