Closed constantinidan closed 3 months ago
``` def process_content(content: Any) -> Tuple[Dict, Optional[str]]: if content is None: return {}, None if isinstance(content, dict): return content, "json" elif isinstance(content, str): return {"content": content}, "text" else: return {"content": str(content)}, "text" ``` [image.png](https://uploads.linear.app/6a41a374-76e1-40c2-a405-51050761590c/393f53e2-8753-4910-8858-92c33b180069/67eff77c-b30e-41d2-be80-43154769ad13) => FIX ``` def process_content(content: Any) -> Tuple[Dict, Optional[str]]: if content is None: return {}, None if isinstance(content, dict): return content, "json" elif isinstance(content, str): return content else: return {"content": str(content)}, "text" ``` [image.png](https://uploads.linear.app/6a41a374-76e1-40c2-a405-51050761590c/d40b1e5a-cb52-4b0c-a284-e467ef705db6/f8ebf48c-f3d6-4e56-b6d1-2b9e54b3f9ac)
You should run the precommit locally to make sure the formatting/type checking is passing @constantinidan
I'd introduced a bug in https://github.com/Chainlit/python-client/pull/86.
So I added:
@willydouhard Did we use to have a Langchain example where we have a JSON-formatted variable?
https://linear.app/literalai/issue/ENG-1698/fix-langchain-callback-when-linking-prompt