Skip to main content

No project description provided

Project description

Typechat.py

A python implement to makes it easy to build natural language interfaces using types.

Install

pip install typechatpy

Usage

see simple and more in example.

from typing import List
from pydantic import BaseModel
from typechatpy.translator import Translator

class VenueData(BaseModel):
    venue: str
    description: str

class Response(BaseModel):
    data: List[VenueData]

prompt = "Provide 3 suggestions for specific places to go to in Seattle on a rainy day."

def main():
    t = Translator()

    # manual set
    res = t.generate(prompt, Response, VenueData)

    # auto analyse
    res = t.generate(prompt, auto=True)

    # set from globals
    res = t.generate(prompt, *globals().values())

    print(res)

if __name__ == "__main__":
    main()

Example

see simple for more detail (the response sample as bellow).

{
  "data": [
    {
      "venue": "Seattle Art Museum",
      "description": "Explore the extensive collection of art from around the world at the Seattle Art Museum. From contemporary art to ancient artifacts, there is something for everyone to enjoy."
    },
    {
      "venue": "Pike Place Market",
      "description": "Indulge in a unique shopping experience at Pike Place Market. Browse through local produce, crafts, and specialty shops, and enjoy a variety of delicious food options."
    },
    {
      "venue": "Chihuly Garden and Glass",
      "description": "Marvel at the stunning glass artworks created by Dale Chihuly at the Chihuly Garden and Glass exhibit. The vibrant colors and intricate designs are sure to captivate your senses."
    }
  ]
}

TODO

  • translator
  • validator
  • llm interact

Ref

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

typechatpy-0.3.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

typechatpy-0.3.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file typechatpy-0.3.0.tar.gz.

File metadata

  • Download URL: typechatpy-0.3.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for typechatpy-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6e1141a735b8fece8069adfb5b1eeb0d39bcb01bf8dcfc20d5459e9fe874bf84
MD5 03e7a81bebf58a8c16000a6c5fbf923f
BLAKE2b-256 b5c755ca2684ce0460d368d0617703da7a14d0164ebdfd0f73d5d8330f796927

See more details on using hashes here.

File details

Details for the file typechatpy-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: typechatpy-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for typechatpy-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e77c0174106bc79bb72f1baa3aa06e0634cb1b5d821c1f23b28db0c4ef1c5316
MD5 cf3c74a35e7aee827ee775077ba18ce5
BLAKE2b-256 3322f69a1f337e5f2b15097ff39a52f2e42cb98edddb202ccee6fdad271ec89a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page