-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for LLM Compute Configuration
Signed-off-by: Thorsten Hans <[email protected]>
- Loading branch information
1 parent
92ccb92
commit 855f3b7
Showing
4 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Aspire.Hosting.Spin/RuntimeConfiguration/LargeLanguageModelCompute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Text; | ||
|
||
namespace Aspire.Hosting; | ||
|
||
public class LargeLanguageModelCompute : ITomlize, IEquatable<LargeLanguageModelCompute> | ||
{ | ||
public LargeLanguageModelCompute(string url, string token) | ||
{ | ||
Url = url; | ||
Token = token; | ||
} | ||
|
||
public string Url { get; } | ||
public string Token { get; } | ||
|
||
public bool Equals(LargeLanguageModelCompute? other) | ||
{ | ||
if (other == null) return false; | ||
return ReferenceEquals(this, other) || (Url.Equals(other.Url) && Token.Equals(other.Token)); | ||
} | ||
|
||
public string ToToml() | ||
{ | ||
var builder = new StringBuilder(); | ||
builder.AppendLine("type = \"remote_http\""); | ||
builder.AppendLine($"url = \"{Url}\""); | ||
builder.AppendLine($"auth_token = \"{Token}\""); | ||
return builder.ToString(); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
const int prime1 = 17; | ||
const int prime2 = 31; | ||
var hash = prime1; | ||
hash = hash * prime2 + Url.GetHashCode(); | ||
hash = hash * prime2 + Token.GetHashCode(); | ||
return hash; | ||
} | ||
|
||
public override bool Equals(object? obj) | ||
{ | ||
return Equals(obj as LargeLanguageModelCompute); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters