Skip to content

Commit cd8baf5

Browse files
committed
Create CohereTextResponse.java
Add the response model for Cohere generate API.
1 parent acc75bd commit cd8baf5

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
package com.intellijava.core.model;
2+
3+
import java.util.List;
4+
5+
/**
6+
*
7+
* CohereTextResponse is a model class used to parse the response from the Cohere text API.
8+
*
9+
* @author github.com/Barqawiz
10+
*
11+
*/
12+
public class CohereTextResponse {
13+
14+
/** A unique identifier for the response.*/
15+
private String id;
16+
private List<Generation> generations;
17+
private String prompt;
18+
19+
public static class Generation {
20+
private String id;
21+
private String text;
22+
23+
/**
24+
* Get the unique identifier for the generation.
25+
*
26+
* @return the unique identifier for the generation.
27+
*/
28+
public String getId() {
29+
return id;
30+
}
31+
32+
/**
33+
* Sets the unique identifier for the generation.
34+
*
35+
* @param id the unique identifier for the generation.
36+
*/
37+
public void setId(String id) {
38+
this.id = id;
39+
}
40+
41+
/**
42+
* Get the model generated text.
43+
*
44+
* @return the generated text.
45+
*/
46+
public String getText() {
47+
return text;
48+
}
49+
50+
/**
51+
* Sets the model generated text.
52+
*
53+
* @param text the generated text.
54+
*/
55+
public void setText(String text) {
56+
this.text = text;
57+
}
58+
}
59+
60+
/**
61+
* Get the unique identifier for the response.
62+
*
63+
* @return the unique identifier for the response.
64+
*/
65+
public String getId() {
66+
return id;
67+
}
68+
69+
/**
70+
* Sets the unique identifier for the response.
71+
*
72+
* @param id the unique identifier for the response.
73+
*/
74+
public void setId(String id) {
75+
this.id = id;
76+
}
77+
78+
/**
79+
* Get the list of generated texts.
80+
*
81+
* @return the list of generated texts.
82+
*/
83+
public List<Generation> getGenerations() {
84+
return generations;
85+
}
86+
87+
/**
88+
* Sets the list of generated texts.
89+
*
90+
* @param generations the list of generated texts.
91+
*/
92+
public void setGenerations(List<Generation> generations) {
93+
this.generations = generations;
94+
}
95+
96+
/**
97+
*
98+
* Get the user prompt.
99+
*
100+
* @return prompt the user input.
101+
*/
102+
public String getPrompt() {
103+
return prompt;
104+
}
105+
106+
/**
107+
* Sets the user prompt.
108+
*
109+
* @param prompt the user input.
110+
*/
111+
public void setPrompt(String prompt) {
112+
this.prompt = prompt;
113+
}
114+
}

0 commit comments

Comments
 (0)