Skip to content

Commit

Permalink
Merge pull request #36 from believethehype/sdk037
Browse files Browse the repository at this point in the history
Sdk037
  • Loading branch information
believethehype authored Nov 27, 2024
2 parents 4c2a042 + 704470d commit 4506831
Show file tree
Hide file tree
Showing 113 changed files with 995 additions and 882 deletions.
14 changes: 7 additions & 7 deletions .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/dvm.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions examples/ollama_dvm/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ def main():

nip89info = {
"name": name,
"image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg",
"picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg",
"about": "I use a LLM connected via OLLAMA",
"encryptionSupported": True,
"cashuAccepted": True,
"supportsEncryption": True,
"acceptsNutZaps": dvm_config.ENABLE_NUTZAP,
"nip90Params": {

}
}

nip89config = NIP89Config()
nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"])
nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"])
nip89config.CONTENT = json.dumps(nip89info)

ollama = TextGenerationLLMLite(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config,
Expand Down
6 changes: 3 additions & 3 deletions examples/ollama_dvm/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ async def nostr_client_test_llm(prompt):
relaysTag = Tag.parse(['relays', "wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org",
"wss://nostr-pub.wellorder.net"])
alttag = Tag.parse(["alt", "This is a NIP90 DVM AI task to generate TTSt"])
event = EventBuilder(EventDefinitions.KIND_NIP90_GENERATE_TEXT, str("Generate an Audio File."),
event = EventBuilder(EventDefinitions.KIND_NIP90_GENERATE_TEXT, str("Generate an Audio File.")).tags(
[iTag, relaysTag, alttag]).sign_with_keys(keys)

relay_list = ["wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org",
"wss://nostr-pub.wellorder.net"]

client = Client(keys)
client = Client(NostrSigner.keys(keys))

for relay in relay_list:
await client.add_relay(relay)
Expand All @@ -40,7 +40,7 @@ async def nostr_client():
sk = keys.secret_key()
pk = keys.public_key()
print(f"Nostr Test Client public key: {pk.to_bech32()}, Hex: {pk.to_hex()} ")
client = Client(keys)
client = Client(NostrSigner.keys(keys))
dvmconfig = DVMConfig()
for relay in dvmconfig.RELAY_LIST:
await client.add_relay(relay)
Expand Down
8 changes: 4 additions & 4 deletions examples/tts_dvm/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def main():

nip89info = {
"name": name,
"image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg",
"picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg",
"about": "I Generate Speech from Text",
"encryptionSupported": True,
"cashuAccepted": True,
"supportsEncryption": True,
"acceptsNutZaps": dvm_config.ENABLE_NUTZAP,
"nip90Params": {
"language": {
"required": False,
Expand All @@ -35,7 +35,7 @@ def main():
}

nip89config = NIP89Config()
nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"])
nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"])
nip89config.CONTENT = json.dumps(nip89info)

tts = TextToSpeech(name=name,
Expand Down
6 changes: 3 additions & 3 deletions examples/tts_dvm/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ async def nostr_client_test_tts(prompt):
relaysTag = Tag.parse(['relays', "wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org",
"wss://nostr-pub.wellorder.net"])
alttag = Tag.parse(["alt", "This is a NIP90 DVM AI task to generate TTS"])
event = EventBuilder(EventDefinitions.KIND_NIP90_TEXT_TO_SPEECH, str("Generate an Audio File."),
event = EventBuilder(EventDefinitions.KIND_NIP90_TEXT_TO_SPEECH, str("Generate an Audio File.")).tags(
[iTag, paramTag1, bidTag, relaysTag, alttag]).sign_with_keys(keys)

relay_list = ["wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org",
"wss://nostr-pub.wellorder.net"]


client = Client(keys)
client = Client(NostrSigner.keys(keys))
for relay in relay_list:
await client.add_relay(relay)
await client.connect()
Expand All @@ -44,7 +44,7 @@ async def nostr_client():
sk = keys.secret_key()
pk = keys.public_key()
print(f"Nostr Test Client public key: {pk.to_bech32()}, Hex: {pk.to_hex()} ")
client = Client(keys)
client = Client(NostrSigner.keys(keys))

dvmconfig = DVMConfig()
for relay in dvmconfig.RELAY_LIST:
Expand Down
8 changes: 4 additions & 4 deletions examples/unleashed_dvm/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ def main():

nip89info = {
"name": name,
"image": "https://unleashed.chat/_app/immutable/assets/hero.pehsu4x_.jpeg",
"picture": "https://unleashed.chat/_app/immutable/assets/hero.pehsu4x_.jpeg",
"about": "I generate Text with Unleashed.chat",
"encryptionSupported": True,
"cashuAccepted": True,
"supportsEncryption": True,
"acceptsNutZaps": dvm_config.ENABLE_NUTZAP,
"nip90Params": {}
}

nip89config = NIP89Config()
nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"])
nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"])
nip89config.CONTENT = json.dumps(nip89info)


Expand Down
6 changes: 3 additions & 3 deletions examples/unleashed_dvm/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ async def nostr_client_test(prompt):
relaysTag = Tag.parse(['relays', "wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org",
"wss://nostr-pub.wellorder.net"])
alttag = Tag.parse(["alt", "This is a NIP90 DVM AI task to generate TTS"])
event = EventBuilder(EventDefinitions.KIND_NIP90_GENERATE_TEXT, str("Answer to prompt"),
event = EventBuilder(EventDefinitions.KIND_NIP90_GENERATE_TEXT, str("Answer to prompt")).tags(
[iTag, relaysTag, alttag]).sign_with_keys(keys)

relay_list = ["wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org",
"wss://nostr-pub.wellorder.net"]

client = Client(keys)
client = Client(NostrSigner.keys(keys))
for relay in relay_list:
await client.add_relay(relay)
await client.connect()
Expand All @@ -42,7 +42,7 @@ async def nostr_client():
sk = keys.secret_key()
pk = keys.public_key()
print(f"Nostr Test Client public key: {pk.to_bech32()}, Hex: {pk.to_hex()} ")
client = Client(keys)
client = Client(NostrSigner.keys(keys))

dvmconfig = DVMConfig()
for relay in dvmconfig.RELAY_LIST:
Expand Down
8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ def playground(announce=False):
# Add NIP89
nip89info = {
"name": name,
"image": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png",
"picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png",
"about": "I'm just a demo DVM, not doing much.'",
"encryptionSupported": True,
"cashuAccepted": True,
"supportsEncryption": True,
"acceptsNutZaps": dvm_config.ENABLE_NUTZAP,
"nip90Params": {
}
}

nip89config = NIP89Config()
nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"])
nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"])
nip89config.CONTENT = json.dumps(nip89info)

options = {
Expand Down
Loading

0 comments on commit 4506831

Please sign in to comment.