From 99085cea9ad94e825dc346d1b3d0776a3dc592a4 Mon Sep 17 00:00:00 2001
From: Fu Cheng <alexcheng1982@gmail.com>
Date: Sun, 6 Oct 2024 00:50:01 +1300
Subject: [PATCH] minor fix

---
 .../io/github/llmagentbuilder/bootstrap/AgentBootstrap.kt     | 4 +++-
 .../io/github/llmagentbuilder/core/tool/AgentToolsProvider.kt | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/bootstrap/src/main/kotlin/io/github/llmagentbuilder/bootstrap/AgentBootstrap.kt b/bootstrap/src/main/kotlin/io/github/llmagentbuilder/bootstrap/AgentBootstrap.kt
index 2bab5b7..993b524 100644
--- a/bootstrap/src/main/kotlin/io/github/llmagentbuilder/bootstrap/AgentBootstrap.kt
+++ b/bootstrap/src/main/kotlin/io/github/llmagentbuilder/bootstrap/AgentBootstrap.kt
@@ -50,7 +50,9 @@ object AgentBootstrap {
                 agentToolsProvider,
             )
         val observationRegistry = ObservationRegistry.create()
-        OpenTelemetryPlugin().install(agentConfig, observationRegistry)
+        if (agentConfig.observation?.enabled == true) {
+            OpenTelemetryPlugin().install(agentConfig, observationRegistry)
+        }
         val llmConfigs = agentConfig.llm
         val chatModel = ServiceLoader.load(ChatModelProvider::class.java)
             .stream()
diff --git a/core/src/main/kotlin/io/github/llmagentbuilder/core/tool/AgentToolsProvider.kt b/core/src/main/kotlin/io/github/llmagentbuilder/core/tool/AgentToolsProvider.kt
index a69c9f6..ae10e95 100644
--- a/core/src/main/kotlin/io/github/llmagentbuilder/core/tool/AgentToolsProvider.kt
+++ b/core/src/main/kotlin/io/github/llmagentbuilder/core/tool/AgentToolsProvider.kt
@@ -10,6 +10,7 @@ import io.github.llmagentbuilder.core.observation.DefaultAgentToolExecutionObser
 import io.micrometer.observation.ObservationRegistry
 import org.slf4j.LoggerFactory
 import org.springframework.ai.model.function.FunctionCallback
+import org.springframework.ai.model.function.FunctionCallbackContext
 import org.springframework.ai.model.function.FunctionCallbackWrapper
 import org.springframework.core.GenericTypeResolver
 import java.util.*
@@ -35,7 +36,7 @@ class AgentToolWrappersProvider(
             InstrumentedFunctionCallbackWrapper(
                 FunctionCallbackWrapper.builder(tool)
                     .withName(tool.name())
-                    .withSchemaType(FunctionCallbackWrapper.Builder.SchemaType.JSON_SCHEMA)
+                    .withSchemaType(FunctionCallbackContext.SchemaType.JSON_SCHEMA)
                     .withDescription(tool.description())
                     .withInputType(
                         types?.get(0)