Comments (3)
Hi @McPatate Iām the maintainer of LiteLLM - we allow you to create a proxy server to call 100+ LLMs, and I think it can solve your problem (I'd love your feedback if it does not)
Try it here: https://docs.litellm.ai/docs/proxy_server
Using LiteLLM Proxy Server
import openai
openai.api_base = "http://0.0.0.0:8000/" # proxy url
print(openai.ChatCompletion.create(model="test", messages=[{"role":"user", "content":"Hey!"}]))
Creating a proxy server
Ollama models
$ litellm --model ollama/llama2 --api_base http://localhost:11434
Hugging Face Models
$ export HUGGINGFACE_API_KEY=my-api-key #[OPTIONAL]
$ litellm --model claude-instant-1
Anthropic
$ export ANTHROPIC_API_KEY=my-api-key
$ litellm --model claude-instant-1
Palm
$ export PALM_API_KEY=my-palm-key
$ litellm --model palm/chat-bison
from llm-ls.
If it were a rust crate why not, but I'm not adding a proxy to the project. This adds a dependency on Python for users and I don't like the extra process.
from llm-ls.
I'm not all that familiar with Rust, but we when the request is generated in request_completion would it be reasonable to use a dynamic property name?
async fn request_completion(
http_client: &reqwest::Client,
ide: Ide,
model: &str,
request_params: RequestParams,
api_token: Option<&String>,
prompt: String,
inputs_key: String,
request_options: HashMap<String, String>,
) -> Result<Vec<Generation>> {
let mut body = HashMap::new();
body.extend(request_options);
body.insert(inputs_key, prompt);
body.insert("parameters", request_params.into());
let res = http_client
.post(build_url(model))
.json(body)
.headers(build_headers(api_token, ide)?)
.send()
.await
.map_err(internal_error)?;
// ...
}
Just an example, but we could add inputs_key
and request_options
to CompletionParams
. To get this working for ollama a user could give inputs_key
as "prompt"
and request_options
as { model: "ollama:7b-code" }
.
Also as an aside, I don't get why we wouldn't be passing the params as a whole to the request_completion call? Would this be bad practise in Rust?
// Before
let result = request_completion(
http_client,
params.ide,
params.model,
params.request_params,
params.api_token.as_ref(),
prompt,
)
// After
let result = request_completion(
http_client,
params,
prompt,
)
from llm-ls.
Related Issues (20)
- feat: add support for self-signed certificates HOT 1
- [BUG] Server doesn't start after reboot HOT 2
- won't work on GLIBC==2.31 HOT 1
- In Windows, it will cause bug sometimes. HOT 2
- support for helix editor HOT 1
- Help: Starting HOT 3
- Cannot build testbed on Windows HOT 2
- emacs support? HOT 1
- [Suggestion] Metrics support HOT 3
- Completions not displaying in some cases HOT 1
- Add support for properly interpreting `context.selectedCompletionInfo` HOT 3
- Unauthenticated warning should not show when a custom backend is used HOT 2
- refactor: adaptor list should be an enum HOT 8
- codellama unusable with llm-ls 0.5.1 HOT 3
- When the backend is 'tgi', `build_url(...)` should append `/generate` to the URL
- Can't accept completions HOT 2
- Proposal: Launching LLM server as a daemon HOT 2
- Respect XDG environment variables HOT 1
- Deepseek Coder not working
- [LLM] missing field `request_params` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from llm-ls.