Skip to content

Commit

Permalink
Allow or json
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed May 1, 2024
1 parent 13c5674 commit f09c0bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion convertanything/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f09c0bd

Please sign in to comment.