Chainlit / literalai-python

https://docs.getliteral.ai/
Apache License 2.0
8 stars 0 forks source link

fix open debug playground #93

Closed constantinidan closed 1 month ago

constantinidan commented 1 month ago

https://linear.app/literalai/issue/ENG-1698/fix-langchain-callback-when-linking-prompt

linear[bot] commented 1 month ago
ENG-1698 fix langchain callback when linking prompt

``` 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)

willydouhard commented 1 month ago

You should run the precommit locally to make sure the formatting/type checking is passing @constantinidan

desaxce commented 1 month ago

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?