Text Generation
Transformers
Safetensors
PyTorch
English
llama
api
open-api
swagger
api doc
api call
code
instruction_tuned
basemodel
RL Tuned
text-generation-inferenc
conversational
text-generation-inference
Instructions to use PipableAI/pip-api-expert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PipableAI/pip-api-expert with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PipableAI/pip-api-expert") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("PipableAI/pip-api-expert") model = AutoModelForCausalLM.from_pretrained("PipableAI/pip-api-expert", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PipableAI/pip-api-expert with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PipableAI/pip-api-expert" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PipableAI/pip-api-expert", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/PipableAI/pip-api-expert
- SGLang
How to use PipableAI/pip-api-expert with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "PipableAI/pip-api-expert" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PipableAI/pip-api-expert", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "PipableAI/pip-api-expert" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PipableAI/pip-api-expert", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use PipableAI/pip-api-expert with Docker Model Runner:
docker model run hf.co/PipableAI/pip-api-expert
Update README.md
Browse files28 unmodified lines293031323334354 unmodified lines404142434445464748495051525354554 unmodified lines6061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316428 unmodified linesA 1.3 bn state of the art model for api calling , documentation, testing management.The tasks that the model can accomplish are the following.```javascript1. Convert any bad format text to open api2. Convert any bad format text to mark down.3. Given docs generate and execute the api call in python4 unmodified linesWe used a simulator and a form of policy gradient to train the model to self instruct itself to make documents and then perform executable calls on the document.## Benchmarking :For benchmarking purposes we are using Semantic Evaluation for Text-to-SQL withDistilled Test Suites, an officially accepted evaluation framework for Spider, SParC, and CoSQL which was proposed by a research team of Yale and Berkeley.The benchmark contains 2200 test data pointsHere is the link to run the evaluation:## LicenseThe model is open source under apache 2.0. License4 unmodified lines```bashpip install transformers```### Prompt```pythonprompt = f"""<schema>{schema}</schema><question>{question}</question><sql>"""```### PyTorch```pythonfrom transformers import AutoModelForCausalLM, AutoTokenizerdevice = "cuda"model = AutoModelForCausalLM.from_pretrained("PipableAI/pip-sql-1.3b")tokenizer = AutoTokenizer.from_pretrained("PipableAI/pip-sql-1.3b")inputs = tokenizer(text, return_tensors="pt")outputs = model.generate(**inputs, max_new_tokens=200)print(tokenizer.decode(outputs[0], skip_special_tokens=True).split('<sql>')[1].split('</sql>')[0])```## Examples### Schema```sqlCREATE TABLE Products (product_id number,parent_product_id number,product_name text,product_price number,product_color text,product_size text,product_description text);CREATE TABLE Customers (customer_id number,gender_code text,customer_first_name text,customer_middle_initial text,customer_last_name text,email_address text,login_name text,login_password text,phone_number text,address_line_1 text,town_city text,county text,country text);CREATE TABLE Customer_Payment_Methods (customer_id number,payment_method_code text);CREATE TABLE Invoices (invoice_number number,invoice_status_code text,invoice_date time);CREATE TABLE Orders (order_id number,customer_id number,order_status_code text,date_order_placed time);CREATE TABLE Order_Items (order_item_id number,product_id number,order_id number,order_item_status_code text);CREATE TABLE Shipments (shipment_id number,order_id number,invoice_number number,shipment_tracking_number text,shipment_date time);CREATE TABLE Shipment_Items (shipment_id number,order_item_id number);```### QuestionsWhat are the email address, town and county of the customers who are of the least common gender?```sqlSELECT email_address , town_city , county FROM customers GROUP BY gender_code ORDER BY count(*) ASC LIMIT 1```What are the product price and the product size of the products whose price is above average?```sqlSELECT product_price , product_size FROM products WHERE product_price > (SELECT avg(product_price) FROM products)```Which customers did not make any orders? List the first name, middle initial and last name.```sqlSELECT T1.customer_first_name , T1.customer_middle_initial , T1.customer_last_name FROM Customers AS T1 WHERE T1.customer_id NOT IN (SELECT T2.customer_id FROM Orders AS T2)```### TeamAvi Kothari, Pratham Gupta, Ritvik Aryan Kalra, Rohan Bhatial, Soham Acharya28 unmodified lines293031323334354 unmodified lines4041424344454 unmodified lines505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023128 unmodified linesA 1.3 bn state of the art model for api calling , documentation, testing management.The tasks that the model can accomplish are the following.```markdown1. Convert any bad format text to open api2. Convert any bad format text to mark down.3. Given docs generate and execute the api call in python4 unmodified linesWe used a simulator and a form of policy gradient to train the model to self instruct itself to make documents and then perform executable calls on the document.## LicenseThe model is open source under apache 2.0. License4 unmodified lines```bashpip install transformerspip install accelerate```### Prompt```pythonprompt = f"""<question>{}</question><doc/code/any tag that explains the task at hand>"""```### PyTorch```pythonfrom transformers import AutoModelForCausalLM, AutoTokenizerfrom accelerate import Acceleratorimport torchpath = "PipableAI/pip-api-expert"model =AutoModelForCausalLM.from_pretrained(path,torch_dtype=torch.bfloat16,device_map="auto")tokenizer = AutoTokenizer.from_pretrained(path)prompt = "<question>Perform api call to do task k</question><python_code>"inputs = tokenizer(prompt, return_tensors="pt").to("cuda")outputs = model.generate(**inputs, max_new_tokens=1200)doc = (tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True))print(doc)```## Examples### markdown documentation```markdownswagger_docs = """Method accessHTTPJavaScriptPythonJavaPOSThttps://slack.com/api/chat.postMessageRequired scopesBot tokenschat:writeUser tokenschat:writechat:write:userchat:write:botLegacy bot tokensbotContent typesapplication/x-www-form-urlencodedapplication/jsonRate limitsSpecialArgumentsRequired argumentstokentoken·RequiredAuthentication token bearing required scopes. Tokens should be passed as an HTTP Authorization header or alternatively, as a POST parameter.Examplexxxx-xxxxxxxxx-xxxxchannelstring·RequiredChannel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.ExampleC1234567890At least one ofattachmentsblockstextOne of these arguments is required to describe the content of the message. If attachments or blocks are included, text will be used as fallback text for notifications only.attachmentsstringblocksblocks[] as stringtextstringHow this field works and whether it is required depends on other fields you use in your API call. See below for more detail.ExampleHello worldOptional argumentsas_userboolean·Optional(Legacy) Pass true to post the message as the authed user instead of as a bot. Defaults to false. Can only be used by classic Slack apps. See authorship below.Exampletrueicon_emojistring·OptionalEmoji to use as the icon for this message. Overrides icon_url.Example:chart_with_upwards_trend:icon_urlstring·OptionalURL to an image to use as the icon for this message.Examplehttp://lorempixel.com/48/48link_namesboolean·OptionalFind and link user groups. No longer supports linking individual users; use syntax shown in Mentioning Users instead.Exampletruemetadatastring·OptionalJSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace.Example{"event_type": "task_created", "event_payload": { "id": "11223", "title": "Redesign Homepage"}}mrkdwnboolean·OptionalDisable Slack markup parsing by setting to false. Enabled by default.DefaulttrueExamplefalseparsestring·OptionalChange how messages are treated. See below.Examplefullreply_broadcastboolean·OptionalUsed in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.Exampletruethread_tsstring·OptionalProvide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.unfurl_linksboolean·OptionalPass true to enable unfurling of primarily text-based content.Exampletrueunfurl_mediaboolean·OptionalPass false to disable unfurling of media content.Examplefalseusernamestring·OptionalSet your bot's user name.ExampleMy Bot"""question = """Convert the above docs to markdown format."""prompt = f"""<api_doc>{swagger_docs}</api_doc><question>{question}</question><response>"""inputs = tokenizer(prompt, return_tensors="pt").to("cuda")outputs = model.generate(**inputs, max_new_tokens=1800)doc = (tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True))print(doc)```### TeamAvi Kothari, Pratham Gupta, Ritvik Aryan Kalra, Rohan Bhatial, Soham Acharya
README.md+160-93