+20
.letta/settings.json
+20
.letta/settings.json
···
···
1
+
{
2
+
"localSharedBlockIds": {
3
+
"project": "block-51ffd472-f447-41a4-8822-af0e7863fa88"
4
+
},
5
+
"permissions": {
6
+
"allow": [
7
+
"Bash(ls:*)",
8
+
"Bash(magick /Users/cameron/letta/co/assets/co-logo-dark.png -resize 1024x1024 -background none -gravity center -extent 1024x1024 /Users/cameron/letta/co/assets/adaptive-icon.png)",
9
+
"Edit(src/screens/**)",
10
+
"Edit(/**)",
11
+
"Bash(git branch:*)",
12
+
"Bash(find:*)",
13
+
"Bash(npx vercel dist --prod --yes)",
14
+
"Bash(cd /Users/cameron/letta/co && git log:*)",
15
+
"Bash(cd /Users/cameron/letta/co && git status:*)",
16
+
"Bash(cd /Users/cameron/letta/co && git show:*)",
17
+
"Bash(cd /Users/cameron/letta/co && git add:*)"
18
+
]
19
+
}
20
+
}
+3
.letta/settings.local.json
+3
.letta/settings.local.json
+26
polyfills.ts
+26
polyfills.ts
···
···
1
+
/**
2
+
* Polyfills for React Native
3
+
*
4
+
* React Native doesn't have native support for:
5
+
* - TextEncoder/TextDecoder - needed by some libraries
6
+
* - Base64 encoding - needed for file uploads
7
+
* - URL parsing - needed for API calls
8
+
*
9
+
* This file loads polyfills to add these missing APIs.
10
+
*/
11
+
12
+
import { Platform } from 'react-native';
13
+
14
+
// Only apply polyfills on native platforms
15
+
if (Platform.OS !== 'web') {
16
+
console.log('🔧 Loading polyfills for React Native...');
17
+
18
+
// Load basic polyfills (encoding, base64, URL)
19
+
require('react-native-polyfill-globals/src/encoding');
20
+
require('react-native-polyfill-globals/src/base64');
21
+
require('react-native-polyfill-globals/src/url');
22
+
23
+
console.log('✅ Basic polyfills loaded (encoding, base64, URL)');
24
+
} else {
25
+
console.log('🌐 Running on web, no polyfills needed');
26
+
}
+4
-4
src/api/lettaApi.ts
+4
-4
src/api/lettaApi.ts
···
312
id: message.id,
313
role,
314
content,
315
-
created_at: message.date ? message.date.toISOString() : new Date().toISOString(),
316
tool_calls: message.tool_calls,
317
message_type: type,
318
sender_id: message.senderId,
···
633
id: message.id,
634
role,
635
content,
636
-
created_at: message.date ? message.date.toISOString() : new Date().toISOString(),
637
tool_calls: message.tool_calls,
638
message_type: type,
639
sender_id: message.senderId,
···
768
id: message.id,
769
role,
770
content,
771
-
created_at: message.date ? message.date.toISOString() : new Date().toISOString(),
772
tool_calls: message.tool_calls,
773
message_type: type,
774
sender_id: message.senderId,
···
826
id: message.id,
827
role,
828
content,
829
-
created_at: message.date ? new Date(message.date).toISOString() : new Date().toISOString(),
830
tool_calls: message.tool_calls,
831
message_type: type,
832
sender_id: message.senderId,
···
312
id: message.id,
313
role,
314
content,
315
+
created_at: message.date ? (typeof message.date === 'string' ? message.date : message.date.toISOString()) : new Date().toISOString(),
316
tool_calls: message.tool_calls,
317
message_type: type,
318
sender_id: message.senderId,
···
633
id: message.id,
634
role,
635
content,
636
+
created_at: message.date ? (typeof message.date === 'string' ? message.date : message.date.toISOString()) : new Date().toISOString(),
637
tool_calls: message.tool_calls,
638
message_type: type,
639
sender_id: message.senderId,
···
768
id: message.id,
769
role,
770
content,
771
+
created_at: message.date ? (typeof message.date === 'string' ? message.date : message.date.toISOString()) : new Date().toISOString(),
772
tool_calls: message.tool_calls,
773
message_type: type,
774
sender_id: message.senderId,
···
826
id: message.id,
827
role,
828
content,
829
+
created_at: message.date ? (typeof message.date === 'string' ? message.date : message.date.toISOString()) : new Date().toISOString(),
830
tool_calls: message.tool_calls,
831
message_type: type,
832
sender_id: message.senderId,
+40
test-image.py
+40
test-image.py
···
···
1
+
import base64
2
+
import httpx
3
+
import os
4
+
from letta_client import Letta
5
+
6
+
token = os.getenv('LETTA_API_KEY')
7
+
if not token:
8
+
print("Error: LETTA_API_KEY environment variable not set")
9
+
exit(1)
10
+
11
+
client = Letta(token=token)
12
+
13
+
image_url = "https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg"
14
+
image_data = base64.standard_b64encode(httpx.get(image_url).content).decode("utf-8")
15
+
16
+
response = client.agents.messages.create(
17
+
agent_id="agent-bb780791-961a-4fa3-95ba-b681b6d508e6",
18
+
messages=[
19
+
{
20
+
"role": "user",
21
+
"content": [
22
+
{
23
+
"type": "image",
24
+
"source": {
25
+
"type": "base64",
26
+
"media_type": "image/jpeg",
27
+
"data": image_data,
28
+
},
29
+
},
30
+
{
31
+
"type": "text",
32
+
"text": "Describe this image."
33
+
}
34
+
],
35
+
}
36
+
],
37
+
)
38
+
39
+
print("Response:")
40
+
print(response)
+44
test-image.ts
+44
test-image.ts
···
···
1
+
import { LettaClient } from '@letta-ai/letta-client';
2
+
3
+
async function testImage() {
4
+
const token = process.env.LETTA_API_KEY;
5
+
if (!token) {
6
+
console.error('Error: LETTA_API_KEY environment variable not set');
7
+
process.exit(1);
8
+
}
9
+
10
+
const client = new LettaClient({ token });
11
+
12
+
const imageUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg";
13
+
const imageResponse = await fetch(imageUrl);
14
+
const imageBuffer = await imageResponse.arrayBuffer();
15
+
const imageData = Buffer.from(imageBuffer).toString('base64');
16
+
17
+
const response = await client.agents.messages.create(
18
+
"agent-bb780791-961a-4fa3-95ba-b681b6d508e6", {
19
+
messages: [
20
+
{
21
+
role: "user",
22
+
content: [
23
+
{
24
+
type: "text",
25
+
text: "Describe this image."
26
+
},
27
+
{
28
+
type: "image",
29
+
source: {
30
+
type: "base64",
31
+
mediaType: "image/jpeg",
32
+
data: imageData,
33
+
},
34
+
}
35
+
],
36
+
}
37
+
],
38
+
}
39
+
);
40
+
41
+
console.log('Response:', response);
42
+
}
43
+
44
+
testImage().catch(console.error);