MCPcopy Create free account
hub / github.com/anus-dev/ANUS / isValidResponse

Function isValidResponse

packages/core/src/core/anusChat.ts:31–40  ·  view source on GitHub ↗

* Returns true if the response is valid, false otherwise.

(response: GenerateContentResponse)

Source from the content-addressed store, hash-verified

29 * Returns true if the response is valid, false otherwise.
30 */
31function isValidResponse(response: GenerateContentResponse): boolean {
32 if (response.candidates === undefined || response.candidates.length === 0) {
33 return false;
34 }
35 const content = response.candidates[0]?.content;
36 if (content === undefined) {
37 return false;
38 }
39 return isValidContent(content);
40}
41
42function isValidContent(content: Content): boolean {
43 if (content.parts === undefined || content.parts.length === 0) {

Callers 1

processStreamResponseMethod · 0.85

Calls 1

isValidContentFunction · 0.85

Tested by

no test coverage detected