kobkrit commited on
Commit
9cbb7d0
1 Parent(s): ac2f075

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +38 -0
README.md CHANGED
@@ -28,6 +28,7 @@ https://github.com/OpenThaiGPT/openthaigpt1.5_api_examples
28
  - **Multi-turn conversation support** for extended dialogues.
29
  - **Retrieval Augmented Generation (RAG) compatibility** for enhanced response generation.
30
  - **Impressive context handling**: Processes up to 131,072 tokens of input and generates up to 8,192 tokens, enabling detailed and complex interactions.
 
31
 
32
  ## Benchmark on [OpenThaiGPT Eval](https://huggingface.co/datasets/openthaigpt/openthaigpt_eval)
33
  ** Please take a look at ``openthaigpt/openthaigpt1.5-7b-instruct`` for this model's evaluation result.
@@ -273,6 +274,43 @@ For supported frameworks, you could add the following to `config.json` to enable
273
  }
274
  ```
275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  ### GPU Memory Requirements
277
  | **Number of Parameters** | **FP 16 bits** | **8 bits (Quantized)** | **4 bits (Quantized)** | **Example Graphic Card for 4 bits** |
278
  |------------------|----------------|------------------------|------------------------|---------------------------------------------|
 
28
  - **Multi-turn conversation support** for extended dialogues.
29
  - **Retrieval Augmented Generation (RAG) compatibility** for enhanced response generation.
30
  - **Impressive context handling**: Processes up to 131,072 tokens of input and generates up to 8,192 tokens, enabling detailed and complex interactions.
31
+ - **Tool calling support**: Enables users to efficiently call various functions through intelligent responses.
32
 
33
  ## Benchmark on [OpenThaiGPT Eval](https://huggingface.co/datasets/openthaigpt/openthaigpt_eval)
34
  ** Please take a look at ``openthaigpt/openthaigpt1.5-7b-instruct`` for this model's evaluation result.
 
274
  }
275
  ```
276
 
277
+
278
+ ### Tool Calling
279
+ The Tool Calling feature in OpenThaiGPT 1.5 enables users to efficiently call various functions through intelligent responses. This includes making external API calls to retrieve real-time data, such as current temperature information, or predicting future data simply by submitting a query.
280
+ For example, a user can ask OpenThaiGPT, “What is the current temperature in San Francisco?” and the AI will execute a pre-defined function to provide an immediate response without the need for additional coding.
281
+ This feature also allows for broader applications with external data sources, including the ability to call APIs for services such as weather updates, stock market information, or data from within the user’s own system.
282
+
283
+ #### Example:
284
+ ```python
285
+ import openai
286
+
287
+ def get_temperature(location, date=None, unit="celsius"):
288
+ """Get temperature for a location (current or specific date)."""
289
+ if date:
290
+ return {"temperature": 25.9, "location": location, "date": date, "unit": unit}
291
+ return {"temperature": 26.1, "location": location, "unit": unit}
292
+
293
+ tools = [
294
+ {
295
+ "name": "get_temperature",
296
+ "description": "Get temperature for a location (current or by date).",
297
+ "parameters": {
298
+ "location": "string", "date": "string (optional)", "unit": "enum [celsius, fahrenheit]"
299
+ },
300
+ }
301
+ ]
302
+
303
+ messages = [{"role": "user", "content": "อุณหภูมิที่ San Francisco วันนี้ีและพรุ้่งนี้คือเท่าไร่?"}]
304
+
305
+ # Simulated response flow using OpenThaiGPT Tool Calling
306
+ response = openai.ChatCompletion.create(
307
+ model=".", messages=messages, tools=tools, temperature=0.7, max_tokens=512
308
+ )
309
+
310
+ print(response)
311
+ ```
312
+ **Full example**: https://github.com/OpenThaiGPT/openthaigpt1.5_api_examples/blob/main/api_tool_calling_powered_by_siamai.py
313
+
314
  ### GPU Memory Requirements
315
  | **Number of Parameters** | **FP 16 bits** | **8 bits (Quantized)** | **4 bits (Quantized)** | **Example Graphic Card for 4 bits** |
316
  |------------------|----------------|------------------------|------------------------|---------------------------------------------|