@@ -79,7 +79,7 @@ cursive = Cursive()
79
79
def add (a : float , b : float ):
80
80
"""
81
81
Adds two numbers.
82
-
82
+
83
83
a: The first number.
84
84
b: The second number.
85
85
"""
@@ -101,7 +101,7 @@ The functions' result will automatically be fed into the conversation and anothe
101
101
def create_character (name : str , age : str ):
102
102
"""
103
103
Creates a character.
104
-
104
+
105
105
name: The name of the character.
106
106
age: The age of the character.
107
107
"""
@@ -156,7 +156,7 @@ cursive = Cursive(
156
156
expand = {
157
157
' enable' : True ,
158
158
' defaults_to' : ' gpt-3.5-turbo-16k' ,
159
- ' model_mapping ' : {
159
+ ' resolve_model ' : {
160
160
' gpt-3.5-turbo' : ' gpt-3.5-turbo-16k' ,
161
161
' gpt-4' : ' claude-2' ,
162
162
},
@@ -180,6 +180,34 @@ You can pass your OpenAI API key to `Cursive`'s constructor, or set the `OPENAI_
180
180
- ` claude-instant-1.2 `
181
181
- Any other model version
182
182
183
+ #### OpenRouter
184
+
185
+ OpenRouter is a service that gives you access to leading language models in an OpenAI-compatible API, including function calling!
186
+
187
+ - ` anthropic/claude-instant-1.2 `
188
+ - ` anthropic/claude-2 `
189
+ - ` openai/gpt-4-32k `
190
+ - ` google/palm-2-codechat-bison `
191
+ - ` nousresearch/nous-hermes-llama2-13b `
192
+ - Any model version from https://openrouter.ai/docs#models
193
+
194
+ ###### Credentials
195
+
196
+ ``` python
197
+ import openai
198
+ import requests
199
+
200
+ openai.api_key = " sk-or-..."
201
+ openai.api_base = " https://openrouter.ai/api/v1"
202
+ openai.requestssession = requests.Session()
203
+ openai.requestssession.headers.update({" HTTP-Referer" : " https://appurl.com" , " X-Title" : " YOUR_APP_NAME" })
204
+
205
+ from cursive import Cursive
206
+
207
+ cursive = Cursive()
208
+ cursive.ask(prompt = " What is the meaning of life?" , model = " anthropic/claude-instant-1.2" )
209
+ ```
210
+
183
211
###### Credentials
184
212
You can pass your Anthropic API key to ` Cursive ` 's constructor, or set the ` ANTHROPIC_API_KEY ` environment variable.
185
213
@@ -208,6 +236,6 @@ You can pass your Replicate API key to `Cursive`'s constructor, or set the `REPL
208
236
### vendor support
209
237
- [x] Anthropic
210
238
- [x] Cohere
211
- - [x] Replicate
239
+ - [x] Replicate
212
240
- [ ] Azure OpenAI models
213
- - [ ] Huggingface
241
+ - [ ] Huggingface
0 commit comments