forked from langchain4j/langchain4j
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed Result from model classes (langchain4j#30)
- Loading branch information
1 parent
77a767a
commit 7d36b0c
Showing
30 changed files
with
265 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 22 additions & 11 deletions
33
langchain4j-core/src/main/java/dev/langchain4j/model/chat/ChatLanguageModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,38 @@ | ||
package dev.langchain4j.model.chat; | ||
|
||
import dev.langchain4j.MightChangeInTheFuture; | ||
import dev.langchain4j.agent.tool.ToolSpecification; | ||
import dev.langchain4j.data.message.AiMessage; | ||
import dev.langchain4j.data.message.ChatMessage; | ||
import dev.langchain4j.model.input.Prompt; | ||
import dev.langchain4j.model.output.Result; | ||
import dev.langchain4j.data.message.UserMessage; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Represents a LLM that has a chat interface. | ||
*/ | ||
public interface ChatLanguageModel { | ||
|
||
Result<AiMessage> sendUserMessage(String text); | ||
/** | ||
* Sends a message from a user to the LLM and returns response. | ||
* | ||
* @param userMessage User message as a String. Will be wrapped into {@link dev.langchain4j.data.message.UserMessage UserMessage} under the hood. | ||
* @return {@link dev.langchain4j.data.message.AiMessage AiMessage} | ||
*/ | ||
AiMessage sendUserMessage(String userMessage); | ||
|
||
@MightChangeInTheFuture("not sure this method is useful/needed") | ||
Result<AiMessage> sendUserMessage(Prompt prompt); | ||
AiMessage sendUserMessage(UserMessage userMessage); | ||
|
||
@MightChangeInTheFuture("not sure this method is useful/needed") | ||
Result<AiMessage> sendUserMessage(Object structuredPrompt); | ||
/** | ||
* Sends a structured prompt as a user message to the LLM and returns response. | ||
* | ||
* @param structuredPrompt object annotated with {@link dev.langchain4j.model.input.structured.StructuredPrompt @StructuredPrompt} | ||
* @return {@link dev.langchain4j.data.message.AiMessage AiMessage} | ||
*/ | ||
AiMessage sendUserMessage(Object structuredPrompt); | ||
|
||
Result<AiMessage> sendMessages(ChatMessage... messages); | ||
AiMessage sendMessages(ChatMessage... messages); | ||
|
||
Result<AiMessage> sendMessages(List<ChatMessage> messages); | ||
AiMessage sendMessages(List<ChatMessage> messages); | ||
|
||
Result<AiMessage> sendMessages(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications); | ||
AiMessage sendMessages(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
langchain4j-core/src/main/java/dev/langchain4j/model/language/LanguageModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
package dev.langchain4j.model.language; | ||
|
||
import dev.langchain4j.model.input.Prompt; | ||
import dev.langchain4j.model.output.Result; | ||
|
||
public interface LanguageModel { | ||
|
||
Result<String> process(String text); | ||
String process(String text); | ||
|
||
Result<String> process(Prompt prompt); | ||
String process(Prompt prompt); | ||
|
||
Result<String> process(Object structuredPrompt); | ||
String process(Object structuredPrompt); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 0 additions & 40 deletions
40
langchain4j-core/src/main/java/dev/langchain4j/model/output/Result.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.