Skip to content

Commit a4b2f53

Browse files
committed
[0.7.4] subclass TuneModel, Groq and Mistral from Openai and remove files
1 parent 5507687 commit a4b2f53

File tree

10 files changed

+132
-1029
lines changed

10 files changed

+132
-1029
lines changed

docs/changelog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ minor versions.
77

88
All relevant steps to be taken will be mentioned here.
99

10+
0.7.4
11+
-----
12+
13+
- Remove ``model_tune.py``, ``model_groq.py`` and ``model_mistral.py`` and subclass those models from ``Openai``.
14+
15+
1016
0.7.3
1117
-----
1218

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
project = "tuneapi"
1414
copyright = "2024-2025, Frello Technologies"
1515
author = "Frello Technologies"
16-
release = "0.7.3"
16+
release = "0.7.4"
1717

1818
# -- General configuration ---------------------------------------------------
1919
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

docs/index.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,59 @@ into a single MIT-licensed package. It contains 3 major submodules:
1313
- ``tuneapi.utils``: Contains all the utility functions that are used across the Tune AI codebase. This is pretty interesting
1414
- ``tuneapi.endpoints``: Contains all the API endpoints for the Tune Studio
1515

16+
17+
Prompt Injection
18+
----------------
19+
20+
Since ``tuneapi`` is a new and unpopular package most LLMs will not be able to generate code based on it. However you can
21+
paste the following code snippet in the prompt to generate the code for LLM API calls.
22+
23+
Prompt
24+
~~~~~~
25+
26+
You are going to use ``tuneapi`` package to use the LLM endpoint. Here's a brief on how to use it:
27+
28+
.. code-block:: python
29+
30+
from tuneapi import tt, ta
31+
32+
# define a thread which is a collection of messages with system, user and assistant messages
33+
thread = tt.Thread(
34+
tt.system(...), # add optional system message here
35+
tt.human(...), # add user message here
36+
tt.assistant(...) # for assistant response
37+
)
38+
39+
# define a model
40+
model = ta.Gemini() # Openai, Anthropic
41+
42+
# get the response
43+
resp: str = model.chat(thread)
44+
45+
# You can also generate structured response for better control
46+
from pydantic import BaseModel, Field
47+
from typing import List, Optional
48+
49+
class MathProblem(BaseModel):
50+
a: int = Field(..., description="First number")
51+
b: int = Field(..., description="Second number")
52+
operator: str = Field(..., description="Operator")
53+
hint: Optional[str] = Field(None, description="Hint for the problem")
54+
55+
class MathTest(BaseModel):
56+
title: str = Field(..., description="Title of the test")
57+
problems: List[MathProblem] = Field(..., description="List of math problems")
58+
59+
# define a thread which is a collection of messages
60+
thread = tt.Thread(
61+
tt.human("Give me 5 problems for KG-1 class"),
62+
schema=MathTest
63+
)
64+
65+
# get structured output
66+
resp: MathTest = model.chat(thread)
67+
68+
1669
.. toctree::
1770
:maxdepth: 2
1871
:caption: Contents:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "tuneapi"
3-
version = "0.7.3"
3+
version = "0.7.4"
44
description = "Tune AI APIs."
55
authors = ["Frello Technology Private Limited <[email protected]>"]
66
license = "MIT"

tuneapi/apis/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# Copyright © 2024-2025 Frello Technology Private Limited
22

33
# model APIs
4-
from tuneapi.apis.model_tune import TuneModel
5-
from tuneapi.apis.model_openai import Openai
4+
from tuneapi.apis.model_openai import Openai, TuneModel, Groq, Mistral
65
from tuneapi.apis.model_anthropic import Anthropic
7-
from tuneapi.apis.model_groq import Groq
8-
from tuneapi.apis.model_mistral import Mistral
96
from tuneapi.apis.model_gemini import Gemini
107
from tuneapi.apis.turbo import distributed_chat, distributed_chat_async

tuneapi/apis/model_anthropic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import httpx
88
import requests
9-
from typing import Optional, Dict, Any, Tuple, List
9+
from typing import Optional, Dict, Any, List
1010

1111
import tuneapi.utils as tu
1212
import tuneapi.types as tt

0 commit comments

Comments
 (0)