Skip to content

Releases: minimaxir/simpleaichat

v0.2.2: Misc fixes/improvements

24 Jul 01:43
Compare
Choose a tag to compare
  • Allow fd to take in arbitrary parameters that could be used for Field (I have a cool project with this in mind!)
  • Use argparse for the CLI app #50 (TODO: remove fire dependency)
  • Pass str urls for building api_url #52
  • Added an assert if using title in an input/output schema, since it's a reserved keyword that we're already stripping. Note that this currently only affects the top-level schema.

v0.2.1: Pydantic v2.0

03 Jul 18:16
26f0036
Compare
Choose a tag to compare

This release updates simpleaichat to use Pydantic v2.0 and replace all depreciated functions therein. simpleaichat now requires pydantic>=2.0. There should be no breaking changes from this migration, but there should be a notable speedboost from the clientside!

Other changes

  • Internal Refactoring #19
  • API key from AIChat constructor has priority over env variable, for consistency #22
  • ChatMessage string returns a stringified dictionary instead of the text only. #29
  • A HTTP proxy can be specified by the https_proxy environment variable. This behavior will likely change in an upcoming release #34

v0.2.0: Schema input/output

19 Jun 02:58
Compare
Choose a tag to compare

This release supports schema input/output, courtesy of OpenAI's new function calling feature!

Schema

from pydantic import BaseModel, Field

ai = AIChat(
    console=False,
    save_messages=False,  # with schema I/O, messages are never saved
    model="gpt-3.5-turbo-0613",
    params={"temperature": 0.0},
)

class get_event_metadata(BaseModel):
    """Event information"""

    description: str = Field(description="Description of event")
    city: str = Field(description="City where event occured")
    year: int = Field(description="Year when event occured")
    month: str = Field(description="Month when event occured")

# returns a dict, with keys ordered as in the schema
ai("First iPhone announcement", output_schema=get_event_metadata)
{'description': 'The first iPhone was announced by Apple Inc.',
 'city': 'San Francisco',
 'year': 2007,
 'month': 'January'}

There's a lot you can do with it, and this implementation is just the beginning.

Notes:

  • In all cases, no messages are saved when using schema to prevent unintended behavior. You will have to manage the intermediate output yourself for the time being, if you want to chain inputs.
  • Input and Output schema works for normal generation, both sync and async.
  • For streaming, only input schema will work, as streaming output structured data would not play nice.
  • Neither is currently supported for working with tools; that still needs further testing.

Other changes:

  • A session context manager was added (#7) for cases where you want to script a temporary conversation, in both sync and async flavors.
  • The finish_reason is saved from ChatGPT outputs (#14)
  • You can now pass an output_path to save_session().

v0.1.1

09 Jun 04:07
Compare
Choose a tag to compare

Fix missing dependency #1

v0.1.0: Initial Public release!

08 Jun 04:37
Compare
Choose a tag to compare

v0.0.1: Initial testing release

07 Jun 03:10
Compare
Choose a tag to compare

Initial testing release (to reserve the name on PyPI and test on Colab)