forked from neurodock/NeuroDock
refactor: me.zacharias.chat → me.neurodock, org rename cleanup
- Renamed package from me.zacharias.chat to me.neurodock across all 8 modules - Updated Gradle group from me.zacharias.neurodock to me.neurodock - Updated README and other files to reflect new Gitea org URL (Chat_things → neurodock) Dev note: 95 files touched. The Great Refactor is complete, long may it rest.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package me.neurodock.wikipedia;
|
||||
|
||||
import io.github.fastily.jwiki.core.Wiki;
|
||||
import me.neurodock.ollama.OllamaFunctionArgument;
|
||||
import me.neurodock.ollama.OllamaFunctionTool;
|
||||
import me.neurodock.ollama.OllamaPerameter;
|
||||
import me.neurodock.ollama.OllamaToolResponse;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class GetWikiPageText extends OllamaFunctionTool {
|
||||
Wiki wiki = WikipediaTool.wiki;
|
||||
|
||||
@Override
|
||||
public @NotNull String name() {
|
||||
return "get_wiki_page_text";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Gets the text of a Wikipedia page by its title.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull OllamaPerameter parameters() {
|
||||
return OllamaPerameter.builder()
|
||||
.addProperty("title", OllamaPerameter.OllamaPerameterBuilder.Type.STRING, "The title of the Wikipedia page to retrieve text from.", true)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull OllamaToolResponse function(OllamaFunctionArgument... args) {
|
||||
return new OllamaToolResponse(name(), wiki.getPageText((String) args[0].value()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package me.neurodock.wikipedia;
|
||||
|
||||
import io.github.fastily.jwiki.core.Wiki;
|
||||
import me.neurodock.core.Core;
|
||||
import me.neurodock.ollama.OllamaFunctionTools;
|
||||
|
||||
public class WikipediaTool {
|
||||
private OllamaFunctionTools wikipediaToolsInstance;
|
||||
|
||||
public static Wiki wiki = new Wiki.Builder()
|
||||
//.withDomain("en.wikipedia.org")
|
||||
.build();
|
||||
|
||||
public WikipediaTool() {
|
||||
this.wikipediaToolsInstance = OllamaFunctionTools.builder()
|
||||
.addTool(new GetWikiPageText(), Core.Source.INTERNAL)
|
||||
.build();
|
||||
}
|
||||
|
||||
public OllamaFunctionTools getWikipediaToolsInstance() {
|
||||
return wikipediaToolsInstance;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user