-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
将nop-gpt重命名为nop-ai。初步的消息设计参考agents flex项目。
- Loading branch information
1 parent
0e6aec5
commit 67dff01
Showing
53 changed files
with
1,329 additions
and
118 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
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
125 changes: 125 additions & 0 deletions
125
nop-ai/nop-ai-core/src/main/java/io/nop/ai/core/api/chat/ChatOptions.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 |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/** | ||
* Copyright (c) 2017-2024 Nop Platform. All rights reserved. | ||
* Author: [email protected] | ||
* Blog: https://www.zhihu.com/people/canonical-entropy | ||
* Gitee: https://gitee.com/canonical-entropy/nop-entropy | ||
* Github: https://github.com/entropy-cloud/nop-entropy | ||
*/ | ||
package io.nop.ai.core.api.chat; | ||
|
||
import io.nop.api.core.beans.ExtensibleBean; | ||
|
||
import java.util.List; | ||
|
||
public class ChatOptions extends ExtensibleBean { | ||
private IChatProgressListener progressListener; | ||
|
||
public ChatOptions progressListener(IChatProgressListener progressListener) { | ||
this.setProgressListener(progressListener); | ||
return this; | ||
} | ||
|
||
public IChatProgressListener getProgressListener() { | ||
return progressListener; | ||
} | ||
|
||
public void setProgressListener(IChatProgressListener progressListener) { | ||
this.progressListener = progressListener; | ||
} | ||
|
||
private String seed; | ||
private Float temperature; | ||
private Float topP; | ||
private Integer topK; | ||
private Integer maxTokens; | ||
private List<String> stop; | ||
|
||
//============= 以下为coze支持的参数 ===== | ||
private String botId; | ||
|
||
private String conversationId; | ||
|
||
private String userId; | ||
|
||
private boolean stream; | ||
|
||
public String getSeed() { | ||
return seed; | ||
} | ||
|
||
public void setSeed(String seed) { | ||
this.seed = seed; | ||
} | ||
|
||
public Float getTemperature() { | ||
return temperature; | ||
} | ||
|
||
public void setTemperature(Float temperature) { | ||
this.temperature = temperature; | ||
} | ||
|
||
public Float getTopP() { | ||
return topP; | ||
} | ||
|
||
public void setTopP(Float topP) { | ||
this.topP = topP; | ||
} | ||
|
||
public Integer getTopK() { | ||
return topK; | ||
} | ||
|
||
public void setTopK(Integer topK) { | ||
this.topK = topK; | ||
} | ||
|
||
public Integer getMaxTokens() { | ||
return maxTokens; | ||
} | ||
|
||
public void setMaxTokens(Integer maxTokens) { | ||
this.maxTokens = maxTokens; | ||
} | ||
|
||
public List<String> getStop() { | ||
return stop; | ||
} | ||
|
||
public void setStop(List<String> stop) { | ||
this.stop = stop; | ||
} | ||
|
||
public String getBotId() { | ||
return botId; | ||
} | ||
|
||
public void setBotId(String botId) { | ||
this.botId = botId; | ||
} | ||
|
||
public String getConversationId() { | ||
return conversationId; | ||
} | ||
|
||
public void setConversationId(String conversationId) { | ||
this.conversationId = conversationId; | ||
} | ||
|
||
public String getUserId() { | ||
return userId; | ||
} | ||
|
||
public void setUserId(String userId) { | ||
this.userId = userId; | ||
} | ||
|
||
public boolean isStream() { | ||
return stream; | ||
} | ||
|
||
public void setStream(boolean stream) { | ||
this.stream = stream; | ||
} | ||
} |
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
70 changes: 70 additions & 0 deletions
70
nop-ai/nop-ai-core/src/main/java/io/nop/ai/core/api/document/Document.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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright (c) 2023-2025, Agents-Flex ([email protected]). | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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 io.nop.ai.core.api.document; | ||
|
||
import io.nop.ai.core.api.support.VectorData; | ||
|
||
public class Document extends VectorData { | ||
|
||
/** | ||
* Document ID | ||
*/ | ||
private Object id; | ||
|
||
/** | ||
* Document Content | ||
*/ | ||
private String content; | ||
|
||
|
||
public Document() { | ||
} | ||
|
||
public Document(String content) { | ||
this.content = content; | ||
} | ||
|
||
public Object getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Object id) { | ||
this.id = id; | ||
} | ||
|
||
public String getContent() { | ||
return content; | ||
} | ||
|
||
public void setContent(String content) { | ||
this.content = content; | ||
} | ||
|
||
public static Document of(String content){ | ||
Document document = new Document(); | ||
document.setContent(content); | ||
return document; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Document{" + | ||
"id=" + id + | ||
", content='" + content + '\'' + | ||
", metadataMap=" + metadataMap + | ||
'}'; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
nop-ai/nop-ai-core/src/main/java/io/nop/ai/core/api/embedding/EmbeddingOptions.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.nop.ai.core.api.embedding; | ||
|
||
import io.nop.api.core.annotations.data.DataBean; | ||
|
||
@DataBean | ||
public class EmbeddingOptions { | ||
private String model; | ||
|
||
public String getModel() { | ||
return model; | ||
} | ||
|
||
public void setModel(String model) { | ||
this.model = model; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
nop-ai/nop-ai-core/src/main/java/io/nop/ai/core/api/embedding/IEmbeddingModel.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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package io.nop.ai.core.api.embedding; | ||
|
||
import io.nop.ai.core.api.support.VectorData; | ||
|
||
import javax.swing.text.Document; | ||
import java.util.concurrent.CompletionStage; | ||
|
||
public interface IEmbeddingModel { | ||
CompletionStage<VectorData> embedAsync(Document doc, EmbeddingOptions options); | ||
} |
19 changes: 19 additions & 0 deletions
19
nop-ai/nop-ai-core/src/main/java/io/nop/ai/core/api/messages/AbstractTextMessage.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.nop.ai.core.api.messages; | ||
|
||
public class AbstractTextMessage extends Message{ | ||
|
||
protected String content; | ||
|
||
public String getContent() { | ||
return content; | ||
} | ||
|
||
public void setContent(String content) { | ||
this.content = content; | ||
} | ||
|
||
@Override | ||
public Object getMessageContent() { | ||
return getContent(); | ||
} | ||
} |
Oops, something went wrong.