diff --git a/convertanything/__init__.py b/convertanything/__init__.py index 43ac065..63fe1ce 100644 --- a/convertanything/__init__.py +++ b/convertanything/__init__.py @@ -11,17 +11,13 @@ def convertanything( server="https://api.openai.com", llm="gpt-3.5-turbo-16k", ): - if not isinstance(input_string, str): - input_string = str(input_string) + input_string = str(input_string) openai.base_url = f"{server}/v1/" openai.api_key = api_key if api_key else server fields = model.model_fields field_descriptions = [f"{field}: {fields[field]}" for field in fields] schema = "\n".join(field_descriptions) - system_message = "Act as a JSON converter that converts any text into the desired JSON format based on the schema provided. Respond only with JSON in a properly formatted markdown code block, no explanations." - if not llm.startswith("gpt"): - system_message += " After the request is fulfilled, end with ." - prompt = f""" + prompt = f"""Act as a JSON converter that converts any text into the desired JSON format based on the schema provided. Respond only with JSON in a properly formatted markdown code block, no explanations. **Reformat the following information into a structured format according to the schema provided:** ## Information: @@ -33,8 +29,6 @@ def convertanything( JSON Structured Output: """ response = "" - if llm.startswith("gpt"): - prompt = f"{system_message}\n{prompt}" completion = openai.chat.completions.create( model=llm, messages=[{"role": "user", "content": prompt}], @@ -42,9 +36,6 @@ def convertanything( max_tokens=1024, top_p=0.95, stream=False, - extra_body={ - "system_message": system_message, - }, ) response = completion.choices[0].message.content if "```json" in response: diff --git a/setup.py b/setup.py index 5fa4e64..4eef4e3 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name="convertanything", - version="0.0.6", + version="0.0.8", 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",