Skip to content

Commit

Permalink
#4292 - ollama-based recommender
Browse files Browse the repository at this point in the history
- Added different generation and extraction mechanisms
- Support JSON mode
- Remove dependency on ollama4j for the moment and use own client implementation
  • Loading branch information
reckart committed Nov 14, 2023
1 parent b47d477 commit 02f5669
Show file tree
Hide file tree
Showing 23 changed files with 1,239 additions and 90 deletions.
25 changes: 7 additions & 18 deletions inception/inception-imls-ollama/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,7 @@
<artifactId>inception-imls-ollama</artifactId>
<name>INCEpTION - ML - Ollama</name>

<repositories>
<repository>
<id>ollama4j-from-ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>io.github.amithkoujalgi</groupId>
<artifactId>ollama4j</artifactId>
<version>1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.hubspot.jinjava</groupId>
<artifactId>jinjava</artifactId>
Expand Down Expand Up @@ -125,5 +107,12 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<!-- Test -->
<dependency>
<groupId>org.dkpro.core</groupId>
<artifactId>dkpro-core-api-ner-asl</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Licensed to the Technische Universität Darmstadt under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The Technische Universität Darmstadt
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.tudarmstadt.ukp.inception.recommendation.imls.ollama;

public enum ExtractionMode
{
RESPONSE_AS_LABEL, //
MENTIONS_FROM_JSON
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Licensed to the Technische Universität Darmstadt under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The Technische Universität Darmstadt
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.tudarmstadt.ukp.inception.recommendation.imls.ollama;

import static java.util.Arrays.asList;

import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.EnumChoiceRenderer;
import org.apache.wicket.model.IModel;

public class ExtractionModeSelect
extends DropDownChoice<ExtractionMode>
{
private static final long serialVersionUID = 1789605828488016006L;

public ExtractionModeSelect(String aId)
{
super(aId);
}

public ExtractionModeSelect(String aId, IModel<ExtractionMode> aModel)
{
super(aId);
setModel(aModel);
}

@Override
protected void onInitialize()
{
super.onInitialize();

setChoiceRenderer(new EnumChoiceRenderer<>(this));
setChoices(asList(ExtractionMode.values()));
}
}
Loading

0 comments on commit 02f5669

Please sign in to comment.