semvec/pypi-packages huggingface dataset:
openai-model-router 0.1
Automatically route your prompts to the best OpenAI model

# OpenAI Model Router

Given the number of OpenAI models, it can get tricky to identify which model to call for a given prompt. So we built the Model Router, to dynamically select the *most appropriate model* for our prompt.

List of supported models: `gpt-3.5-turbo, gpt-3.5-turbo-0613, gpt-3.5-turbo-16k, gpt-3.5-turbo-16k-0613`
Support for more models coming soon ;)

## Usage

Simply use the Model Router instead of using OpenAI directly. And, no need to specify the model anymore!

### Example 1: Simple Message

#### Before
```python
import openai
openai.api_key = "sk-..."

chat_completion = openai.ChatCompletion.create(
    model="gpt-3.5-turbo",
    messages=[{"role": "user", "content": "Hello world"}]
)

print(chat_completion.choices[0].message.content)
```

#### After
```python
from model_router import openai # import from model_router instead
openai.api_key = "sk-..."

chat_completion = openai.ChatCompletion.create(
    # skip the model
    messages=[{"role": "user", "content": "Hello world"}]
)

print(chat_completion.choices[0].message.content)
```

### Example 2: Function Calling

#### Before
```python
import openai
openai.api_key = "sk-..."

chat_completion = openai.ChatCompletion.create(
    model="gpt-3.5-turbo-0613",
    messages=[{"role": "user", "content": "What's the weather like in Boston?"}],
    functions=[...],
    function_call="auto",
)

print(chat_completion.choices[0].message.content)
```

#### After
```python
from model_router import openai # import from model_router instead
openai.api_key = "sk-..."

chat_completion = openai.ChatCompletion.create(
    # skip the model
    messages=[{"role": "user", "content": "What's the weather like in Boston?"}],
    functions=[...],
    function_call="auto",
)

print(chat_completion.choices[0].message.content)
```

## Questions/Feedback

For any questions/feedback, please reach out to [@sambuddha_basu](https://twitter.com/sambuddha_basu)
matlab-tictoc 1.3.0
A timing package that mimics MATLAB's tic and toc functionality
Requires Python: >=3.7

# MATLAB Tic Toc

A Python module to make timing in python easier by mimicing MATLAB's `tic` and `toc` functions.
`tic` starts a timer by recording the current time, and `toc` uses the start time to find the elapsed time.

The included `func_timer` decorator uses `tic` and `toc` to give the elapsed time of the wrapped function.


## Usage

```
from tictoc import tic, toc

tic()              # starts the global timer
timer = tic()      # assigns an instance of the Timer class to the timer var without affecting the global timer

toc()              # Prints elapsed time from tic() call
toc(timer)         # Prints elapsed time for the timer given

time = toc(timer)  # Assigns elapsed time to a variable

timer.reset()      # Resets the timer var start time

tic()              # Restarts the global timer
```


## Examples

```
from time import sleep
from tictoc import tic, toc, func_timer


tic()  # starts global timer
sleep(1)
toc()
sleep(2)
toc()
```
>Elapsed time is 1.00547 seconds.

>Elapsed time is 3.00886 seconds.

```
timer = tic()
sleep(1)
print(f'Timer Assigned to var: {toc(timer)}')
print(f'Global Timer: {toc()}')
```
>Timer Assigned to var: 1.0057699

>Global Timer: 4.013537

```
@func_timer
def func():
    sleep(2)

func()
```
>Elapsed time for function func is 2.00556969 seconds.