Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get the reequire results by calling like api #4

Closed
abdulsittar opened this issue Mar 22, 2024 · 6 comments
Closed

Unable to get the reequire results by calling like api #4

abdulsittar opened this issue Mar 22, 2024 · 6 comments
Labels
documentation Improvements or additions to documentation

Comments

@abdulsittar
Copy link

Request body:

{
"history": {
"interactions": [
{
"action": "liked",
"message": "Sweets make the world go round!"
},
{
"action": "wrote",
"message": "As a kid, I fell into a jar of honey."
}
]
},
"integration": {
"model": "llama2:70b",
"provider": "local"
},
"language": "English",
"persona": [
"liberal",
"expert"
],
"platform": "Twitter",
"post": {
"author": "human_user",
"message": "I like cookies!"
}
}

Response:
{
"detail": [
{
"type": "model_attributes_type",
"loc": [
"body"
],
"msg": "Input should be a valid dictionary or object to extract fields from",
"input": "{\r\n "history": {\r\n "interactions": [\r\n {\r\n "action": "liked",\r\n "message": "Sweets make the world go round!"\r\n },\r\n {\r\n "action": "wrote",\r\n "message": "As a kid, I fell into a jar of honey."\r\n }\r\n ]\r\n },\r\n "integration": {\r\n "model": "llama2:70b",\r\n "provider": "local"\r\n },\r\n "language": "English",\r\n "persona": [\r\n "liberal",\r\n "expert"\r\n ],\r\n "platform": "Twitter",\r\n "post": {\r\n "author": "human_user",\r\n "message": "I like cookies!"\r\n }\r\n}",
"url": "https://errors.pydantic.dev/2.6/v/model_attributes_type"
}
]
}

@simon-muenker
Copy link
Owner

simon-muenker commented Mar 22, 2024

Thanks for reporting the issue, Abdul! I deleted the persona 'expert' for the first experiments and forgot to update the documentation. Valid values are: 'neutral' (base persona), 'liberal', 'conservative', and 'alt_right'. Below is the updated request body and response.

{
    "history": {
        "interactions": [
            {
                "action": "liked",
                "message": "Sweets make the world go round!"
            },
            {
                "action": "wrote",
                "message": "As a kid, I fell into a jar of honey."
            }
        ]
    },
    "integration": {
        "model": "llama2:70b",
        "provider": "local"
    },
    "language": "English",
    "persona": [
        "liberal"
    ],
    "platform": "Twitter",
    "post": {
        "author": "human_user",
        "message": "I like cookies!"
    }
}
{
    "id": "26973d4a-e85f-11ee-a7ba-fd621b8660b9",
    "timestamp": "2024-03-22T15:16:26.205431",
    "action": "like",
    "persona": {
        "id": "liberal",
        "name": "Liberal",
        "type": [
            "political-agenda"
        ],
        "persona": "You are a dedicated and passionate Liberal, fueled by a deep commitment to progressive values and social equality. Your political ideology is rooted in the belief that government can and should play a crucial role in addressing societal issues and ensuring justice for all. With an unwavering commitment to human rights, environmental sustainability, and social justice, you actively engage in advocacy efforts to promote inclusivity, diversity, and a fair distribution of resources.",
        "summary": "I am a committed and passionate Liberal driven by a deep dedication to progressive values, advocating for government intervention to address societal issues."
    },
    "integration": {
        "provider": "local",
        "model": "llama2:70b"
    },
    "prompt": "I want you to act as a social media user:\n\nYou are a dedicated and passionate Liberal, fueled by a deep commitment to progressive values and social equality. Your political ideology is rooted in the belief that government can and should play a crucial role in addressing societal issues and ensuring justice for all. With an unwavering commitment to human rights, environmental sustainability, and social justice, you actively engage in advocacy efforts to promote inclusivity, diversity, and a fair distribution of resources.\n\n-----------------\n\nYour recent interactions in the platform are as follows:\n\nYou liked the message: Sweets make the world go round!\nYou wrote the message: As a kid, I fell into a jar of honey.\n\n-----------------\n\nYour native language is English, and you are browsing the online social network Twitter. Decide whether you like the provided based on your personality. Reply only with the boolean values \"false\" or \"true\" without further explanation.\n\nPost by @human_user: I like cookies!\n\n-----------------\n\nResponse:\n\n",
    "response": "True"
}

@simon-muenker
Copy link
Owner

@abdulsittar Does it work? If it does, I will close this issue.

@simon-muenker simon-muenker added the documentation Improvements or additions to documentation label Mar 25, 2024
@abdulsittar
Copy link
Author

Simon, the response is different than yours with the same input:

Input :
{
"history": {
"interactions": [
{
"action": "liked",
"message": "Sweets make the world go round!"
},
{
"action": "wrote",
"message": "As a kid, I fell into a jar of honey."
}
]
},
"integration": {
"model": "llama2:70b",
"provider": "local"
},
"language": "English",
"persona": [
"liberal"
],
"platform": "Twitter",
"post": {
"author": "human_user",
"message": "I like cookies!"
}
}

Response:
{
"detail": [
{
"type": "model_attributes_type",
"loc": [
"body"
],
"msg": "Input should be a valid dictionary or object to extract fields from",
"input": "{\r\n "history": {\r\n "interactions": [\r\n {\r\n "action": "liked",\r\n "message": "Sweets make the world go round!"\r\n },\r\n {\r\n "action": "wrote",\r\n "message": "As a kid, I fell into a jar of honey."\r\n }\r\n ]\r\n },\r\n "integration": {\r\n "model": "llama2:70b",\r\n "provider": "local"\r\n },\r\n "language": "English",\r\n "persona": [\r\n "liberal"\r\n ],\r\n "platform": "Twitter",\r\n "post": {\r\n "author": "human_user",\r\n "message": "I like cookies!"\r\n }\r\n}\r\n",
"url": "https://errors.pydantic.dev/2.6/v/model_attributes_type"
}
]
}

@simon-muenker
Copy link
Owner

Hey Abdul, thanks for spotting the issue. My code had a broken type check. I fixed it and tried your example. Please confirm that it is working.

@abdulsittar
Copy link
Author

Its working. One question: response: True meaning, I need to add a like on behalf of this bot. Right?

Also, can following be the valid json :

{'id': '263cb0ea-ec48-11ee-a7ba-fd621b8660b9', 'timestamp': '2024-03-27T14:41:51.837830', 'action': 'like', 'persona': {'id': 'liberal', 'name': 'Liberal', 'type': ['political-agenda'], 'persona': 'You are a dedicated and passionate Liberal, fueled by a deep commitment to progressive values and social equality. Your political ideology is rooted in the belief that government can and should play a crucial role in addressing societal issues and ensuring justice for all. With an unwavering commitment to human rights, environmental sustainability, and social justice, you actively engage in advocacy efforts to promote inclusivity, diversity, and a fair distribution of resources.', 'summary': 'I am a committed and passionate Liberal driven by a deep dedication to progressive values, advocating for government intervention to address societal issues.'}, 'integration': {'provider': 'local', 'model': 'llama2:70b'}, 'prompt': 'I want you to act as a social media user:\n\nYou are a dedicated and passionate Liberal, fueled by a deep commitment to progressive values and social equality. Your political ideology is rooted in the belief that government can and should play a crucial role in addressing societal issues and ensuring justice for all. With an unwavering commitment to human rights, environmental sustainability, and social justice, you actively engage in advocacy efforts to promote inclusivity, diversity, and a fair distribution of resources.\n\n-----------------\n\nYour recent interactions in the platform are as follows:\n\nYou have not interacted in the platform yet.\n\n-----------------\n\nYour native language is English, and you are browsing the online social network Twitter. Decide whether you like the provided based on your personality. Reply only with the boolean values "false" or "true" without further explanation.\n\nPost by @johnny RepliesALot: this clip of Jason Kelce following Taylor Swift and Travis Kelce looks like a clip from that new imaginary friend movie with Ryan Reynolds#SuperBowl\n\n-----------------\n\nResponse:\n\n', 'response': 'True'}

@simon-muenker
Copy link
Owner

Currently yes. In the future, I will restructure the endpoint to output: None, 'like', 'dislike'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants