Skip to content

Commit

Permalink
Merge pull request HamaWhiteGG#130 from HamaWhiteGG/dev
Browse files Browse the repository at this point in the history
optimize agent example
  • Loading branch information
HamaWhiteGG authored Nov 2, 2023
2 parents 5dbfacf + b5a5806 commit aac53a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ChatAgentExample {

public static void main(String[] args) {
// The language model we're going to use to control the agent.
var chat = ChatOpenAI.builder().temperature(0).build().init();
var chat = ChatOpenAI.builder().temperature(0).model("gpt-4").build().init();

// The tools we'll give the Agent access to. Note that the 'llm-math' tool uses an LLM, so we need to pass that
// in.
Expand All @@ -44,7 +44,11 @@ public static void main(String[] args) {
// Finally, let's initialize an agent with the tools, the language model, and the type of agent we want to use.
var agent = initializeAgent(tools, chat, AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION);

// var query = "Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?";
var query = "How many countries and regions participated in the 2023 Hangzhou Asian Games?" +
"What is that number raised to the .023 power?";

// Now let's test it out!
agent.run("Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?");
agent.run(query);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ public static void main(String[] args) {
// Finally, let's initialize an agent with the tools, the language model, and the type of agent we want to use.
var agent = initializeAgent(tools, llm, AgentType.ZERO_SHOT_REACT_DESCRIPTION);

// var query = "What was the high temperature in SF yesterday in Fahrenheit? What is that number raised to the
// .023 power?";
var query = "How many countries and regions participated in the 2022 Hangzhou Asian Games?" +
"What is that number raised to the .023 power?";

// Let's test it out!
agent.run(
"What was the high temperature in SF yesterday in Fahrenheit? What is that number raised to the .023 power?");
agent.run(query);
}
}

0 comments on commit aac53a3

Please sign in to comment.