Skip to content

Commit ee4c52b

Browse files
authored
Embedding support in Java Generator (#906)
* Embedding support in Java Generator * - Add Assitant Object support in Java Generator - Change Embedding implementation to use common util classes to call saia. * GXEmbedding module do not exists any more * Implement CallResult External Object to use in Agent Object * Change Saia URL to consider Embedding and Chat * Add support for chat and tool call messages * Message was not added to CallResult * Json API was updated in master * Change getmessages method in CallResult to getMessages * Change callAssistant to callAgent Add getExternalInstance method in EO Collections. Support ChatMessage EO * Fix Build error in Github * Fix Build error in Github * Remove Assistant Test * Add Tool Calls support * TRN with Embedded fails when the PK is validated in Java issue 202652 * Embedding must be initialized with empty values. * Add ToolCall y Stream support to Agent Object Add logging calling saia. * Changes to better CallTools support. * Avoid Exception procesing Agent response when Choices is not in the json response. * Implements Embedding in MySQL * Add stream in chat Agent calls. * Implements support for multimodal content in Agent messages. * Implements support for multimodal content in Agent messages. * Implements support for multimodal content in Agent messages. * Implements support for multimodal content in Agent messages. * Implements support for multimodal content in Agent messages.
1 parent 55cf746 commit ee4c52b

30 files changed

+1202
-12
lines changed

android/src/main/java/com/genexus/db/ForEachCursor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ public void setTimestamp(int index, java.sql.Timestamp value) throws SQLExceptio
217217
public void setBLOBFile(int index, String fileName) throws SQLException {}
218218
public void setBLOBFile(int index, String fileName, boolean isMultiMedia) throws SQLException {}
219219
public void setBLOBFile(int index, String fileName, boolean isMultiMedia, boolean downloadContent) throws SQLException {}
220+
public void setEmbedding(int index, Float[] value) throws SQLException {}
220221

221222
public void setVarchar(int index, String value, int length, boolean allowsNull) throws SQLException {}
222223
public void setLongVarchar(int index, String value, boolean allowsNull) throws SQLException {}

android/src/main/java/com/genexus/db/driver/GXCallableStatement.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,11 @@ public byte[] getBytes(int columnIndex) throws SQLException
651651
return stmt.getBytes(columnIndex);
652652
}
653653

654+
public Float[] getGxembedding (int columnIndex) throws SQLException
655+
{
656+
return null;
657+
}
658+
654659
public java.util.UUID getGUID(int columnIndex) throws SQLException
655660
{
656661
if (DEBUG)

android/src/main/java/com/genexus/db/driver/GXPreparedStatement.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,9 @@ else if (file.exists() && !fileNameNew.startsWith(blobBasePath))
13071307
}
13081308
}
13091309
}
1310-
1310+
1311+
public void setEmbedding(int index, Float[] value) throws SQLException{
1312+
}
13111313
public void setBinaryStream(int index, java.io.InputStream value, int length) throws SQLException
13121314
{
13131315
if (DEBUG)

android/src/main/java/com/genexus/db/driver/GXResultSet.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,11 @@ public byte[] getBytes(int columnIndex) throws SQLException
770770
return result.getBytes(columnIndex);
771771
}
772772

773+
public Float[] getGxembedding (int columnIndex) throws SQLException
774+
{
775+
return null;
776+
}
777+
773778
public java.util.UUID getGUID(int columnIndex) throws SQLException
774779
{
775780
java.util.UUID value;

common/src/main/java/com/genexus/GXExternalCollection.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,22 @@ public Vector getStruct()
9898
}
9999
return struct;
100100
}
101-
101+
102+
public ArrayList getExternalInstance() {
103+
ArrayList list = new ArrayList();
104+
for (T Item : this)
105+
{
106+
try
107+
{
108+
list.add(Item.getClass().getMethod("getExternalInstance", new Class[]{}).invoke(Item));
109+
}
110+
catch (Exception e)
111+
{
112+
e.printStackTrace();
113+
}
114+
}
115+
return list;
116+
}
117+
102118
}
103119

common/src/main/java/com/genexus/db/BufferIFieldGetter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ public byte[] getBytes(int columnIndex) throws SQLException {
8585
return ((byte[]) value[columnIndex - 1]);
8686
}
8787

88+
public Float[] getGxembedding(int columnIndex) throws SQLException {
89+
return ((Float[]) value[columnIndex - 1]);
90+
}
91+
8892
public java.sql.Date getDate(int columnIndex) throws SQLException {
8993
return ((java.sql.Date) value[columnIndex - 1]);
9094
}

common/src/main/java/com/genexus/db/CachedIFieldGetter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ public byte[] getBytes(int columnIndex) throws SQLException
220220
else
221221
return ((byte[][])value[index])[0];
222222
}
223+
224+
public Float[] getGxembedding(int columnIndex) throws SQLException
225+
{
226+
return ((Float[][])value[getColumnIndex(columnIndex)])[0];
227+
}
223228

224229
public java.sql.Date getDate(int columnIndex) throws SQLException
225230
{

common/src/main/java/com/genexus/db/IFieldGetter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ public interface IFieldGetter
3333
String getMultimediaUri(int columnIndex) throws SQLException;
3434
String getMultimediaUri(int columnIndex, boolean absPath) throws SQLException;
3535
java.util.UUID getGUID(int columnIndex) throws SQLException;
36+
Float[] getGxembedding(int columnIndex) throws SQLException;
3637
}

common/src/main/java/com/genexus/db/IFieldSetter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public interface IFieldSetter
3535
public void setBLOBFile(int index, String fileName) throws SQLException;
3636
public void setBLOBFile(int index, String fileName, boolean isMultiMedia) throws SQLException;
3737
public void setBLOBFile(int index, String fileName, boolean isMultiMedia, boolean downloadContent) throws SQLException;
38+
public void setEmbedding(int index, Float[] value) throws SQLException;
3839

3940
public void setVarchar(int index, String value, int length, boolean allowsNull) throws SQLException;
4041
public void setLongVarchar(int index, String value, boolean allowsNull) throws SQLException;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.genexus.util;
2+
3+
import com.genexus.GXBaseCollection;
4+
import com.genexus.SdtMessages_Message;
5+
6+
public class CallResult {
7+
private boolean success = true;
8+
private boolean fail;
9+
private final GXBaseCollection<SdtMessages_Message> messages = new GXBaseCollection<>();
10+
11+
public boolean success() {
12+
return success;
13+
}
14+
15+
public void setFail() {
16+
fail = true;
17+
success =false;
18+
}
19+
20+
public boolean fail() {
21+
return fail;
22+
}
23+
24+
public void addMessage(SdtMessages_Message message) {
25+
messages.add(message);
26+
}
27+
public GXBaseCollection<SdtMessages_Message> getMessages() {
28+
return messages;
29+
}
30+
}

0 commit comments

Comments
 (0)