Skip to main content

No project description provided

Project description

Fazah

Fazah is a Python library that enables seamless language translation for interactions with Large Language Models (LLMs). It allows users to communicate with LLMs in any language, ensuring accurate and comprehensive responses by leveraging the vast amount of information available in English on the internet.

Supported LLMs

Fazah seamlessly integrates with popular LLM APIs, including:

  • Anthropic
  • OpenAI
  • Google Gemini
  • And more!

Installation

To install Fazah, use pip:

pip install fazah

Usage

To use Fazah, start by importing the necessary module:

from fazah import Fazah

Using Fazah with Anthropic API

  1. Initialize the Anthropic client with your API key:
client = Anthropic(api_key="YOUR_API_KEY")
  1. Create a function to generate responses using the Anthropic API:
def create_anthropic_llm_model():
    def generate(prompt):
        response = client.messages.create(
            model="claude-3-haiku-20240307",
            max_tokens=1024,
            system="You are a helpful assistant.",
            messages=[
                {"role": "user", "content": prompt}
            ]
        )
        if isinstance(response.content, list):
            response.content = response.content[0].text
        elif hasattr(response.content, 'text'):
            response.content = response.content.text
        return response.content
    return generate
  1. Create an instance of the Fazah class with the Anthropic LLM model:
llm_model = create_anthropic_llm_model()
fazah = Fazah(llm_model)

Using Fazah with Google Gemini API

  1. Set up the Google Gemini API key:
API_KEY = "YOUR_GEMINI_API_KEY"
genai.configure(api_key=API_KEY)
  1. Create an instance of the Google Gemini model:
model = genai.GenerativeModel('gemini-pro')
  1. Create an instance of the LLM model using Google Gemini:
def create_llm_model():
    def generate(prompt):
        response = model.generate_content(prompt)
        return response.text
    return generate
  1. Create an instance of the Fazah class with the Google Gemini LLM model:
llm_model = create_llm_model()
fazah = Fazah(llm_model)

Using Fazah with OpenAI API

  1. Set up the OpenAI API key:
OPENAI_API_KEY = "YOUR_OPENAI_API_KEY"
client = OpenAI(api_key=OPENAI_API_KEY)
  1. Create an instance of the OpenAI Chat model:
def create_chatgpt_llm_model():
    def generate(prompt):
        response = client.chat.completions.create(
            model="gpt-3.5-turbo",
            messages=[
                {"role": "system", "content": "You are a helpful assistant."},
                {"role": "user", "content": prompt}
            ]
        )
        return response.choices[0].message.content
    return generate
  1. Create an instance of the Fazah class with the OpenAI Chat model:
llm_model = create_chatgpt_llm_model()
fazah = Fazah(llm_model)

Now you can use the fazah object to process text in any language. Fazah will automatically translate the prompt to English, pass it to the respective LLM API, and then translate the generated response back to the original language.

Key Features

  • Automatic translation of user prompts from any language to English
  • Leverages the extensive English language resources available on the internet
  • Translates LLM responses back into the original language of the user prompt
  • Seamless integration with popular LLM APIs
  • Enhances the user experience by providing localized interactions
  • Enables users to ask complex questions and receive comprehensive responses in their preferred language

Support

If you encounter any issues or have questions about Fazah, please contact Ajlang5@wisc.edu or wjfoster2@wisc.edu.


With Fazah, you can unlock the full potential of LLMs for a global audience, breaking down language barriers and providing an inclusive and accessible experience for all users.

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

fazah-3.31.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

fazah-3.31-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file fazah-3.31.tar.gz.

File metadata

  • Download URL: fazah-3.31.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for fazah-3.31.tar.gz
Algorithm Hash digest
SHA256 4f754d5e137fb03bcd0ed34ca2a88c02a861b4c6e14d620162a08ac9041563b6
MD5 3181f841ab96dd0c2e68efd4b16c4b16
BLAKE2b-256 bd12720837bd4e3dbb12a27ece8e2b6d12a63d381f3a79fac3236a40689fe03c

See more details on using hashes here.

File details

Details for the file fazah-3.31-py3-none-any.whl.

File metadata

  • Download URL: fazah-3.31-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for fazah-3.31-py3-none-any.whl
Algorithm Hash digest
SHA256 1486d73b80008a9ae71dd59ed5036a95f3ac5420c71672aaf26f4760f8a126eb
MD5 7c96e049b73f4d908a305d5cafbf1698
BLAKE2b-256 f1838d0fd2c3011dc0a1e0d4f74bb882611127d176aa25210bbc9649387da30a

See more details on using hashes here.

Supported by

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