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

Streaming for assistants #48

Open
CJCrafter opened this issue Mar 17, 2024 Discussed in #47 · 3 comments
Open

Streaming for assistants #48

CJCrafter opened this issue Mar 17, 2024 Discussed in #47 · 3 comments

Comments

@CJCrafter
Copy link
Owner

Discussed in #47

Originally posted by Nicodm13 March 16, 2024
Hello!

Do you have any plans on adding stream support for assistants?

Thanks in advance.

@CJCrafter
Copy link
Owner Author

@Nicodm13
Copy link

I have modified your code to implement the stream boolean in the RunRequest.

Skærmbillede 2024-04-11 152104

However when i run the code, i receive the error below. I have been unable to figure out why this is happening. Do you have any idea what could cause this?

Exception in thread "main" com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'event': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: (String)"event: thread.run.created
data: {"id":"run_onav4ZIb9bMwSU5e8DGnKPx2","object":"thread.run","created_at":1712841742,"assistant_id":"asst_ngOCymSqqeLGXIxl4JuOnnwh","thread_id":"thread_SY9ylc4cXucEc1BH3QRMiRqz","status":"queued","started_at":null,"expires_at":1712842342,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo-preview","instructions":"--REDACTED--"[truncated 16481 chars]; line: 1, column: 6]
	at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2477)
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:760)
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._reportInvalidToken(ReaderBasedJsonParser.java:3041)
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:2082)
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:808)
	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4912)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4818)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3772)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3740)
	at com.cjcrafter.openai.RequestHelper.executeRequest(RequestHelper.kt:78)
	at com.cjcrafter.openai.threads.runs.RunHandlerImpl.create(RunHandlerImpl.kt:12)
	at assistant.ThreadExample.main(ThreadExample.java:51)

> Task :examples:ThreadExample.main() FAILED

Execution failed for task ':examples:ThreadExample.main()'.
> Process 'command 'C:\Program Files\Java\jdk-20\bin\java.exe'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.6/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 35s
8 actionable tasks: 7 executed, 1 up-to-date

@CJCrafter
Copy link
Owner Author

Yes, it's not as simple as changing a boolean. The format of the data changes entirely.

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

No branches or pull requests

2 participants