Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions dotnet/website/articles/Consume-LLM-server-from-LM-Studio.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
## Consume LLM server from LM Studio
You can use @AutoGen.LMStudio.LMStudioAgent from `AutoGen.LMStudio` package to consume openai-like API from LMStudio local server.
You can use @AutoGen.OpenAI.OpenAIChatAgent from `AutoGen.OpenAI` package to consume an OpenAI-compatible API from a local LM Studio server.

### What's LM Studio
[LM Studio](https://lmstudio.ai/) is an app that allows you to deploy and inference hundreds of thousands of open-source language model on your local machine. It provides an in-app chat ui plus an openai-like API to interact with the language model programmatically.

### Installation
- Install LM studio if you haven't done so. You can find the installation guide [here](https://lmstudio.ai/)
- Add `AutoGen.LMStudio` to your project.
- Add `AutoGen.OpenAI` to your project.
```xml
<ItemGroup>
<PackageReference Include="AutoGen.LMStudio" Version="AUTOGEN_LMSTUDIO_VERSION" />
<PackageReference Include="AutoGen.OpenAI" Version="AUTOGEN_VERSION" />
</ItemGroup>
```

### Usage
The following code shows how to use `LMStudioAgent` to write a piece of C# code to calculate 100th of fibonacci. Before running the code, make sure you have local server from LM Studio running on `localhost:1234`.
The following code shows how to use `OpenAIChatAgent` to write a piece of C# code to calculate 100th of fibonacci. Before running the code, make sure you have local server from LM Studio running on `localhost:1234`.

[!code-csharp[](../../samples/AgentChat/Autogen.Basic.Sample/Example08_LMStudio.cs?name=lmstudio_using_statements)]
[!code-csharp[](../../samples/AgentChat/Autogen.Basic.Sample/Example08_LMStudio.cs?name=lmstudio_example_1)]
[!code-csharp[](../../samples/AgentChat/AutoGen.Basic.Sample/Example08_LMStudio.cs?name=lmstudio_using_statements)]
[!code-csharp[](../../samples/AgentChat/AutoGen.Basic.Sample/Example08_LMStudio.cs?name=lmstudio_example_1)]
Loading