Skip to content

Commit 0ce5437

Browse files
author
balogh.adam@icloud.com
committed
fix example
1 parent 709bf3a commit 0ce5437

5 files changed

Lines changed: 7 additions & 16 deletions

File tree

examples/llm_multi_turn_conversation.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ async def chat_turn(
5252
max_tokens=500,
5353
temperature=0.7,
5454
)
55+
assert isinstance(result, og.TextGenerationOutput)
5556

56-
reply = result.chat_output["content"]
57+
assert result.chat_output is not None
58+
reply = str(result.chat_output["content"])
5759
history = add_assistant_message(history, reply)
5860

5961
return reply, history, result.transaction_hash
@@ -76,10 +78,7 @@ async def main():
7678
history = [
7779
{
7880
"role": "system",
79-
"content": (
80-
"You are a concise Python tutor. "
81-
"Give short, clear answers with code examples when helpful."
82-
),
81+
"content": ("You are a concise Python tutor. Give short, clear answers with code examples when helpful."),
8382
}
8483
]
8584

src/opengradient/agents/og_langchain.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,7 @@ def _validate_model_string(model: Union[TEE_LLM, str]) -> Union[TEE_LLM, str]:
125125
else:
126126
model_str = str(model)
127127
if "/" not in model_str:
128-
raise ValueError(
129-
f"Unsupported model value '{model_str}'. "
130-
"Expected provider/model format (for example: 'openai/gpt-5')."
131-
)
128+
raise ValueError(f"Unsupported model value '{model_str}'. Expected provider/model format (for example: 'openai/gpt-5').")
132129
return model
133130

134131

@@ -372,10 +369,7 @@ def _stream(
372369
except RuntimeError:
373370
pass
374371
else:
375-
raise RuntimeError(
376-
"Synchronous stream cannot run inside an active event loop for this adapter. "
377-
"Use `astream` instead."
378-
)
372+
raise RuntimeError("Synchronous stream cannot run inside an active event loop for this adapter. Use `astream` instead.")
379373

380374
loop = asyncio.new_event_loop()
381375
try:

src/opengradient/client/alpha.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,4 +462,3 @@ def read_workflow_history(self, contract_address: str, num_results: int) -> List
462462

463463
results = contract.functions.getLastInferenceResults(num_results).call()
464464
return [convert_array_to_model_output(result) for result in results]
465-

src/opengradient/client/opg_token.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,3 @@ def ensure_opg_approval(
222222
approve_base,
223223
)
224224
return _send_approve_tx(wallet_account, w3, token, owner, spender, approve_base)
225-

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)