diff --git a/convertanything/__init__.py b/convertanything/__init__.py index 21d260b..43ac065 100644 --- a/convertanything/__init__.py +++ b/convertanything/__init__.py @@ -47,7 +47,10 @@ def convertanything( }, ) response = completion.choices[0].message.content - response = str(response).split("```json")[1].split("```")[0].strip() + if "```json" in response: + response = response.split("```json")[1].split("```")[0].strip() + elif "```" in response: + response = response.split("```")[1].strip() try: response = json.loads(response) return model(**response) diff --git a/setup.py b/setup.py index 1856fa8..5fa4e64 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name="convertanything", - version="0.0.5", + version="0.0.6", description="convertanything is a Python package that allows you to convert any text into a structured format according to the schema provided.", long_description=long_description, long_description_content_type="text/markdown",