disham993 commited on
Commit
554fce8
·
verified ·
1 Parent(s): 1754126

Add LM Studio (OpenAI-compatible API) usage section

Browse files
Files changed (1) hide show
  1. README.md +26 -0
README.md CHANGED
@@ -84,6 +84,32 @@ Evaluated on the held-out test split (2,000 queries) of `disham993/ElectricalEle
84
 
85
  ## Usage
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  ```bash
88
  # Install dependencies
89
  pip install huggingface_hub
 
84
 
85
  ## Usage
86
 
87
+ ### LM Studio (OpenAI-compatible API)
88
+
89
+ Load this model in [LM Studio](https://lmstudio.ai) and use it via the built-in OpenAI-compatible server:
90
+
91
+ ```python
92
+ from openai import OpenAI
93
+
94
+ client = OpenAI(base_url="http://127.0.0.1:1234/v1", api_key="lm-studio")
95
+
96
+ texts = [
97
+ "What is impedance matching?",
98
+ "Impedance matching maximises power transfer by equalising source and load impedance.",
99
+ "An LLC resonant converter achieves zero-voltage switching using an LC tank circuit.",
100
+ ]
101
+
102
+ response = client.embeddings.create(
103
+ model="text-embedding-electrical-embeddinggemma-ir",
104
+ input=texts,
105
+ )
106
+
107
+ for item in response.data:
108
+ print(f"[{item.index}] dim={len(item.embedding)} first5={item.embedding[:5]}")
109
+ ```
110
+
111
+ ### llama-cpp-python
112
+
113
  ```bash
114
  # Install dependencies
115
  pip install huggingface_hub