Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search wikipedia tool #312

Merged
merged 11 commits into from Aug 22, 2023
Merged

Search wikipedia tool #312

merged 11 commits into from Aug 22, 2023

Conversation

Zevleg
Copy link
Contributor

@Zevleg Zevleg commented Aug 10, 2023

Ticket Implement search wikipedia in React Agent

This is the implementation of search Wikipedia with ReActAgent. As WikipediaClient have 3 functions with diferent params, I created a new ToolWikipedia Interface because if I implement Tool interface I must to implement the function invoke only with one parameter.

Also I created ToolMain interface, where Tool and ToolWikipedia implements ToolMain and it is declared in ReActAgent to choose wich invoke function run for each tool with when(tool) like this:

val observation: String? =
    when (tool) {
      is ToolWikipedia -> tool.invoke(plan.toolInput, null, null)
      is Tool -> tool.invoke(plan.toolInput)
      else -> null
    }

Captura de pantalla 2023-08-10 a la(s) 5 52 35 p m

Copy link
Contributor

@raulraja raulraja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @Zevleg; looks excellent.
We should consider not to hardcode the Wikipedia tool inside the agent checks and instead provide three tools as outlined in my comment. We can't make exceptional cases for each tool, and the agents should work under a single common interface agnostic to the tools.
One of the reasons is that tools files and types may not live in this module but instead on a Wikipedia-specific module down the road.

…earch_wikipedia_tool

# Conflicts:
#	examples/kotlin/src/main/kotlin/com/xebia/functional/xef/auto/reasoning/WikipediaSearchByParamsExample.kt
raulraja
raulraja previously approved these changes Aug 18, 2023
Copy link
Contributor

@raulraja raulraja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @Zevleg !

…earch_wikipedia_tool

# Conflicts:
#	examples/kotlin/src/main/kotlin/com/xebia/functional/xef/conversation/expressions/WorkoutPlanProgram.kt
#	examples/kotlin/src/main/kotlin/com/xebia/functional/xef/conversation/reasoning/ReActExample.kt
#	examples/kotlin/src/main/kotlin/com/xebia/functional/xef/conversation/reasoning/ReActWikipediaExample.kt
#	reasoning/src/commonMain/kotlin/com/xebia/functional/xef/reasoning/serpapi/Search.kt
Copy link
Contributor

@raulraja raulraja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you @Zevleg 👏

@raulraja raulraja merged commit b06d0a2 into main Aug 22, 2023
5 checks passed
@raulraja raulraja deleted the search_wikipedia_tool branch August 22, 2023 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants