Skip to main content

Libreria para gestionar datos del historico del proyecto GPTravel

Project description

La librería del equipo JourneyGen ofrece dos métodos que permitirán al cliente conocer su histórico dentro GPTravel.

ins_historico(usr, tipoIA, num_chat, lista_msg, contexto)

PRE:

  • usr (str): es un nombre de usuario válido.

  • tipoIA (enum): se trata de un string de entre la lista ['PASADO', 'PRESENTE', 'FUTURO', 'COMPRA'].

  • num_chat (int): se trata de un número válido que puede ser:

    1. El identificador de chat existente.

    2. None (en este caso, crearía un chat nuevo).

  • lista_msg: es una lista de diccionarios formato {'role': '', 'content': ''}, donde "role" puede solo tomar 3 valores (string) significativos ("user", "assistant", "system").

  • contexto (str): es un string que indica el contexto que use la IA que esté teniendo la conversación.

POST: Inserta un nuevo mensaje a la base de datos de CASH BE (Backend).

DEVUELVE: el valor identificativo (int) asociado al chat sobre el que se insertan los mensajes.


get_historico(usr, tipoIA, num_chat)

PRE:

  • usr (str): es un nombre de usuario válido.

  • tipoIA (enum): se trata de un string de entre la lista ['PASADO', 'PRESENTE', 'FUTURO', 'COMPRA'].

  • num_chat (int): es un int correspondiente a un identificador de chat existente

DEVUELVE: Una lista de diccionarios (JSON) con el siguiente formato:

{'role': '', 'content': ''}

  1. El primer mensaje será con role = 'system' y content = 'contexto de la IA'.

  2. El resto de mensajes serán pares que alternarán entre mensajes del usuario y la IA.

Las funciones ins_historico() y get_historico() incorporan un parámetro extra llamado "url". Por defecto, este parámetro contiene la URL donde está desplegado el API de CASH BE. Esta URL puede sobrescribirse para hacer pruebas en local.


Para instalar esta librería basta con hacer: pip install journeylib.

Es posible encontrar la librería en PyPi en el siguiente link: https://pypi.org/project/journeylib/

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

journeylib-2.0.12.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

journeylib-2.0.12-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file journeylib-2.0.12.tar.gz.

File metadata

  • Download URL: journeylib-2.0.12.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for journeylib-2.0.12.tar.gz
Algorithm Hash digest
SHA256 c8488de796616e863eff8a683313dea50f27a781ebe4f7433129e206c5fcf77b
MD5 6139d5d307e49095107df7688dbabf73
BLAKE2b-256 c0c1602d77b22e80af090d77cca7bbaf59bab4a96d8a91a2b9f95171e448e5cc

See more details on using hashes here.

File details

Details for the file journeylib-2.0.12-py3-none-any.whl.

File metadata

  • Download URL: journeylib-2.0.12-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for journeylib-2.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 f137811ce2539ff8cadde457b268c302c184b6f1268b30f04c3c525a34a9e0c7
MD5 f3ffd90929e772a9f7a08028b1a5b5d5
BLAKE2b-256 d9befc51cd76c0e58693568d15746e32bea1801bb57c775505815bd05e8e85a8

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