Upload 2 files
Browse files
LICENSE
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Katanemo Labs, Inc. COMMUNITY LICENSE AGREEMENT
|
2 |
+
**Version Release Date:** September 30th, 2024
|
3 |
+
|
4 |
+
This Katanemo Labs, Inc. COMMUNITY LICENSE AGREEMENT is based on the Llama 3.2 Community License, Copyright © Meta Platforms, Inc. The terms and conditions have been adapted to reflect the proprietary nature of Katanemo Labs' materials.
|
5 |
+
|
6 |
+
---
|
7 |
+
|
8 |
+
1.Definitions
|
9 |
+
a. "Agreement": The terms and conditions for use, reproduction, distribution, and modification of the Katanemo Materials set forth herein.
|
10 |
+
b. "Documentation": The specifications, manuals, and documentation accompanying Katanemo LLMs v1.
|
11 |
+
c. "Licensee" or "you: The individual or entity entering into this Agreement, including your employer if you are acting on their behalf.
|
12 |
+
d. "Katanemo": The foundational large language models and software provided by Katanemo Labs, Inc., available at https://huggingface.co/katanemolabs.
|
13 |
+
e. "Katanemo Materials": Collectively, Katanemo's proprietary models and Documentation. Some Materials are derived from the Qwen language models licensed under the Qwen RESEARCH LICENSE AGREEMENT.
|
14 |
+
f. "Katanemo Labs" or "we": Katanemo Labs Inc., a Delaware, USA Corporation.
|
15 |
+
|
16 |
+
---
|
17 |
+
|
18 |
+
2.
|
19 |
+
By clicking "I Accept" or using any part of the Katanemo Materials, you agree to be bound by this Agreement.
|
20 |
+
|
21 |
+
---
|
22 |
+
|
23 |
+
3. License Rights and Redistribution
|
24 |
+
a. Grant of Rights
|
25 |
+
You are granted a non-exclusive, worldwide, non-transferable, and royalty-free license to:
|
26 |
+
- Use, reproduce, distribute, and modify the Katanemo Materials.
|
27 |
+
- Create derivative works based on the Katanemo Materials.
|
28 |
+
|
29 |
+
4. Redistribution and Use
|
30 |
+
a. Distribution:
|
31 |
+
If you distribute the Katanemo Materials or a derivative work:
|
32 |
+
- Include a copy of this Agreement.
|
33 |
+
- Prominently display "Built with Katanemo" on a related website or documentation.
|
34 |
+
|
35 |
+
b. Attribution:
|
36 |
+
Include the following attribution notice:
|
37 |
+
"Katanemo is licensed under the Katanemo Labs Community License, Copyright © Katanemo Labs, Inc. All Rights Reserved."_
|
38 |
+
|
39 |
+
c. Compliance:
|
40 |
+
Your use must adhere to the Acceptable Use Policy, available at https://katanemolabs.com/katanemo/use-policy.
|
41 |
+
|
42 |
+
---
|
43 |
+
|
44 |
+
5. Additional Commercial Terms
|
45 |
+
If you are commercially using the Materials, you shall request a license from us.
|
46 |
+
|
47 |
+
---
|
48 |
+
|
49 |
+
6. Disclaimer of Warranty
|
50 |
+
The Katanemo Materials are provided "AS IS" without warranties of any kind, either express or implied, including but not limited to warranties of title, non-infringement, or fitness for a particular purpose.
|
51 |
+
|
52 |
+
---
|
53 |
+
|
54 |
+
7. Limitation of Liability
|
55 |
+
Katanemo Labs is not liable for any indirect, special, or consequential damages arising out of the use of the Katanemo Materials, even if advised of the possibility of such damages.
|
56 |
+
|
57 |
+
---
|
58 |
+
|
59 |
+
8. Intellectual Property
|
60 |
+
a. Trademarks
|
61 |
+
No trademark licenses are granted, except as required for attribution as described in Section 1.b. You may use the “Katanemo” mark according to Katanemo Labs' brand guidelines.
|
62 |
+
|
63 |
+
b. Ownership
|
64 |
+
You own any derivative works or modifications you create, except for portions owned by Katanemo Labs.
|
65 |
+
|
66 |
+
c. Litigation
|
67 |
+
If you file a lawsuit against Katanemo Labs regarding intellectual property, your license under this Agreement terminates.
|
68 |
+
|
69 |
+
---
|
70 |
+
|
71 |
+
9. Term and Termination
|
72 |
+
This Agreement continues until terminated. Katanemo Labs may terminate the Agreement if you breach any terms. Upon termination, you must cease using the Katanemo Materials.
|
73 |
+
|
74 |
+
---
|
75 |
+
|
76 |
+
10. Governing Law and Jurisdiction
|
77 |
+
This Agreement is governed by the laws of the State of Washington, USA. Any disputes will be resolved in the courts of California.
|
README.md
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
license_name: katanemo-research
|
4 |
+
license_link: >-
|
5 |
+
https://huggingface.co/katanemo/Arch-Function-Chat-7B/blob/main/LICENSE
|
6 |
+
base_model:
|
7 |
+
- Qwen/Qwen2.5-Coder-1.5B-Instruct
|
8 |
+
language:
|
9 |
+
- en
|
10 |
+
pipeline_tag: text-generation
|
11 |
+
library_name: transformers
|
12 |
+
---
|
13 |
+
|
14 |
+
# katanemo/Arch-Function-Chat-7B
|
15 |
+
|
16 |
+
## Overview
|
17 |
+
The Arch-Function-Chat collection builds upon the Katanemo's [Arch-Function](https://huggingface.co/collections/katanemo/arch-function-66f209a693ea8df14317ad68) collection by extending its capabilities beyond function calling. This new collection maintains the state-of-the-art(SOTA) function calling performance of the original collection while adding powerful new features that make it even more versatile in real-world applications.
|
18 |
+
|
19 |
+
In addition to function calling capabilities, this collection now offers:
|
20 |
+
|
21 |
+
- **Clarify & refine**: Generates natural follow-up questions to collect missing information for function calling
|
22 |
+
- **Interpret & respond**: Provides human-friendly responses based on function execution results
|
23 |
+
- **Context management**: Mantains context in complex multi-turn interactions
|
24 |
+
|
25 |
+
# Requirements
|
26 |
+
The code of Arch-Function-Chat-7B has been in the Hugging Face `transformers` library and we advise you to install latest version:
|
27 |
+
```bash
|
28 |
+
pip install transformers>=4.37.0
|
29 |
+
```
|
30 |
+
|
31 |
+
|
32 |
+
# How to use
|
33 |
+
We use the following example to illustrate how to use our model to perform function calling tasks. Please note that, our model works best with our provided prompt format. It allows us to extract JSON output that is similar to the [OpenAI's function calling](https://platform.openai.com/docs/guides/function-calling).
|
34 |
+
|
35 |
+
|
36 |
+
### Quickstart
|
37 |
+
````python
|
38 |
+
import json
|
39 |
+
from typing import Any, Dict, List
|
40 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
41 |
+
|
42 |
+
model_name = "katanemo/Arch-Function-Chat-7B"
|
43 |
+
model = AutoModelForCausalLM.from_pretrained(
|
44 |
+
model_name, device_map="auto", torch_dtype="auto", trust_remote_code=True
|
45 |
+
)
|
46 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
47 |
+
|
48 |
+
# Please use our provided prompt for best performance
|
49 |
+
TASK_PROMPT = (
|
50 |
+
"You are a helpful assistant designed to assist with the user query by making one or more function calls if needed."
|
51 |
+
"\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>\n{tools}\n</tools>"
|
52 |
+
"\n\nYour task is to decide which functions are needed and collect missing parameters if necessary."
|
53 |
+
)
|
54 |
+
|
55 |
+
FORMAT_PROMPT = (
|
56 |
+
"\n\nBased on your analysis, provide your response in one of the following JSON formats:"
|
57 |
+
'\n1. If no functions are needed:\n```json\n{"response": "Your response text here"}\n```'
|
58 |
+
'\n2. If functions are needed but some required parameters are missing:\n```json\n{"required_functions": ["func_name1", "func_name2", ...], "clarification": "Text asking for missing parameters"}\n```'
|
59 |
+
'\n3. If functions are needed and all required parameters are available:\n```json\n{"tool_calls": [{"name": "func_name1", "arguments": {"argument1": "value1", "argument2": "value2"}},... (more tool calls as required)]}\n```'
|
60 |
+
)
|
61 |
+
|
62 |
+
# Define available tools
|
63 |
+
tools = [
|
64 |
+
{
|
65 |
+
"type": "function",
|
66 |
+
"function": {
|
67 |
+
"name": "get_weather",
|
68 |
+
"description": "Get the current weather for a location",
|
69 |
+
"parameters": {
|
70 |
+
"type": "object",
|
71 |
+
"properties": {
|
72 |
+
"location": {
|
73 |
+
"type": "str",
|
74 |
+
"description": "The city and state, e.g. San Francisco, New York",
|
75 |
+
},
|
76 |
+
"unit": {
|
77 |
+
"type": "str",
|
78 |
+
"enum": ["celsius", "fahrenheit"],
|
79 |
+
"description": "The unit of temperature to return",
|
80 |
+
},
|
81 |
+
},
|
82 |
+
"required": ["location"],
|
83 |
+
},
|
84 |
+
},
|
85 |
+
}
|
86 |
+
]
|
87 |
+
|
88 |
+
|
89 |
+
# Helper function to create the system prompt for our model
|
90 |
+
def format_prompt(tools: List[Dict[str, Any]]):
|
91 |
+
tools = "\n".join(
|
92 |
+
[json.dumps(tool["function"], ensure_ascii=False) for tool in tools]
|
93 |
+
)
|
94 |
+
return TASK_PROMPT.format(tools=tools) + FORMAT_PROMPT
|
95 |
+
|
96 |
+
|
97 |
+
system_prompt = format_prompt(tools)
|
98 |
+
|
99 |
+
messages = [
|
100 |
+
{"role": "system", "content": system_prompt},
|
101 |
+
{"role": "user", "content": "What is the weather in Seattle?"},
|
102 |
+
]
|
103 |
+
|
104 |
+
model_inputs = tokenizer.apply_chat_template(
|
105 |
+
messages, add_generation_prompt=True, return_tensors="pt"
|
106 |
+
).to(model.device)
|
107 |
+
|
108 |
+
generated_ids = model.generate(**model_inputs, max_new_tokens=32768)
|
109 |
+
|
110 |
+
generated_ids = [
|
111 |
+
output_ids[len(input_ids) :]
|
112 |
+
for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
113 |
+
]
|
114 |
+
|
115 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
116 |
+
print(response)
|
117 |
+
````
|
118 |
+
|
119 |
+
# License
|
120 |
+
Katanemo Arch-Function collection is distributed under the [Katanemo license](https://huggingface.co/katanemo/Arch-Function-Chat-7B/blob/main/LICENSE).
|