vishalmysore / sam

Autonomous Agent or Large Action Model Implementation in Java. Selenium and AI integration, AI based validations for tests. UI Validation, Image processing and much more
MIT License
11 stars 2 forks source link

install issue #3

Open zonadevlab opened 1 month ago

zonadevlab commented 1 month ago

Do you have additional instructions or installation options? I've tried multiple ways to fix the below error but every way just ends up breaking something else -

Aug 11, 2024 1:16:18 AM com.t4a.predict.ShellPredictionLoader loadYamlFile INFO: Group Name: Employee Actions Aug 11, 2024 1:16:18 AM com.t4a.predict.ShellPredictionLoader loadYamlFile INFO: Description: This is actions for all the new employees Aug 11, 2024 1:16:18 AM com.t4a.predict.ShellPredictionLoader loadYamlFile INFO: Group Name: Enterprise Actions Aug 11, 2024 1:16:18 AM com.t4a.predict.ShellPredictionLoader loadYamlFile INFO: Description: This is actions for all the new enterprise related applications Please make sure actions are configured Cannot invoke "String.trim()" because the return value of "java.util.Map.get(Object)" is null Details java.lang.NullPointerException: Cannot invoke "String.trim()" because the return value of "java.util.Map.get(Object)" is null at com.t4a.predict.PredictionLoader.getPredictedAction(PredictionLoader.java:310) at com.t4a.processor.GeminiV2ActionProcessor.processSingleAction(GeminiV2ActionProcessor.java:59) at com.t4a.processor.GeminiV2ActionProcessor.processSingleAction(GeminiV2ActionProcessor.java:44) at com.t4a.processor.GeminiV2ActionProcessor.processSingleAction(GeminiV2ActionProcessor.java:134) at org.example.GeminiActionExample.main(GeminiActionExample.java:23) Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.t4a.api.AIAction.getActionRisk()" because "action" is null at com.t4a.processor.GeminiV2ActionProcessor.processSingleAction(GeminiV2ActionProcessor.java:60) at com.t4a.processor.GeminiV2ActionProcessor.processSingleAction(GeminiV2ActionProcessor.java:44) at com.t4a.processor.GeminiV2ActionProcessor.processSingleAction(GeminiV2ActionProcessor.java:134) at org.example.GeminiActionExample.main(GeminiActionExample.java:23)

vishalmysore commented 1 month ago

can you please elaborate on what prompt you are trying to test? it looks like its trying to match prompt to action but not finding mapping action

zonadevlab commented 1 month ago

I tried sooo very many things. I was able to get it to work though, not this one but a Tools4AI version. So I don't know exactly where I went wrong on this one unfortunately, but odds are the error was on my end. Is there a way to code this to where it can set the actions on the fly, or be more dynamic and fluid where I might not know ahead of time the universe of options. Like https://github.com/frdel/agent-zero

vishalmysore commented 1 month ago

there are various options to set or predict actions please look at java docs here https://javadoc.io/doc/io.github.vishalmysore/tools4ai/latest/com/t4a/processor/AIProcessor.html

1) processSingleAction(String promptText)

The above method will trigger the action just based on prompt , you dont need to specify anything other than the prompt , it will predict based on LLM inference

2)processSingleAction(String promptText, Object actionInstance)

This method will call the action specified as actionIstance, it will map the parameters automatically

I have written an article describing how to build and autonomous agent here https://www.linkedin.com/pulse/enterprise-ai-hub-llm-agent-built-openai-java-vishal-mysore-0p7oc/?trackingId=qE91gQ%2Bngtn4vI45pxJEgg%3D%3D

Can you please let me know what prompt are you providing and where are you getting this exception

zerofox-del commented 1 month ago

I can't get that one to load. This is my 25th version of it, and typical of how this has been going because changing out any action causes 3 other things to break. It's likely because I'm not familiar with java, because there has to be an easier way to swap actions than manually changing pom.....

[INFO] Installing /new/Tools4AI/target/tools4ai-1.0.4-jar-with-dependencies.jar to /repository/io/github/vishalmysore/tools4ai/1.0.4/tools4ai-1.0.4-jar-with-dependencies.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 50.138 s [INFO] Finished at: 2024-08-13T03:09:06Z [INFO] ------------------------------------------------------------------------ ~/new/Tools4AI java -jar target/tools4ai-1.0.4-jar-with-dependencies.jar Error: Could not find or load main class processor.AIProcessor Caused by: java.lang.ClassNotFoundException: processor.AIProcessor ~/new/Tools4AI

zerofox-del commented 1 month ago

and others. delicate

image