|
4 | 4 | import ldclient |
5 | 5 | from ldclient import Context |
6 | 6 | from ldclient.config import Config |
7 | | -from ldai import LDAIClient, AICompletionConfigDefault |
| 7 | +from ldai.client import LDAIClient, AICompletionConfigDefault |
8 | 8 |
|
9 | 9 | # Set sdk_key to your LaunchDarkly SDK key. |
10 | 10 | sdk_key = os.getenv('LAUNCHDARKLY_SDK_KEY') |
@@ -47,8 +47,8 @@ async def async_main(): |
47 | 47 | # provider={'name': 'openai'}, |
48 | 48 | # messages=[{'role': 'system', 'content': 'You are a helpful assistant.'}], |
49 | 49 | # ) |
50 | | - # chat = await aiclient.create_chat(ai_config_key, context, default, {'companyName': 'LaunchDarkly'}) |
51 | | - chat = await aiclient.create_chat(ai_config_key, context, variables={ |
| 50 | + # chat = await aiclient.create_model(ai_config_key, context, default, {'companyName': 'LaunchDarkly'}) |
| 51 | + chat = await aiclient.create_model(ai_config_key, context, variables={ |
52 | 52 | 'companyName': 'LaunchDarkly', |
53 | 53 | }) |
54 | 54 |
|
@@ -98,7 +98,8 @@ async def async_main(): |
98 | 98 | except Exception as err: |
99 | 99 | print("Error:", err) |
100 | 100 | finally: |
101 | | - # Close the client to flush events and close the connection. |
| 101 | + # Flush pending events and close the client. |
| 102 | + ldclient.get().flush() |
102 | 103 | ldclient.get().close() |
103 | 104 |
|
104 | 105 |
|
|
0 commit comments