Skip to main content

An unofficial Formosa Foundation Model API client implementation compatible with LangChain and OpenAI

Project description

unofficial_ffm_openai_client

An unofficial Formosa Foundation Model client implementation based on OpenAI and LangChain

Introduction

This is an unofficial Python client implementation for the Formosa Foundation Model public endpoint, compatible with the OpenAI Python client and LangChain. Currently, it only implements the Conversation API and supports the public endpoint. Note that the synchronous API is not yet implemented.

Changelog

  • 0.1.3 - Support function calls.
  • 0.1.2 - Support embeddings.

Usage

Install using pypi:

pip install unofficial-ffm-openai

You can use it similarly to the original OpenAIChat, with a few different parameters:

from ffm.langchain.language_models.ffm import FfmChatOpenAI

chat_ffm = FfmChatOpenAI(
    ffm_endpoint="https://api-ams.twcc.ai/api",
    max_tokens=1000,
    temperature=0.5,
    top_k=50,
    top_p=1.0,
    frequency_penalty=1.0,
    ffm_api_key="your key",
    ffm_deployment="ffm-mistral-7b-32k-instruct",  # or other model name
    streaming=True,
    callbacks=callbacks
)
from ffm.embeddings import FFMEmbeddings

embedding = FFMEmbeddings(
    base_url="",
    api_key="your key")

Limitation

Currently, it has only been tested with the following dependencies:

langchain                         0.1.20
langchain-community               0.0.38
langchain-core                    0.1.52
langchain-openai                  0.1.7
langchain-text-splitters          0.0.2
langchainhub                      0.1.15

and the OpenAI client:

openai                            1.30.1

TODO

  • Full implementation for the synchronous API.

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

unofficial_ffm_openai-0.1.3.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

unofficial_ffm_openai-0.1.3-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file unofficial_ffm_openai-0.1.3.tar.gz.

File metadata

  • Download URL: unofficial_ffm_openai-0.1.3.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.11

File hashes

Hashes for unofficial_ffm_openai-0.1.3.tar.gz
Algorithm Hash digest
SHA256 48920222287509801d1ca233bfaae553aee55ae6656b511dea7dba6826da1b76
MD5 24ff77bdee67f9bfbb6198743fbee3fd
BLAKE2b-256 f898d104680bf21104faf04013ac966c45c5c9263a6341aa9286dc54466a4378

See more details on using hashes here.

File details

Details for the file unofficial_ffm_openai-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for unofficial_ffm_openai-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4fa622c3457847ad75ba3e899e8c81efa697a9744dc07b1de6e9fbb74cf0e15e
MD5 1401f868ef1bb7b07a6177d9607002bc
BLAKE2b-256 af6459ab04ba9bb243267124fba3c63a39f26f6036c60e9f8b200965cd1a50b3

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