bingal commited on
Commit
864cd52
1 Parent(s): 284c5ca

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -0
README.md CHANGED
@@ -21,6 +21,25 @@ license: mit
21
  1. Add execution permissions: `chmod +x ./Qwen-14B-Chat-q4_0.llamafile`
22
  2. Run in terminal: `./qwen1.5-7b-chat-q5_k_m.llamafile`
23
  3. Open browser to http://127.0.0.1:8080 to start chatting
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  ## Parameter Description
26
 
 
21
  1. Add execution permissions: `chmod +x ./Qwen-14B-Chat-q4_0.llamafile`
22
  2. Run in terminal: `./qwen1.5-7b-chat-q5_k_m.llamafile`
23
  3. Open browser to http://127.0.0.1:8080 to start chatting
24
+ 3. Openai api usage
25
+ * api url: `http://127.0.0.1:8080/v1`
26
+ * Python code:
27
+ ```python
28
+ #!/usr/bin/env python3
29
+ from openai import OpenAI
30
+ client = OpenAI(
31
+ base_url="http://127.0.0.1:8080/v1", # "http://<Your api-server IP>:port"
32
+ api_key = "sk-no-key-required"
33
+ )
34
+ completion = client.chat.completions.create(
35
+ model="LLaMA_CPP",
36
+ messages=[
37
+ {"role": "system", "content": "You are an AI assistant."},
38
+ {"role": "user", "content": "Write a story about dragon"}
39
+ ]
40
+ )
41
+ print(completion.choices[0].message)
42
+ ```
43
 
44
  ## Parameter Description
45