Skip to main content

This module is for Gemini Api Intraction, TwoSum operations and subsequence checks

Project description

Tamilan Python Library

A Python library for interacting with the Gemini API, performing TwoSum operations, checking for subsequences, and chatting with an AI-powered chatbot.

Features

  • AI Class: Uses the Gemini API to generate text responses based on a given prompt.
  • TwoSumK & TwoSum Functions: Efficient solutions to find pairs of numbers in a sorted list that sum to a target.
  • Subsequence Check: Verifies if one string is a subsequence of another.
  • Bot Class: A chatbot powered by the Gemini API that interacts with users.

Installation

To install the library, you can use pip:

pip install tamilan

## Usage

### 1. **Importing the Library**

You can import the functions and classes from the `tamilan` package as follows:

```python
from tamilan import AI, Bot, twoSumK, twoSum, is_subsequence

2. Using the AI Class

The AI class allows you to generate text using the Gemini API.

Example:

# Initialize the AI instance with your Gemini API key
api_key = "YOUR_API_KEY"  # Replace with your actual API key
ai = AI(api_key)

# Generate a response based on a prompt
prompt = "What is the capital of France?"
response = ai.generate_text(prompt)
print(response)

3. Using the Bot Class

The Bot class allows you to interact with an AI chatbot. The chatbot responds to your inputs by calling the Gemini API.

Example:

# Initialize the chatbot with your Gemini API key
bot = Bot(api_key="YOUR_API_KEY")  # Replace with your actual API key

# Start a chat with the chatbot
bot.chat()

Type your input in the terminal, and the chatbot will respond. To end the chat, type 'exit'.

4. Using the twoSumK and twoSum Functions

These functions help you find two numbers in a sorted list that sum up to a target.

Example: twoSumK (1-based index)

numbers = [1, 2, 3, 4, 5]
target = 6
result = twoSumK(numbers, target)
print(result)  # Output: [1, 5] (1-based index)

Example: twoSum (0-based index)

numbers = [1, 2, 3, 4, 5]
target = 6
result = twoSum(numbers, target)
print(result)  # Output: [0, 4] (0-based index)

5. Using the is_subsequence Function

This function checks if one string is a subsequence of another.

Example:

s = "abc"
t = "ahbgdc"
result = is_subsequence(s, t)
print(result)  # Output: True

6. Helper Function

The helper() function provides a list of function signatures for reference.

from tamilan import helper
functions = helper()
print(functions)
# Output:
# ['twoSumK(numbers: List[int], target: int) -> List[int]',
#  'twoSum(numbers: List[int], target: int) -> List[int]',
#  'is_subsequence(s: str, t: str) -> bool']

Contributing

Contributions are welcome! Please feel free to fork the repository, submit pull requests, or open issues for suggestions or improvements.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

tamilan-0.1.9.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

tamilan-0.1.9-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file tamilan-0.1.9.tar.gz.

File metadata

  • Download URL: tamilan-0.1.9.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for tamilan-0.1.9.tar.gz
Algorithm Hash digest
SHA256 7c2e24cb180ecc7de2f7cc5151306dabcfcaf05ee0eaf1ca491d5954d46176a3
MD5 fb4a3341251e740bc3791a74cffb8589
BLAKE2b-256 f2b6207b40c7a622e5f9ecd23108b37fbec2860621b0b13370b47cc799d9113c

See more details on using hashes here.

File details

Details for the file tamilan-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: tamilan-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for tamilan-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 f9fd7b83d4ebb5f5c40c901ba9374c334c50ea6c8ee853dd17318237d3cb0624
MD5 b0dcbc94359ae5ec7f111b7ca73ce80b
BLAKE2b-256 cf5683dbff84a93974075ae059ac29cdaf81d6d23d71a0c4811ad89a58d38ced

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