MCPcopy Create free account
hub / github.com/AsyncFuncAI/deepwiki-open / parse_embedding_response

Method parse_embedding_response

api/dashscope_client.py:286–303  ·  view source on GitHub ↗

Parse the embedding response to a EmbedderOutput.

(
        self, response: CreateEmbeddingResponse
    )

Source from the content-addressed store, hash-verified

284 return CompletionUsage(completion_tokens=0, prompt_tokens=0, total_tokens=0)
285
286 def parse_embedding_response(
287 self, response: CreateEmbeddingResponse
288 ) -> EmbedderOutput:
289 """Parse the embedding response to a EmbedderOutput."""
290 # Add detailed debugging
291 try:
292 result = parse_embedding_response(response)
293 if result.data:
294 log.info(f"🔍 Number of embeddings: {len(result.data)}")
295 if len(result.data) > 0:
296 log.info(f"🔍 First embedding length: {len(result.data[0].embedding) if hasattr(result.data[0], 'embedding') else 'N/A'}")
297 else:
298 log.warning(f"🔍 No embedding data found in result")
299 return result
300 except Exception as e:
301 log.error(f"🔍 Error parsing DashScope embedding response: {e}")
302 log.error(f"🔍 Raw response details: {repr(response)}")
303 return EmbedderOutput(data=[], error=str(e), raw_response=response)
304
305 def convert_inputs_to_api_kwargs(
306 self,

Callers 3

callMethod · 0.95
acallMethod · 0.95
acallMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected